ci: harden publish workflow against non-fast-forward bump push#25
Conversation
The version-bump step commits + pushes to main from CI, which raced/failed on re-runs: a re-run checked out the original (pre-bump) SHA and its `git push` was rejected as non-fast-forward once main had moved ahead. - checkout `ref: main` + `fetch-depth: 0` so the job always works from the latest main tip (re-runs no longer use a stale SHA) with full history. - `git pull --rebase origin main` before bumping — race safety net. - `git push origin HEAD:main` (explicit) and capture the version straight from `npm version` output (drops the node -p require()). - add a `workflow_dispatch` trigger so a publish can be re-kicked from the Actions UI without pushing a commit. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
|
Warning Review limit reached
More reviews will be available in 30 minutes and 38 seconds. Learn how PR review limits work. Your organization has used up its prepaid credits, and credit purchases are no longer available. Enable the review add-on in the billing tab to keep reviews running — you're only billed for reviews past your plan's rate limits ($0.25/file). ⌛ How to resolve this issue?After more reviews become available, a review can be triggered using the To avoid repeated limits, reduce automatic review volume by pausing incremental auto-reviews earlier, using label-based review opt-in, excluding WIP or generated PR titles, or requesting reviews manually when the PR is ready. If your team needs uninterrupted high-volume reviews, an organization admin can enable usage-based credits. 🚦 How do rate limits work?CodeRabbit enforces per-developer PR review limits for each organization. Most developers receive the normal plan review availability. For paid Pro and Pro+ PR reviews, CodeRabbit uses adaptive limits for sustained high-volume activity. When a developer's recent PR review activity reaches the 95th percentile or higher among CodeRabbit users, additional reviews become available more gradually as earlier reviews age out of the rolling window. Please see our Fair Usage Limits Policy for further information. ℹ️ Review info⚙️ Run configurationConfiguration used: defaults Review profile: CHILL Plan: Pro Run ID: 📒 Files selected for processing (1)
✨ 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 |
Why
The
Publish to npmworkflow failed twice on cli#24's release:NPM_TOKEN→E404atpnpm publish(token since fixed).! [rejected] main -> main (fetch first). The re-run checked out theoriginal pre-bump SHA, and
git pushwas non-fast-forward because the firstrun had already pushed the
0.1.14bump tomain.Net:
mainis at0.1.14but npm is still0.1.13(never published).Fix
checkoutwithref: main+fetch-depth: 0— the job always operates on the latestmaintip (re-runs stop using a stale SHA) with full history for the rebase.git pull --rebase origin mainbefore the bump — race safety net so the push is always fast-forward.git push origin HEAD:main(explicit) + capture the new version straight fromnpm versionoutput (removes thenode -p require()).workflow_dispatchtrigger so a publish can be re-kicked from the Actions UI without pushing a commit.Effect on merge
Merging this is itself a push to
main→ triggers a fresh run from the current tip (0.1.14) → bumps to0.1.15→ publishes with the (now valid) token. After it goes green,npm view @recoupable/cli versionshould show0.1.15with theemailscommand rename.🤖 Generated with Claude Code
Summary by cubic
Hardened the npm publish workflow so the version-bump push is always fast-forward, even on re-runs or races. The job now operates from the latest
mainand supports manual runs.Bug Fixes
ref: mainandfetch-depth: 0to always use the latestmainwith full history.git pull --rebase origin mainto keep the push fast-forward.git push origin HEAD:main.npm versionoutput (drops thenode -p require()).New Features
workflow_dispatchto trigger a publish from the Actions UI without a new commit.Written for commit 050a335. Summary will update on new commits.