Skip to content

Commit 8134908

Browse files
committed
support for other private registries
1 parent c62ef97 commit 8134908

1 file changed

Lines changed: 4 additions & 2 deletions

File tree

src/index.ts

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -60,8 +60,10 @@ const getOptionalInput = (name: string) => core.getInput(name) || undefined;
6060
core.info("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 format: https://github.com/npm/cli/blob/8f8f71e4dd5ee66b3b17888faad5a7bf6c657eed/test/lib/adduser.js#L103-L105
64+
// 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
65+
// also allow support for custom domain format, eg: //code.org.com/packages/npm/:_authToken=
66+
return /:[_-]authToken=/i.test(line);
6567
});
6668
if (authLine) {
6769
core.info(

0 commit comments

Comments
 (0)