fix: use NPM_TOKEN for changesets publish auth#98
Merged
Conversation
changesets/action checks for NPM_TOKEN env var, not NODE_AUTH_TOKEN. Without it, the action falls back to OIDC which fails with 403. Also removed registry-url from setup-node (changesets generates its own .npmrc) and id-token permission (not using OIDC).
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.
The publish workflow has been failing with a 403 Forbidden on npm publish. The root cause:
changesets/action@v1looks for an env var calledNPM_TOKENto authenticate, notNODE_AUTH_TOKEN. When it doesn't findNPM_TOKEN, it falls back to OIDC trusted publishing, which also fails becausechangesets/actiondoesn't properly support OIDC yet (changesets/action#515).The fix is just pointing at the right env var name. Two other cleanups follow from this:
registry-urlfromsetup-node—changesets/actiongenerates its own.npmrcusingNPM_TOKEN, so thesetup-noderegistry config was redundant (and potentially conflicting).id-token: writepermission — we're using token auth, not OIDC. No reason to request OIDC permissions we don't use.Requires the repo secret to be renamed from
NODE_AUTH_TOKEN→NPM_TOKENin Settings → Secrets and variables → Actions (already done).