Skip to content

Commit 3c43eb7

Browse files
committed
feat: enable to check auth token to github packages
1 parent 398d7ed commit 3c43eb7

1 file changed

Lines changed: 3 additions & 2 deletions

File tree

src/index.ts

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -60,8 +60,9 @@ const getOptionalInput = (name: string) => core.getInput(name) || undefined;
6060
console.log("Found existing user .npmrc file");
6161
const userNpmrcContent = await fs.readFile(userNpmrcPath, "utf8");
6262
const authLine = userNpmrcContent.split("\n").find((line) => {
63-
// check based on https://github.com/npm/cli/blob/8f8f71e4dd5ee66b3b17888faad5a7bf6c657eed/test/lib/adduser.js#L103-L105
64-
return /^\s*\/\/registry\.npmjs\.org\/:[_-]authToken=/i.test(line);
63+
// npm Registry: check based on https://github.com/npm/cli/blob/8f8f71e4dd5ee66b3b17888faad5a7bf6c657eed/test/lib/adduser.js#L103-L105
64+
// GitHub Packages: check based on https://docs.github.com/en/packages/working-with-a-github-packages-registry/working-with-the-npm-registry#authenticating-with-a-personal-access-token
65+
return /^\s*\/\/registry\.npmjs\.org\/:[_-]authToken=/i.test(line) || /^\s*\/\/npm\.pkg\.github\.com\/:[_-]authToken=/i.test(line)
6566
});
6667
if (authLine) {
6768
console.log(

0 commit comments

Comments
 (0)