build(cli): gate release approval on publish job only#1395
build(cli): gate release approval on publish job only#1395Michael Price (michael-pr) wants to merge 2 commits into
Conversation
Split the single `release` job into three purpose-driven jobs: - `mode`: Detects pending changesets and whether a publish is needed. - `version`: Creates/updates the Version Packages PR (runs only if changesets are pending). - `publish`: Publishes to npm (requires approval, runs only if needs_publish is true). The `needs_publish` logic skips publish when changesets are pending (version PR not yet merged), and when the current version is already tagged (docs-only merges). This ensures docs/CI-only merges never leave a run stuck awaiting approval, and approval gates only the final publish step. Release approval is now environment-scoped to the `publish` job, not the entire workflow.
|
Important Review skippedDraft detected. Please check the settings in the CodeRabbit UI or the ⚙️ Run configurationConfiguration used: Path: .coderabbit.yaml Review profile: ASSERTIVE Plan: Pro Plus Run ID: You can disable this status message by setting the Use the checkbox below for a quick retry:
WalkthroughThe release workflow now detects pending changesets and existing version tags, then conditionally runs separate Estimated code review effort: 4 (Complex) | ~45 minutes Sequence Diagram(s)sequenceDiagram
participant ReleaseWorkflow
participant ModeJob
participant VersionJob
participant PublishJob
participant ChangesetsAction
participant BinariesWorkflow
ReleaseWorkflow->>ModeJob: inspect changesets and version tag
ModeJob->>VersionJob: enable when changesets exist
ModeJob->>PublishJob: enable when publishing is needed
PublishJob->>ChangesetsAction: run bunx changeset publish
PublishJob->>BinariesWorkflow: pass published tag on success
Suggested reviewers: 🚥 Pre-merge checks | ✅ 4✅ Passed checks (4 passed)
✨ Finishing Touches🧪 Generate unit tests (beta)
Comment |
|
CodeRabbit (@coderabbitai) review |
✅ Action performedReview finished.
|
|
CodeRabbit (@coderabbitai) review |
✅ Action performedReview finished.
|
There was a problem hiding this comment.
Actionable comments posted: 3
🤖 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/release.yml:
- Line 17: Add with.persist-credentials: false to the checkout step in the mode
job at .github/workflows/release.yml lines 17-17. Also add persist-credentials:
false alongside fetch-depth: 0 in the version job checkout at
.github/workflows/release.yml lines 55-57.
- Around line 51-53: Add concise rationale comments to each permissions block in
the release workflow, including the version job’s pull-request write access, the
publish job’s id-token write access for npm provenance, and the binaries
reusable-workflow call’s contents write access. Keep the existing permission
scopes unchanged.
- Around line 68-73: Scope the GitHub App tokens in
.github/workflows/release.yml at lines 68-73 by adding contents: write and
pull-requests: write permissions for the Version Packages step; also update
lines 113-118 to add contents: write for the release creation token. Apply these
permission fields within each corresponding actions/create-github-app-token
step.
🪄 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: ASSERTIVE
Plan: Pro Plus
Run ID: ff5c2196-e28f-43b3-944a-96a42ef2701f
📒 Files selected for processing (2)
.github/workflows/release.ymldocs/releasing.md
Overview of Changes
The
releaseenvironment's required-reviewer gate previously applied to every push tomain, blocking even docs-only merges with nothing to publish.release.ymlnow splits intomode,version,publish, andbinariesjobs, withenvironment: releasemoved ontopublishalone — so approval is requested only when merging the Version Packages PR actually triggers a publish. Per-job concurrency groups replace the single workflow-level group, and aneeds_publishcheck (no pending changesets and the current version not yet tagged) lets docs/CI-only merges skip bothversionandpublishentirely.Testing
mainand confirm themodejob reportsneeds_publish=false, with neitherversionnorpublishrunning — no approval requested.versionjob opens/updates the Version Packages PR without requesting approval.publishjob pauses forreleaseenvironment approval; once approved, it publishes andbinariesruns off its outputs.No GitHub environment settings change is needed — the
releaseenvironment's required reviewers remain the single approval gate. Cancel any release runs currently stuck awaiting approval from before this change.Checklist
🤖 Generated with Claude Code