ci: cancel superseded pull request runs - #228
Conversation
The per-job concurrency groups already cancelled a superseded job when its replacement was queued, but they cancelled pushes to the release branches the same way. Those runs publish coverage, and cancelling one also hides a breakage that is already on the branch. Replace them with a single workflow-level group. Only pull request runs share it; every other run gets `github.run_id`, a group of one, because a group holds at most one pending run and GitHub evicts that pending run whenever a newer one enters the group — `cancel-in-progress` protects the running run, not the queued one. Besides fixing that, one workflow-level group cancels the whole superseded run at once rather than job by job as each replacement is queued, it covers jobs that have no group of their own, and a matrix dimension added later cannot be forgotten in a group key. `release.yml` is untouched: its string-form group leaves `cancel-in-progress` false, so releases queue rather than cancel. Co-Authored-By: Claude Opus 5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_016aGHrb1YaEvaGwNELGEHjF
|
No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info⚙️ Run configurationConfiguration used: Organization UI Review profile: CHILL Plan: Advanced Run ID: 📒 Files selected for processing (1)
Included review availability: Your plan provides up to 2 included reviews per hour; 1 remains after this review. WalkthroughThe workflow adds top-level concurrency. Pull request runs use a workflow-and-ref group and can cancel in-progress runs. Other runs use a group keyed by Priority: ⬇️ Low Merge Risk: ⚪ Minimal · up to This workflow-only change safely cancels superseded pull-request runs while keeping push runs isolated and mergeable. 🚥 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 |
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## main #228 +/- ##
=======================================
Coverage 96.72% 96.72%
=======================================
Files 10 10
Lines 1009 1009
Branches 415 414 -1
=======================================
Hits 976 976
Misses 31 31
Partials 2 2
Flags with carried forward coverage won't be shown. Click here to find out more. ☔ View full report in Codecov by Harness. 🚀 New features to boost your workflow:
|
nodejs.ymlalready cancelled superseded jobs, but through two per-job concurrency groups that also cancel pushes tomain. This replaces them with one workflow-level group that only cancels pull request runs.Why the
mainpushes should not be supersededmainruns publish the coverage later comparisons are measured against, and a cancelled run also hides a breakage that is already on the branch — which is exactly when you want to know.Note that
cancel-in-progress: falsealone would not be enough: a concurrency group holds at most one pending run, and GitHub evicts that pending run whenever a newer one enters the group regardless of the flag — "any existing pending job or workflow in the same concurrency group will be canceled and the new queued job or workflow will take its place." Hencegithub.run_idfor non-pull-request events: each gets a group of one, so it can be neither cancelled nor evicted.Why one workflow-level group rather than fixing the two in place
Adding the condition to the existing blocks would have been a smaller diff, but the per-job arrangement has two other costs:
lint.Happy to switch to the minimal version (keep the per-job groups, just add the condition) if you would rather keep the existing shape.
Verification
actionlint1.7.7 is clean on both workflows, and I checked that this means something by typo'ing the expression togithub.event_nam, which it catches at exactly that line. The file is Prettier-clean.release.ymlis untouched: it already uses the string formconcurrency: ${{ github.workflow }}-${{ github.ref }}, which leavescancel-in-progressfalse, so releases queue instead of cancelling.The same change is going to
webpack-cli, and is already open ontapable(webpack/tapable#273),watchpack(webpack/watchpack#341),webpack-sources(webpack/webpack-sources#282),enhanced-resolve(webpack/enhanced-resolve#673),webpack-dev-server(webpack/webpack-dev-server#5742) andwebpack-dev-middleware(webpack/webpack-dev-middleware#2412).🤖 Generated with Claude Code
https://claude.ai/code/session_016aGHrb1YaEvaGwNELGEHjF
Generated by Claude Code
Summary by CodeRabbit