ci: add npm publish workflow on GitHub release#1086
Conversation
|
No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info⚙️ Run configurationConfiguration used: Organization UI Review profile: ASSERTIVE Plan: Pro Run ID: 📒 Files selected for processing (1)
📝 WalkthroughWalkthroughAdds a GitHub Actions workflow ChangesRelease Publishing Workflow
Sequence Diagram(s)sequenceDiagram
participant Release as GitHub Release
participant Actions as GitHub Actions
participant Runner as Actions Runner
participant NPM as npm Registry
Release->>Actions: release.published event
Actions->>Runner: start "publish" job
Runner->>Runner: checkout repo
Runner->>Runner: setup Node.js 22 & npm registry
Runner->>Runner: yarn install --frozen-lockfile
Runner->>Runner: yarn start test
Runner->>Runner: yarn start build
Runner->>NPM: npm publish (auth via NODE_AUTH_TOKEN, optional --tag next)
NPM-->>Runner: publish response
Estimated code review effort🎯 2 (Simple) | ⏱️ ~8 minutes Poem
🚥 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 |
There was a problem hiding this comment.
Actionable comments posted: 2
🤖 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 13-17: Replace the mutable action tags actions/checkout@v4 and
actions/setup-node@v4 with their corresponding full immutable commit SHAs:
locate the workflow steps using the identifiers "uses: actions/checkout@v4" and
"uses: actions/setup-node@v4" and update each "uses" value to the specific full
Git commit SHA for that action (e.g., actions/checkout@<full-sha> and
actions/setup-node@<full-sha>) so the publish workflow pins to immutable
versions; fetch the correct SHAs from the official GitHub Actions
repositories/releases and replace the tags accordingly.
- Around line 8-10: The publish job currently has no explicit GITHUB_TOKEN
permissions; update the publish job (the job named "publish") to add a
permissions block that scopes the GitHub token to only contents: read so
actions/checkout@v4 works but broader repo permissions are not granted.
🪄 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: Organization UI
Review profile: ASSERTIVE
Plan: Pro
Run ID: 8dd09004-1e14-4270-a3c4-1140380e15a3
📒 Files selected for processing (1)
.github/workflows/publish.yml
5bc6200 to
8678c41
Compare
0f8979a
8678c41 to
0f8979a
Compare
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## main #1086 +/- ##
==========================================
- Coverage 98.60% 94.18% -4.42%
==========================================
Files 18 18
Lines 359 413 +54
Branches 105 132 +27
==========================================
+ Hits 354 389 +35
- Misses 5 24 +19 ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
Adds a GitHub Actions workflow that automatically publishes to npm whenever a GitHub Release is published.
What it does
Prerequisites
An secret needs to be added to this repo (or at the org level) before the workflow will work. Use a granular npm automation token scoped to publish access for this package only.
Summary by CodeRabbit