Repository navigation
ci: skip staging when the version is already on npm - #1
Merged
Merged
Conversation
A rerun of a Release run after the version has been published failed with "cannot publish over the previously published versions", leaving the run red even though the release was fine. Check the registry first and exit cleanly when there is nothing to stage.
📝 WalkthroughWalkthroughThe publish workflow now reads the package name and version. It skips staging when that exact version exists on npm. Otherwise, it runs the existing staging command. ChangesPublish workflow
Estimated code review effort: 2 (Simple) | ~10 minutes 🚥 Pre-merge checks | ✅ 5✅ Passed checks (5 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.yaml:
- Around line 112-115: Update the pre-staging logic in the publish workflow to
recognize versions already in npm’s staging queue and exit successfully without
issuing a second npm stage request. Distinguish a genuine version-not-found
response from registry, network, or authentication failures instead of treating
all errors as absent; fail the workflow for unknown lookup states. Add a
staged-version lookup using the OIDC token when supported, or implement/document
an equivalent reliable alternative.
🪄 Autofix
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: defaults
Review profile: CHILL
Plan: Pro Plus
Run ID: 42c76569-0c6f-4521-88d5-9da9cbbd6241
📒 Files selected for processing (1)
.github/workflows/publish.yaml
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Reruns of a Release workflow run after the version has already been published (e.g. after the GitHub Actions outage on Aug 6) fail with
You cannot publish over the previously published versions, leaving the run red even though the release is fine.This makes the "Stage the npm release for approval" step idempotent: it queries the registry with
npm viewand exits cleanly with a log message when the version already exists. Only npm and shell parameter expansion execute in the publish job, preserving the job's nothing-but-npm constraint.Verified locally: the guard correctly detects the published 0.2.0, and zizmor reports no findings.
Summary by CodeRabbit