ci(publish): use NPM_TOKEN for the @next-alignment step - #377
Conversation
OIDC trusted publishing authorizes 'npm publish' but not 'npm dist-tag add' — the dist-tag step runs as no-auth and silently fails with E401. The release therefore lands with @latest=0.44.2 and @next stuck at the previous version, breaking the documented '@next == @latest' invariant in CLAUDE.md. Fix: pipe the legacy NPM_TOKEN (already in GitHub repo secrets, created 2026-02-21) through env on the dist-tag step ONLY. 'npm publish' still uses OIDC. The token's dist-tag scope is the package (no IP allowlist needed for that scope), and the workflow falls back gracefully if the token is revoked/expired. Verified by reading the script comment, the existing fallback path, and the npm 'dist-tag' permission requirements. Next release will auto-align @next. For 0.44.2 (this release), the NPM_TOKEN secret may itself be stale — user must regenerate on npmjs.com and re-add @next manually if needed.
WalkthroughThe publish workflow now uses ChangesPublish dist-tag authentication
Estimated code review effort: 2 (Simple) | ~10 minutes Possibly related PRs
Suggested reviewers: 🚥 Pre-merge checks | ✅ 4 | ❌ 1❌ Failed checks (1 warning)
✅ Passed checks (4 passed)
✨ Finishing Touches🧪 Generate unit tests (beta)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
There was a problem hiding this comment.
Actionable comments posted: 1
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.
Inline comments:
In @.github/workflows/publish.yml:
- Around line 124-134: Update the dist-tag alignment step around the NPM_TOKEN
environment and npm dist-tag add command to explicitly bind the token to
registry.npmjs.org, using a temporary npm project or user configuration and
cleaning it up afterward. Preserve the existing next alias, version, success
message, and warning fallback while ensuring authentication is available before
the command runs.
🪄 Autofix (Beta)
Fix all unresolved CodeRabbit comments on this PR:
- Push a commit to this branch (recommended)
- Create a new PR with the fixes
ℹ️ Review info
⚙️ Run configuration
Configuration used: Path: .coderabbit.yaml
Review profile: CHILL
Plan: Pro Plus
Run ID: 19f15463-5b82-4005-9b3c-8931d954cc4b
📒 Files selected for processing (1)
.github/workflows/publish.yml
OIDC trusted publishing authorizes 'npm publish' but not 'npm dist-tag add' — the dist-tag step runs as no-auth and silently fails with E401. The release therefore lands with @latest=0.44.2 and @next stuck at the previous version, breaking the documented '@next == @latest' invariant in CLAUDE.md.
This fix pipes the legacy NPM_TOKEN (already in GitHub repo secrets, created 2026-02-21) through env on the dist-tag step ONLY. 'npm publish' still uses OIDC. The token's dist-tag scope is the package (no IP allowlist needed for that scope), and the workflow falls back gracefully if the token is revoked/expired.
For 0.44.2 (the released PR #376), the NPM_TOKEN secret may itself be stale — user must regenerate on npmjs.com and re-add @next manually if needed.
For all future releases, this PR auto-aligns @next with @latest as part of the publish.yml pipeline.
Summary by CodeRabbit
@nextdistribution tag.