Skip to content

Commit 3daa896

Browse files
committed
ci: keep only the newest run per branch or pull request
Nothing cancelled a superseded run. A push to a branch with an open pull request starts two runs of three jobs for the same commit -- one for the push, one for the pull request -- and a second push before those finish leaves a dozen jobs queued against commits nobody is waiting on. That queue is what left the end-to-end job without a runner for five minutes while its two siblings already had one. Keyed on the pull request where there is one, so a branch's push run and its pull-request run stay separate and each cancels only its own predecessor.
1 parent 76a206b commit 3daa896

1 file changed

Lines changed: 15 additions & 0 deletions

File tree

‎.github/workflows/ci.yml‎

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,21 @@ on:
1212
- develop
1313
pull_request:
1414

15+
# One run per branch (or per pull request), and only the newest of them. Without
16+
# this, nothing ever cancelled a superseded run: a push to a branch with an open
17+
# pull request starts TWO runs of three jobs for the same commit -- one for the
18+
# push, one for the pull request -- and a second push before those finish leaves
19+
# a dozen jobs queued against commits nobody is waiting on any more. That queue
20+
# is what left the end-to-end job without a runner for five minutes while its
21+
# two siblings were already running.
22+
#
23+
# Keyed on the pull request when there is one, so the pull-request run and the
24+
# push run of the same branch stay separate (their `github.ref` differs anyway)
25+
# and each cancels only its own predecessor.
26+
concurrency:
27+
group: ci-${{ github.event.pull_request.number || github.ref }}
28+
cancel-in-progress: true
29+
1530
jobs:
1631
ci:
1732
name: Lint, typecheck, test, build

0 commit comments

Comments
 (0)