Skip to content

Commit

Permalink
support for other private registries
Browse files Browse the repository at this point in the history
  • Loading branch information
dohaicuong committed Apr 10, 2024
1 parent c62ef97 commit 8134908
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -60,8 +60,10 @@ const getOptionalInput = (name: string) => core.getInput(name) || undefined;
core.info("Found existing user .npmrc file");
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 /^\s*\/\/registry\.npmjs\.org\/:[_-]authToken=/i.test(line);
// npm registry format: https://github.com/npm/cli/blob/8f8f71e4dd5ee66b3b17888faad5a7bf6c657eed/test/lib/adduser.js#L103-L105
// github registry format: https://docs.github.com/en/packages/working-with-a-github-packages-registry/working-with-the-npm-registry#authenticating-with-a-personal-access-token
// also allow support for custom domain format, eg: //code.org.com/packages/npm/:_authToken=
return /:[_-]authToken=/i.test(line);
});
if (authLine) {
core.info(
Expand Down

0 comments on commit 8134908

Please sign in to comment.