Skip to content

ci: cancel superseded pull request runs - #228

Merged
alexander-akait merged 1 commit into
mainfrom
ci/cancel-outdated-runs
Sep 18, 2026
Merged

alexander-akait merged 1 commit into
mainfrom
ci/cancel-outdated-runs

Conversation

@alexander-akait

@alexander-akait alexander-akait commented Sep 18, 2026

Copy link
Copy Markdown
Member

nodejs.yml already cancelled superseded jobs, but through two per-job concurrency groups that also cancel pushes to main. This replaces them with one workflow-level group that only cancels pull request runs.

concurrency:
  group: ${{ github.workflow }}-${{ github.event_name == 'pull_request' && github.ref || github.run_id }}
  cancel-in-progress: ${{ github.event_name == 'pull_request' }}

Why the main pushes should not be superseded

main runs 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: false alone 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." Hence github.run_id for 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:

  • It cancels job by job. Each old job dies only as its replacement is queued; a workflow-level group cancels the whole superseded run at once. The matrix is 27 test jobs (three operating systems × nine Node.js versions) plus lint.
  • Every matrix dimension has to be repeated in the group key, and a dimension added later and forgotten would make cells cancel each other — 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

actionlint 1.7.7 is clean on both workflows, and I checked that this means something by typo'ing the expression to github.event_nam, which it catches at exactly that line. The file is Prettier-clean.

release.yml is untouched: it already uses the string form concurrency: ${{ github.workflow }}-${{ github.ref }}, which leaves cancel-in-progress false, so releases queue instead of cancelling.

The same change is going to webpack-cli, and is already open on tapable (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) and webpack-dev-middleware (webpack/webpack-dev-middleware#2412).

🤖 Generated with Claude Code

https://claude.ai/code/session_016aGHrb1YaEvaGwNELGEHjF


Generated by Claude Code

Summary by CodeRabbit

  • Chores
    • Improved automated workflow management for pull requests.
    • Redundant in-progress pull request runs are now canceled, while other runs continue independently.
    • Consolidated run coordination across validation checks for more consistent CI behavior.

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
@coderabbitai

coderabbitai Bot commented Sep 18, 2026

Copy link
Copy Markdown

Review Change StackReview Change Stack

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Advanced

Run ID: 392f805f-211c-4754-b76f-12beb8e6f84d

📥 Commits

Reviewing files that changed from the base of the PR and between 1cb9c8d and b093582.

📒 Files selected for processing (1)
  • .github/workflows/nodejs.yml

Included review availability: Your plan provides up to 2 included reviews per hour; 1 remains after this review.


Walkthrough

The 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 github.run_id. The lint and test jobs no longer define separate concurrency blocks.

Priority: ⬇️ Low

Merge Risk: ⚪ Minimal · up to b0935

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)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title clearly and concisely describes the main change: cancelling superseded pull request runs through CI concurrency handling.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check. Docstring coverage is scoped to functions touched by this diff. Analyzed 0 functions across 0…
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.
✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Commit to this branch
  • Create a new PR

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.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

@codecov

codecov Bot commented Sep 18, 2026

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 96.72%. Comparing base (1cb9c8d) to head (b093582).
⚠️ Report is 1 commits behind head on main.

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           
Flag Coverage Δ
integration 96.72% <ø> (ø)

Flags with carried forward coverage won't be shown. Click here to find out more.

☔ View full report in Codecov by Harness.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

@alexander-akait
alexander-akait merged commit c9e4796 into main Sep 18, 2026
33 checks passed
@alexander-akait
alexander-akait deleted the ci/cancel-outdated-runs branch September 18, 2026 16:49
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant