Skip to content

Support installation from custom NPM registry via .npmrc#179

Merged
zkochan merged 1 commit intopnpm:masterfrom
Eynorey:support-custom-registry
Oct 8, 2025
Merged

Support installation from custom NPM registry via .npmrc#179
zkochan merged 1 commit intopnpm:masterfrom
Eynorey:support-custom-registry

Conversation

@Eynorey
Copy link
Contributor

@Eynorey Eynorey commented Sep 22, 2025

Related to #177.

This PR adds support for custom NPM registry configurations, allowing the action to install PNPM from there.

With this, the action copies a potential .npmrc into the destination directory from where PNPM runs self-install, respecting potential custom registry configurations.

# My custom registry
registry = https://my-registry.my-company.com/

Note

I was also considering an action parameter, but this feels more natural - if you are already using a custom registry via .npmrc, then you'll likely want your package manager to be fetched form there as well.

But I could also see a parameter being helpful for some setups, perhaps even acting as an override to the .npmrc registry configuration. Maybe as a follow-up?

Any feedback is greatly appreciated!

Copy link

@benquarmby benquarmby left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

❤️ Love this.

My opinion doesn't matter a great deal, but I'm going to give it anyway 😜

@Eynorey Eynorey force-pushed the support-custom-registry branch 2 times, most recently from 3ea717c to eee93a8 Compare September 22, 2025 21:23
@Eynorey
Copy link
Contributor Author

Eynorey commented Oct 6, 2025

@zkochan @KSXGitHub would you mind taking a look when you get a chance, thanks!

@Ellosaur
Copy link

Ellosaur commented Oct 7, 2025

I have an environment where using the public registry is not an option due to security constraints, so being able to configure this installation to use our private registry is essential so thanks for doing this!

Copy link
Collaborator

@KSXGitHub KSXGitHub left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Alternatively, pnpm itself uses the package ini (with @types/ini for typing) to parse INI. That could be used instead of trying to reinvent the parser.

@KSXGitHub KSXGitHub requested a review from zkochan October 7, 2025 12:00
@zkochan
Copy link
Member

zkochan commented Oct 7, 2025

Just copy the .npmrc file from GITHUB_WORKSPACE to dest. Installation is performed by a pnpm version bundled with the action. It can read the .npmrc file.

copy .npmrc from GitHub workspace if it exists so that PNPM respects custom
registry configurations when self-installing
@Eynorey Eynorey force-pushed the support-custom-registry branch from eee93a8 to 0ca63ec Compare October 7, 2025 21:25
@Eynorey
Copy link
Contributor Author

Eynorey commented Oct 7, 2025

Thank you everyone for taking a look, and thank you for the feedback!

Just copy the .npmrc file from GITHUB_WORKSPACE to dest. Installation is performed by a pnpm version bundled with the action. It can read the .npmrc file.

That's so much more elegant, thank you for the suggestion!
Updated.

@zkochan zkochan merged commit 41ff726 into pnpm:master Oct 8, 2025
50 of 54 checks passed
LinnJS added a commit to suncoast-innovation-guild/action-setup that referenced this pull request Feb 15, 2026
* Fix multiline run_install example in README.md (pnpm#167)

* Remove --frozen-lockfile from examples (pnpm#171)

* feat: support installation from custom NPM registry (pnpm#179)

copy .npmrc from GitHub workspace if it exists so that PNPM respects custom
registry configurations when self-installing

* Update README.md (pnpm#175)

fix the string run_install example

* Remove unused `@types/node-fetch` dependency (pnpm#186)

* Clarify that package_json_file is relative to GITHUB_WORKSPACE (pnpm#184)

* Clarify that package_json_file is relative to GITHUB_WORKSPACE

Clarify the description for package_json_file parameter to specify that the path must be relative to the repository root.

* Apply suggestion from @zkochan

---------

Co-authored-by: Zoltan Kochan <z@kochan.io>

* feat: store caching (pnpm#188)

* add pnpm store caching

* style: format

* no semicolons
* no star imports
* import order

* style: no star imports

---------

Co-authored-by: khai96_ <hvksmr1996@gmail.com>

* refactor: remove star imports (pnpm#196)

* fix(ci): exclude macos (pnpm#197)

* ci: pin github actions (pnpm#199)

* fix: regenerate lockfile to match package.json overrides

* fix(security): override fast-xml-parser to >=5.3.4

Resolves GHSA-37qj-frw5-hhjh (RangeError DoS via numeric entities)
in transitive dependency @actions/cache > @azure/storage-blob >
@azure/core-xml > fast-xml-parser.

* fix: resolve lint, build, and security audit failures

- Fix prefer-const lint error in cache-restore/run.ts
- Override undici to >=6.23.0 (GHSA-g9mf-h72j-4rw9)
- Rebuild dist to match source changes

* fix(ci): exclude dist from CodeQL analysis

dist/index.js is generated by ncc bundling — CodeQL flags dependency
code as security issues. Ignore the dist directory since it's not
source code.

---------

Co-authored-by: Matthias <matthias.dailey@gmail.com>
Co-authored-by: Adrian Riedel <Eynorey@users.noreply.github.com>
Co-authored-by: Roman Usherenko <roman.usherenko@gmail.com>
Co-authored-by: silverwind <me@silverwind.io>
Co-authored-by: Chris Martin <ch.martin@gmail.com>
Co-authored-by: Zoltan Kochan <z@kochan.io>
Co-authored-by: Jeremiasz Major <jrh.mjr@gmail.com>
Co-authored-by: khai96_ <hvksmr1996@gmail.com>
Co-authored-by: Boosted-Bonobo <boostedbonobo1@outlook.com>
LinnJS added a commit to suncoast-innovation-guild/action-setup that referenced this pull request Feb 15, 2026
* Fix multiline run_install example in README.md (pnpm#167)

* Remove --frozen-lockfile from examples (pnpm#171)

* feat: support installation from custom NPM registry (pnpm#179)

copy .npmrc from GitHub workspace if it exists so that PNPM respects custom
registry configurations when self-installing

* Update README.md (pnpm#175)

fix the string run_install example

* Remove unused `@types/node-fetch` dependency (pnpm#186)

* Clarify that package_json_file is relative to GITHUB_WORKSPACE (pnpm#184)

* Clarify that package_json_file is relative to GITHUB_WORKSPACE

Clarify the description for package_json_file parameter to specify that the path must be relative to the repository root.

* Apply suggestion from @zkochan

---------

Co-authored-by: Zoltan Kochan <z@kochan.io>

* feat: store caching (pnpm#188)

* add pnpm store caching

* style: format

* no semicolons
* no star imports
* import order

* style: no star imports

---------

Co-authored-by: khai96_ <hvksmr1996@gmail.com>

* refactor: remove star imports (pnpm#196)

* fix(ci): exclude macos (pnpm#197)

* ci: pin github actions (pnpm#199)

* fix: regenerate lockfile to match package.json overrides

* fix(security): override fast-xml-parser to >=5.3.4

Resolves GHSA-37qj-frw5-hhjh (RangeError DoS via numeric entities)
in transitive dependency @actions/cache > @azure/storage-blob >
@azure/core-xml > fast-xml-parser.

* fix: resolve lint, build, and security audit failures

- Fix prefer-const lint error in cache-restore/run.ts
- Override undici to >=6.23.0 (GHSA-g9mf-h72j-4rw9)
- Rebuild dist to match source changes

* fix(ci): exclude dist from CodeQL analysis

dist/index.js is generated by ncc bundling — CodeQL flags dependency
code as security issues. Ignore the dist directory since it's not
source code.

---------

Co-authored-by: Matthias <matthias.dailey@gmail.com>
Co-authored-by: Adrian Riedel <Eynorey@users.noreply.github.com>
Co-authored-by: Roman Usherenko <roman.usherenko@gmail.com>
Co-authored-by: silverwind <me@silverwind.io>
Co-authored-by: Chris Martin <ch.martin@gmail.com>
Co-authored-by: Zoltan Kochan <z@kochan.io>
Co-authored-by: Jeremiasz Major <jrh.mjr@gmail.com>
Co-authored-by: khai96_ <hvksmr1996@gmail.com>
Co-authored-by: Boosted-Bonobo <boostedbonobo1@outlook.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants