Fixed authToken detection in the user .npmrc (allow for leading whitespace) (#116)

* fix: adjust regex to include leading whitespaces

* tweak regexp

Co-authored-by: Mateusz Burzyński <mateuszburzynski@gmail.com>
This commit is contained in:
Nicola Molinari
2021-11-11 17:26:06 +01:00
committed by GitHub
co-authored by Mateusz Burzyński
parent 8090f2a918
commit 21240c3cd1
2 changed files with 20 additions and 160 deletions
+19 -159
View File
File diff suppressed because one or more lines are too long
+1 -1
View File
@@ -48,7 +48,7 @@ const getOptionalInput = (name: string) => core.getInput(name) || undefined;
const userNpmrcContent = await fs.readFile(userNpmrcPath, "utf8");
const authLine = userNpmrcContent.split("\n").find((line) => {
// check based on https://github.com/npm/cli/blob/8f8f71e4dd5ee66b3b17888faad5a7bf6c657eed/test/lib/adduser.js#L103-L105
return /^\/\/registry\.npmjs\.org\/:[_-]authToken=/i.test(line);
return /^\s*\/\/registry\.npmjs\.org\/:[_-]authToken=/i.test(line);
});
if (authLine) {
console.log(