Fix publish workflow: yarn chokes on unset NODE_AUTH_TOKEN - #919
Merged
Conversation
The v6.5.0 publish run failed at the very first yarn install step:
error Error: Failed to replace env in config: ${NODE_AUTH_TOKEN}
actions/setup-node's registry-url input always writes an .npmrc
referencing ${NODE_AUTH_TOKEN} for the registry auth line, regardless
of auth method. This workflow publishes via npm OIDC Trusted
Publishing (permissions: id-token: write, npm 11, NPM_CONFIG_PROVENANCE)
and never sets a NODE_AUTH_TOKEN secret - npm itself tolerates the
unresolved reference fine at publish time, but yarn classic (v1, used
here for install and to run `ship:ci`) fails hard on any unresolved
env var reference in .npmrc.
This started with the actions/setup-node v5->v7 bump (2026-07-15,
after v6.4.2's last successful publish) - v7 apparently writes the
.npmrc auth line in a way the previous version didn't hit the same
way.
Fix: set NODE_AUTH_TOKEN: '' at the job level. Empty satisfies yarn's
substitution without providing (or needing) a real token, since actual
publish auth goes through OIDC regardless.
Per @acburdine: this repo will eventually move to pnpm, which doesn't
have this yarn-classic quirk, but this unblocks publishing now.
Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
|
Warning Review limit reached
On-demand reviews are free for the next 17 days. After that, they cost $0.25 per reviewed file. Or wait 24 minutes for your next included review. View limit detailsLimit details: You’ve used the included review currently available. Review configuration: ⚙️ Run configurationConfiguration used: Organization UI Review profile: CHILL Plan: Team Run ID: 📒 Files selected for processing (1)
Comment |
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.
What broke
The v6.5.0 publish run failed at the first
yarn installstep:(failed run)
Why
actions/setup-node'sregistry-urlinput always writes an.npmrcreferencing${NODE_AUTH_TOKEN}for the registry auth line, regardless of auth method. This workflow publishes via npm OIDC Trusted Publishing (permissions: id-token: write, npm 11,NPM_CONFIG_PROVENANCE: true) and never sets aNODE_AUTH_TOKENsecret — npm itself tolerates the unresolved reference fine at publish time, but yarn classic (v1), used here both to install dependencies and to runship:ci, fails hard on any unresolved env var reference in.npmrc.This started with the
actions/setup-nodev5→v7 bump (e97ba5d, 2026-07-15 23:29 UTC) — landing after v6.4.2's last successful publish (17:34 UTC same day) and before this, the first publish attempt since. v7 apparently generates the.npmrcauth line in a way the previous version didn't hit the same way.Fix
Set
NODE_AUTH_TOKEN: ''at the job level. An empty value satisfies yarn's substitution without providing (or needing) a real token, since actual publish auth goes through OIDC regardless.Validated with
actionlint(clean).This repo will eventually move to pnpm, which doesn't have this yarn-classic quirk — this just unblocks publishing in the meantime.
Testing
Can't fully exercise the publish path without tagging a release, but the specific failing step (
yarn installreading the auto-generated.npmrc) is directly addressed. Recommend aworkflow_dispatchdry-run before the next real tag push to confirm.🤖 Generated with Claude Code