-
Notifications
You must be signed in to change notification settings - Fork 100
Add provenance to published package #2039
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
Conversation
WalkthroughUpdates the GitHub Actions publish workflow by adding explicit permissions, modifying npm publish commands to include provenance and public access for both latest and beta tags, and making a minor env formatting tweak. Changes
Sequence Diagram(s)sequenceDiagram
autonumber
actor Dev as Developer
participant GH as GitHub
participant R as Actions Runner
participant OIDC as GitHub OIDC
participant NPM as npm Registry
Dev->>GH: Push/tag triggering publish workflow
GH-->>R: Start job (permissions: contents:read, id-token:write)
Note over R,OIDC: Prepare for publish with provenance
R->>OIDC: Request OIDC token (id-token: write)
OIDC-->>R: OIDC token (JWT)
R->>NPM: npm publish --provenance --access public
alt Beta tag
R->>NPM: npm publish --provenance --access public --tag beta
end
NPM-->>R: Publish result
R-->>GH: Job status
Estimated code review effort🎯 2 (Simple) | ⏱️ ~10 minutes Poem
Pre-merge checks and finishing touches✅ Passed checks (3 passed)
✨ Finishing touches🧪 Generate unit tests
Tip 👮 Agentic pre-merge checks are now available in preview!Pro plan users can now enable pre-merge checks in their settings to enforce checklists before merging PRs.
Please see the documentation for more information. Example: reviews:
pre_merge_checks:
custom_checks:
- name: "Undocumented Breaking Changes"
mode: "warning"
instructions: |
Pass/fail criteria: All breaking changes to public APIs, CLI flags, environment variables, configuration keys, database schemas, or HTTP/GraphQL endpoints must be documented in the "Breaking Change" section of the PR description and in CHANGELOG.md. Exclude purely internal or private changes (e.g., code not exported from package entry points or explicitly marked as internal). Please share your feedback with us on this Discord post. 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 |
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## main #2039 +/- ##
=======================================
Coverage 98.83% 98.83%
=======================================
Files 18 18
Lines 1549 1549
Branches 334 334
=======================================
Hits 1531 1531
Misses 18 18 ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Actionable comments posted: 0
🧹 Nitpick comments (3)
.github/workflows/publish.yml (3)
32-32
: Provenance flags: good; add a quick version guard to prevent surprise failures.Node 22 ships with a modern npm that supports
--provenance
, but adding a tiny preflight step helps future maintainers:
- Add a step before publish:
npm --version && node --version
- Optionally enforce minimum npm:
npm -v | awk -F. '{exit !($1>=9)}'
with a friendly message.No functional change; improves diagnosability.
36-39
: Mirror the condition style for prerelease branch.Same note as above: prefer
if: ${{ github.event.release.prerelease }}
for consistency and readability.
31-34
: Use expression syntax for step conditions
Convert string-quotedif:
values to expression syntax in.github/workflows/publish.yml
:
- Line 31:
if: '!github.event.release.prerelease'
→if: ${{ !github.event.release.prerelease }}
- Line 36:
if: 'github.event.release.prerelease'
→if: ${{ github.event.release.prerelease }}
Optional: add explicit “.” in yournpm publish
commands (e.g.npm publish . --provenance --access public
).
📜 Review details
Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro
📒 Files selected for processing (1)
.github/workflows/publish.yml
(2 hunks)
⏰ Context from checks skipped due to timeout of 90000ms. You can increase the timeout in your CodeRabbit configuration to a maximum of 15 minutes (900000ms). (2)
- GitHub Check: integration-tests (Node.js 22)
- GitHub Check: integration-tests (Node.js 20)
🔇 Additional comments (2)
.github/workflows/publish.yml (2)
12-14
: Correct OIDC permissions for npm provenance.Adding
permissions: { contents: read, id-token: write }
at the job level is exactly what npm provenance requires. LGTM.
34-34
: Ensure NPM_TOKEN is an automation token with publish scope.For CI publishing (with provenance) npm recommends an Automation token scoped to the package/org. Please confirm
secrets.NPM_TOKEN
is:
- Token type: Automation
- Permissions: Can publish both stable and beta
- Rotated per org policy
Also applies to: 39-39
Pull Request
What does this PR do?
Summary by CodeRabbit