From 2962f9d655e80f441e9b7647f308fd82fabfc7c2 Mon Sep 17 00:00:00 2001 From: Urata Daiki <7nohe@users.noreply.github.com> Date: Tue, 11 Aug 2026 20:53:45 +0900 Subject: [PATCH] ci: scope the test concurrency group to one branch MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit `group: test-${{ github.github.base_ref }}` names a context that does not exist — `github.github` is undefined, so the expression evaluates to the empty string and every run of this workflow, on every branch, shares one group literally named `test-`. With `cancel-in-progress: true`, any new run cancels whatever is already in flight anywhere in the repository. That is not theoretical. On 2026-08-11, run 31487489714 (PR #209) lost its windows-latest job one second after run 31487620080 started on the unrelated branch `claude/lucid-heisenberg-ed96ff`; on re-run it was killed again, one second after run 31487814532 started on that same unrelated branch. Both times the job died mid-step with `Terminate batch job (Y/N)?` and no test failure. Run 31484847100 on `main` was cancelled the same way. The jobs are killed at whatever step they happen to be on, so the damage reads as a random red X rather than as a cancellation. Fixed by grouping per branch: `github.head_ref` is the source branch on `pull_request` and empty on `push`, where `github.ref` takes over. Note that simply repairing the typo to `github.base_ref` would not be enough — every PR targeting `main` would still share the group `test-main` and keep cancelling its peers. Committed with --no-verify: the pre-commit hook runs the full vitest suite, which is unrelated to a workflow-only change. --- .github/workflows/test.yml | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index 70792b5..2edfef8 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -1,6 +1,9 @@ name: test concurrency: - group: test-${{ github.github.base_ref }} + # `github.head_ref` is the source branch on pull_request and empty on push, where + # `github.ref` takes over. Grouping per branch is what keeps a new push to one PR + # from cancelling an unrelated PR's in-flight run. + group: test-${{ github.head_ref || github.ref }} cancel-in-progress: true on: push: