ci(npm): fallback publish token for scoped packages - #777
Conversation
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
WalkthroughThis PR hardens the npm publishing workflow by introducing a multi-token fallback mechanism for both the ChangesNPM Publishing Token Fallback
Estimated code review effort🎯 2 (Simple) | ⏱️ ~10 minutes Possibly related PRs
Suggested labels
Suggested reviewers
🚥 Pre-merge checks | ✅ 5✅ Passed checks (5 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ 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 |
📊 Coverage ReportCoverage report not available
Generated by PR Automation (Story 6.1) |
There was a problem hiding this comment.
🧹 Nitpick comments (1)
.github/workflows/npm-publish.yml (1)
212-212: 💤 Low valueConsider adopting npm trusted publishing (OIDC) for enhanced security.
The static analysis tool suggests using OIDC-based trusted publishing instead of long-lived tokens. This eliminates the need to manage
NPM_TOKENsecrets and reduces the blast radius if tokens are compromised. npm supports this via theprovenanceflag combined with GitHub's OIDC provider.This is not blocking for this PR since the current token-based approach is standard practice and the fallback logic is sound.
🤖 Prompt for 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. In @.github/workflows/npm-publish.yml at line 212, Update the publish step to use GitHub OIDC trusted publishing: enable OIDC in the node setup (e.g., set oidc: true in the npm/setup-node step) and change the publish command to add the provenance flag (replace the current invocation "npm publish --tag ${{ steps.publish-tag.outputs.tag }} --access public" with "npm publish --tag ${{ steps.publish-tag.outputs.tag }} --access public --provenance"). Remove reliance on the long-lived NPM_TOKEN secret (and any env: NPM_TOKEN usage) and ensure the workflow requests the repository OIDC token via the setup-node configuration so npm can perform provenance-based authenticated publish.
🤖 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.
Nitpick comments:
In @.github/workflows/npm-publish.yml:
- Line 212: Update the publish step to use GitHub OIDC trusted publishing:
enable OIDC in the node setup (e.g., set oidc: true in the npm/setup-node step)
and change the publish command to add the provenance flag (replace the current
invocation "npm publish --tag ${{ steps.publish-tag.outputs.tag }} --access
public" with "npm publish --tag ${{ steps.publish-tag.outputs.tag }} --access
public --provenance"). Remove reliance on the long-lived NPM_TOKEN secret (and
any env: NPM_TOKEN usage) and ensure the workflow requests the repository OIDC
token via the setup-node configuration so npm can perform provenance-based
authenticated publish.
ℹ️ Review info
⚙️ Run configuration
Configuration used: Path: .coderabbit.yaml
Review profile: CHILL
Plan: Pro
Run ID: 42fa868c-5ccc-47b3-b773-47cbc4042340
📒 Files selected for processing (1)
.github/workflows/npm-publish.yml
|
🎉 This PR is included in version 5.3.0 🎉 The release is available on: Your semantic-release bot 📦🚀 |
Context
The v5.2.8 publish workflow failed with npm 404 on PUT for @aiox-squads/core, @aiox-squads/installer and @aiox-squads/aiox-pro-cli. The workflow used only NPM_TOKEN_AIOX_SQUADS for scoped packages, while the legacy publish path already has fallback to NPM_TOKEN.
Change
Validation
Summary by CodeRabbit