FormatCheck.yml: key concurrency group on PR number, not base ref#74
Merged
Conversation
For `pull_request_target` events, `github.ref` resolves to the target branch (typically `refs/heads/main`), not the PR head. With `cancel-in-progress: true`, that put every PR's format check into the same concurrency group: any new PR would cancel in-progress format checks on all other PRs across the repo. Key the group on `github.event.pull_request.number` when a PR context is available, falling back to `github.ref` otherwise. Each PR now cancels only its own previous runs.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Small bug in the shared `FormatCheck.yml` concurrency config. The group was:
```yaml
concurrency:
group: "${{ inputs.concurrent-jobs && github.run_id || github.ref }}:${{ github.workflow }}"
cancel-in-progress: ${{ !inputs.concurrent-jobs && inputs.cancel-in-progress }}
```
For `pull_request_target` events, `github.ref` is the target branch
(`refs/heads/main`), so every open PR's format check ended up in the same
concurrency group. With `cancel-in-progress: true`, whenever any PR triggered
a new format check, it cancelled in-progress format checks on all other PRs —
which is why PRs frequently show "Format Check / Check Formatting: cancelled"
for no visible reason.
Observed concretely on ITensor/FunctionImplementations.jl#53:
the Format Check was cancelled when a different CompatHelper PR started a run
on the same repo.
Fix
Key the group on `github.event.pull_request.number` when it's available, so
each PR has its own group. Fall back to `github.ref` for non-PR triggers
(e.g. scheduled or manual dispatch).