From 8134908f7e712283b1e69e6e17c0f2ea5e5c53aa Mon Sep 17 00:00:00 2001 From: Eric Do Date: Wed, 10 Apr 2024 11:14:21 +1000 Subject: [PATCH 1/2] support for other private registries --- src/index.ts | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/src/index.ts b/src/index.ts index 31aef207..5601b09a 100644 --- a/src/index.ts +++ b/src/index.ts @@ -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( From dec3baf00a2313782c864287697584e0eb578676 Mon Sep 17 00:00:00 2001 From: Eric Do Date: Wed, 10 Apr 2024 11:15:33 +1000 Subject: [PATCH 2/2] add changeset for changes --- .changeset/nice-tips-heal.md | 5 +++++ 1 file changed, 5 insertions(+) create mode 100644 .changeset/nice-tips-heal.md diff --git a/.changeset/nice-tips-heal.md b/.changeset/nice-tips-heal.md new file mode 100644 index 00000000..913a7704 --- /dev/null +++ b/.changeset/nice-tips-heal.md @@ -0,0 +1,5 @@ +--- +"@changesets/action": minor +--- + +enable support for other private registry