ci: cancel superseded pull request runs - #2412
Conversation
The three per-job concurrency groups already cancelled a superseded job when its replacement was queued, but they cancelled pushes to `main`, `next` and `hot-middleware` 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 that only cancels pull request runs. Besides fixing that, it 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. 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)
🚧 Files skipped from review as they are similar to previous changes (1)
Included review availability: Your plan provides up to 8 included reviews per hour; 6 remain after this review. WalkthroughThe GitHub Actions workflow now defines concurrency at the workflow level. Pull-request runs share groups based on the workflow and ref and can be cancelled. Other runs use unique groups based on Priority: ⬇️ Low Merge Risk: ⚪ Minimal · up to Pull requests are superseded as intended, while push runs cannot cancel or evict one another. No actionable merge risk remains. 🚥 Pre-merge checks | ✅ 3 | ❌ 2❌ Failed checks (2 warnings)
✅ Passed checks (3 passed)
Full details: Linked Issues checkExplanation Issue Full details: Out of Scope Changes checkExplanation The workflow diff adds workflow-level GitHub Actions concurrency and removes per-job concurrency settings. These changes do not implement or support the
✨ 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
ℹ️ Review info
⚙️ Run configuration
Configuration used: Organization UI
Review profile: CHILL
Plan: Advanced
Run ID: 5651107f-14d8-4425-8f60-3ea679b060c3
📒 Files selected for processing (1)
.github/workflows/nodejs.yml
Included review availability: Your plan provides up to 8 included reviews per hour; 7 remain after this review.
`cancel-in-progress` only protects the run that is already executing. A concurrency group holds at most one pending run, and GitHub cancels that pending run whenever a newer one enters the group, whatever `cancel-in-progress` says. Keying every run of the workflow on the ref therefore did not deliver what the comment promised: with one branch run executing and a second waiting, a third push would have evicted the second. Group only pull request runs by ref; give everything else `github.run_id`, so each is a group of one that can be neither cancelled nor evicted. Co-Authored-By: Claude Opus 5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_016aGHrb1YaEvaGwNELGEHjF
|
Pushed a correction in 9acaad2 before anyone spent time reviewing the first version — the review on the sibling PR (webpack/enhanced-resolve#673) caught a real flaw that this PR had too.
So keying every run on the ref did not actually deliver what this PR claims. With one The group is now: group: ${{ github.workflow }}-${{ github.event_name == 'pull_request' && github.ref || github.run_id }}
cancel-in-progress: ${{ github.event_name == 'pull_request' }}Pull requests still group by ref and supersede as described above; every other run gets a group of one and can be neither cancelled nor evicted. Generated by Claude Code |
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## main #2412 +/- ##
==========================================
- Coverage 97.16% 97.04% -0.13%
==========================================
Files 12 12
Lines 1660 1660
==========================================
- Hits 1613 1611 -2
- Misses 47 49 +2 ☔ View full report in Codecov by Harness. 🚀 New features to boost your workflow:
|
nodejs.ymlalready cancelled superseded jobs, but through three per-job concurrency groups that also cancel pushes tomain,nextandhot-middleware. This replaces them with one workflow-level group that only cancels pull request runs.Why the branch pushes should not be cancelled
That is the actual bug here.
main,nextandhot-middlewareare built on push, those runs publish coverage, and two merges in quick succession cancel the first one's. A cancelled run also hides a breakage that is already on the branch, which is exactly when you want to know.Why one workflow-level group rather than fixing the three in place
Adding the condition to the existing blocks would have been a smaller diff, but the per-job arrangement has two other costs:
lintandclient).testcurrently spells outos,node-versionandwebpack-version; a dimension added later and forgotten would make cells cancel each other, which is a quiet and confusing failure. Keying on the workflow and ref cannot drift.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 all four 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 also Prettier- and cspell-clean using this repo's own configs.release.ymlis untouched: it already usesconcurrency: ${{ github.workflow }}-${{ github.ref }}, whose string form leavescancel-in-progressfalse, so releases queue instead of cancelling.dependabot.ymlanddependency-review.ymlare untouched too — short jobs, and cancelling the Dependabot one halfway could leave a pull request without the auto-merge it was about to enable.The same change is going to
enhanced-resolve(webpack/enhanced-resolve#673) andwebpack-dev-server(webpack/webpack-dev-server#5742).🤖 Generated with Claude Code
https://claude.ai/code/session_016aGHrb1YaEvaGwNELGEHjF
Generated by Claude Code
Summary by CodeRabbit