Skip to content

Commit bcacf3b

Browse files
committed
Scope Flow concurrency per event -- cross-event cancelling showed as a failed check
Cancelling the duplicate across push/pull_request worked, but GitHub reports a cancelled run as a FAILING check: the PR showed 'Flow-Check pass (1m12s)' alongside 'Flow-Check fail (2s)'. That is misleading and would block merging under branch protection -- worse than the duplicate it removed. Grouping per event keeps the useful behaviour (pushing again supersedes your own in-flight run) without the two triggers cancelling each other. A PR-branch push therefore still runs Flow twice on the same commit; at ~1m12s that is the cheaper of the two problems.
1 parent 49dd5df commit bcacf3b

1 file changed

Lines changed: 9 additions & 6 deletions

File tree

‎.github/workflows/flow.yml‎

Lines changed: 9 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -17,15 +17,18 @@ on:
1717
pull_request:
1818
branches: ['main']
1919

20-
# A push to a PR branch matches BOTH triggers above, so without grouping this runs twice on the
21-
# same commit. The group key must be identical across the two events, which rules out ref/PR-number
22-
# (push sees `refs/heads/<branch>`, pull_request sees the PR number). The HEAD commit SHA is the one
23-
# value both agree on: for pull_request, `github.sha` is the synthetic merge commit, so use
24-
# `pull_request.head.sha` there and plain `github.sha` for push.
20+
# Grouped PER EVENT, deliberately. Pushing again supersedes your own in-flight run, which is what
21+
# you want; but push and pull_request are NOT collapsed into each other, even though a PR-branch
22+
# push fires both on the same commit.
23+
#
24+
# Cancelling across events was tried and is worse: GitHub reports a cancelled run as a FAILING
25+
# check, so the PR showed `Flow-Check pass` next to `Flow-Check fail (2s)` -- misleading, and it
26+
# would block merging under branch protection. One duplicated 1m12s run is the cheaper problem.
27+
#
2528
# The pull_request trigger is kept despite `push` covering every branch here, because pushes from
2629
# forks do not run workflows in this repo -- only their PRs do.
2730
concurrency:
28-
group: flow-${{ github.event.pull_request.head.sha || github.sha }}
31+
group: flow-${{ github.event_name }}-${{ github.event.pull_request.number || github.ref }}
2932
cancel-in-progress: true
3033

3134
jobs:

0 commit comments

Comments
 (0)