fix(ci): remove registry-url to stop GitHub token injection#14
Merged
fix(ci): remove registry-url to stop GitHub token injection#14
Conversation
actions/setup-node@v4 defaults token: to github.token, which sets NODE_AUTH_TOKEN to the GitHub Actions token — not an npm token. npm then tried to authenticate with npmjs.org using a GitHub token, causing E404. Removing registry-url prevents setup-node from creating the .npmrc and injecting any token, letting OIDC trusted publisher auth work cleanly via --provenance.
Mirror the pattern from the ui repo: - Keep registry-url so setup-node creates .npmrc - sed + unset to strip the injected GitHub token - pnpm pack to build the tarball - npx --yes npm@latest to publish via latest npm on-the-fly (avoids the broken npm install -g npm@latest on the runner)
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.
Root cause
actions/setup-node@v4defaults itstoken:input togithub.token, so usingregistry-urlcaused it to inject the GitHub Actions token asNODE_AUTH_TOKEN. npm then tried to authenticate to npmjs.org with a GitHub token →E404 Not Found.Fix
Remove
registry-url: https://registry.npmjs.orgfromsetup-nodein bothcanaryandreleasejobs. Without it, setup-node doesn't create an.npmrcor inject any token.npm publish --provenancethen uses the OIDC trusted publisher flow directly with the GitHub Actions OIDC token.Requires trusted publisher to be configured on npmjs.com (already done).