Skip to content

ci: fix concurrency group causing master badge to show cancelled#595

Merged
utensil merged 1 commit intopygae:masterfrom
utiberious:fix/ci-concurrency-head-ref
Apr 4, 2026
Merged

ci: fix concurrency group causing master badge to show cancelled#595
utensil merged 1 commit intopygae:masterfrom
utiberious:fix/ci-concurrency-head-ref

Conversation

@utiberious
Copy link
Copy Markdown
Contributor

Problem

github.head_ref is only populated for pull_request events — it is empty for push (branch or tag) events. When two push events occur in quick succession (e.g. a merge commit to master followed immediately by a release tag), both land in the same concurrency group test- and the second run cancels the first.

This is what happened after #594 merged and the v0.6.1rc1 tag was created 7 seconds later: the tag run cancelled the master run, leaving the master branch badge showing cancelled even though all checks actually passed.

Fix

concurrency:
  group: test-${{ github.head_ref || github.ref }}
  cancel-in-progress: true

github.head_ref || github.ref gives each branch/tag its own concurrency group:

  • PRs: github.head_ref = the PR's head branch name (unique per PR) — cancel-in-progress still works
  • Push to master: github.ref = refs/heads/master
  • Tag push: github.ref = refs/tags/v0.6.1rc1

No more cross-event cancellations.

References

Discovered during the 0.6.1rc1 release (see #588).

github.head_ref is only set for pull_request events; it is empty for
push-to-master and tag events. When two push events land in quick
succession (e.g. merge commit + release tag), both go into the same
unnamed group 'test-' and the second cancels the first, causing the
master badge to show 'cancelled'.

Using `github.head_ref || github.ref` gives each branch/tag its own
concurrency group while keeping the cancel-in-progress behaviour for
PRs (where head_ref is 'refs/pull/NNN/merge', unique per PR).
@utensil
Copy link
Copy Markdown
Member

utensil commented Apr 4, 2026

Thanks!

@utensil utensil merged commit 7cab4b7 into pygae:master Apr 4, 2026
5 checks passed
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.

2 participants