Skip to content

perf(ci): cancel superseded pull request runs - #328

Merged
BryanFRD merged 1 commit into
mainfrom
perf/concurrency
Sep 5, 2026
Merged

perf(ci): cancel superseded pull request runs#328
BryanFRD merged 1 commit into
mainfrom
perf/concurrency

Conversation

@BryanFRD

@BryanFRD BryanFRD commented Sep 5, 2026

Copy link
Copy Markdown
Contributor

Adds workflow-level concurrency so a second push cancels the first run instead of racing it, and so a burst of merges no longer produces a release per merge.

ci.yml calls FerrLabs/.github's reusable-ferrflow-release and had no group at all, which is what made this repository one of the three where a release could be interrupted. cancel-in-progress is conditional on purpose:

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

Superseded pull request runs are cancelled. Pushes to main queue instead, which is the point: the release commit is pushed without [skip ci], so it starts another run of this workflow, and cancelling would kill the release that is still publishing. Queueing bounds a burst at one running and one pending release rather than one per merge, since GitHub keeps at most one pending run per group.

pr-title.yml keys its group on the pull request number. pull_request_target runs in the base's context, so github.ref is the base branch there and every open PR would otherwise share one group and cancel each other.

Workflows that publish are left alone: no form of cancellation is safe for them.

Ref FerrLabs/.github#321

@BryanFRD
BryanFRD enabled auto-merge (squash) September 5, 2026 21:30
@github-actions

github-actions Bot commented Sep 5, 2026

Copy link
Copy Markdown

SonarQube — aucune nouvelle issue

Comparaison entre le projet bac à sable de cette PR et la branche par défaut : SonarQube Community n'analyse pas les PR, ce delta est calculé côté CI. Détail

@ferrfleet ferrfleet Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Checked the four groups against each workflow's actual triggers.

ci.yml is the one that matters and it's right: github.ref is refs/pull/N/merge on pull_request, so PR runs get their own group and cancel cleanly, while refs/heads/main pushes and workflow_dispatch queue and never interrupt reusable-ferrflow-release. The release commit pushed back to main lands in the same group and waits rather than being killed, which is the behaviour the description claims.

pr-title.yml keying on github.event.pull_request.number is correct for pull_request_targetgithub.ref really would be the base branch there and collapse every open PR into one group.

Three nits inline, none blocking.

group: ${{ github.workflow }}-${{ github.event.pull_request.number || github.ref }}
# `pull_request_target` runs in the base's context, so `github.ref` is
# the base branch and every open PR would share one group.
cancel-in-progress: ${{ github.event_name == 'pull_request_target' }}

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nit: same as renovate-rebase.yml, pull_request_target is the only trigger here so this is always true.

Suggested change
cancel-in-progress: ${{ github.event_name == 'pull_request_target' }}
cancel-in-progress: true


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

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nit: pull_request is the only trigger on this workflow, so the condition is constant. Reads as if another event might reach it.

Suggested change
cancel-in-progress: ${{ github.event_name == 'pull_request' }}
cancel-in-progress: true

workflow_dispatch:

concurrency:
group: ${{ github.workflow }}-${{ github.ref }}

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nit: this workflow has push: [main], schedule and workflow_dispatch, and all three resolve github.ref to refs/heads/main, so they now share one group and queue. GitHub keeps at most one pending run per group, so if two commits land on main around 06:00 the nightly scan can be cancelled while pending and silently skipped for the day.

Not a correctness bug (the push scans cover main too), but if you want the schedule to be independent of push traffic:

Suggested change
group: ${{ github.workflow }}-${{ github.ref }}
group: ${{ github.workflow }}-${{ github.ref }}-${{ github.event_name }}

Cost is that a push scan and a nightly scan can run concurrently, which is harmless here.

@BryanFRD
BryanFRD merged commit 06ae297 into main Sep 5, 2026
16 checks passed
@BryanFRD
BryanFRD deleted the perf/concurrency branch September 5, 2026 21:32
ferrflow Bot added a commit that referenced this pull request Sep 5, 2026
## [8.0.3] - 2026-09-05

### Bug Fixes

- perf(ci): cancel superseded pull request runs (#328)
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