fix(install-node-modules): set NODE_AUTH_TOKEN for the setup-node cache probe - #2
Open
oscnord wants to merge 1 commit into
Open
fix(install-node-modules): set NODE_AUTH_TOKEN for the setup-node cache probe#2oscnord wants to merge 1 commit into
oscnord wants to merge 1 commit into
Conversation
…he probe Yarn consumers have failed in this action since the setup-node v6 to v7 bump in 7d41d76, with: error Error: Failed to replace env in config: ${NODE_AUTH_TOKEN} at NpmRegistry.normalizeConfig (yarn/lib/cli.js:31940) The Setup Node step pairs registry-url, which makes setup-node write an .npmrc containing //npm.pkg.github.com/:_authToken=${NODE_AUTH_TOKEN}, with cache, which makes it shell out to the package manager to locate the cache directory. v7 configures auth before that lookup, so the probe reads an .npmrc referencing a variable that is only set on the Install dependencies step further down. Yarn treats an .npmrc variable it cannot resolve as fatal. npm and pnpm do not, and bun skips this step entirely, so the regression was invisible on every repo except the yarn ones. Setting the token on the step is enough; the install step keeps its own copy.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Did not have push rights to this PR so that is why the PR is created through a fork.
Yarn consumers of
install-node-moduleshave failed on every run since thesetup-nodev6 to v7 bump in 7d41d76 (2026-09-03):shapeshifter-smart-tvhas been red on every branch since 2026-09-05, including six renovate PRs. Last green run there was 2026-08-31.Cause
The
Setup Nodestep pairs two inputs that interact:registry-urlmakes setup-node write an.npmrccontaining//npm.pkg.github.com/:_authToken=${NODE_AUTH_TOKEN}cachemakes setup-node shell out to the package manager to locate the cache directory,yarn cache dirfor yarnv7 configures the registry auth before that cache lookup, so the probe reads an
.npmrcreferencing a variable that the action only sets further down, onInstall dependencies.Yarn treats an
.npmrcvariable it cannot resolve as fatal. Reproduced against the exact.npmrcsetup-node writes:NODE_AUTH_TOKENyarn cache direrror Failed to replace env in confignpm config get cachepnpm store pathThat is why the regression was invisible. Of the repos on this action, the bun ones skip the step entirely via
if: manager != 'bun', and the pnpm ones tolerate the unresolved variable. Only yarn breaks, and there is one yarn consumer.Fix
Set the token on the step that needs it. The install step keeps its own copy, so nothing else changes.
Verified: with the variable set,
yarn cache dirreturns the cache path against the identical.npmrc.npm-install-node-modulesdelegates here, so it is covered too.Verification
actionlintclean.install-node-modules/action.ymlparses,Setup Nodecarries theenvblock.shapeshifter-smart-tvis the real test.Filed from a fork; I do not have push access here.
shapeshifter-smart-tvis pinned to 1db48ea meanwhile, tracked in sfstudios/shapeshifter-smart-tv#647.