ci: drop hardcoded NPM_TOKEN from .npmrc so v4.2.1 finally publishes#29
Merged
Merged
Conversation
The repo-level .npmrc pinned:
//npm.pkg.github.com/:_authToken=${NPM_TOKEN}
A project .npmrc takes precedence over the config that actions/setup-node
writes, so this line overrode the CI-provided NODE_AUTH_TOKEN. With NPM_TOKEN
no longer set, ${NPM_TOKEN} expanded to an empty string and every publish
failed with "npm error 401 Unauthorized ... unauthenticated", even after the
workflow was switched to GITHUB_TOKEN.
Drop the auth line and keep only the scope->registry mapping; setup-node now
supplies authentication via NODE_AUTH_TOKEN (GITHUB_TOKEN) in its own config.
Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01Y2XJw3TXS1EuWdgmnGD4ts
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.
Context
Follow-up to #28. Even after switching the workflow to
GITHUB_TOKEN, thepublishjob onmainstill failed with 401:Root cause
The repository-level
.npmrcpinned the auth token to a variable that is no longer set:A project
.npmrctakes precedence over the config thatactions/setup-nodewrites (NPM_CONFIG_USERCONFIG). So this line overrode the CI-providedNODE_AUTH_TOKEN; withNPM_TOKENunset,${NPM_TOKEN}expanded to an empty string, and npm authenticated with no token → 401. TheGITHUB_TOKENset in #28 was never actually consulted.What this PR does
_authTokenline from.npmrc, keeping only the scope → registry mapping.actions/setup-nodenow supplies authentication viaNODE_AUTH_TOKEN(GITHUB_TOKEN) in its own generated config, which is exactly what the deprecated line was blocking.No package-content or
codepack.shchange —4.2.1(already onmain, still unpublished) remains the version to be published, so there is no version conflict.Verification
.npmrcstill maps the@w3spi5scope to GitHub Packages for local usepublishjob'snpm publishshould authenticate viaGITHUB_TOKENand publish@w3spi5/codepack@4.2.1to GitHub Packagestestjob is unaffectedNote: if publishing still fails after this (e.g. GitHub Packages "Actions access" for the existing package doesn't include this repo), that would be a package-settings change only the maintainer can make in the repo/package UI — I'll report clearly if that turns out to be the case.
🤖 Generated with Claude Code
Generated by Claude Code