Key the workflow template concurrency group on the pull request number - #829
Open
albertvillanova wants to merge 2 commits into
Open
Key the workflow template concurrency group on the pull request number#829albertvillanova wants to merge 2 commits into
albertvillanova wants to merge 2 commits into
Conversation
This was referenced Sep 11, 2026
Merged
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.
What does this PR do?
The
build_pr_documentation.ymltemplate keys its concurrency group ongithub.head_ref, which is the head branch name without the fork owner. Two open PRs from different forks whose branches share a name therefore land in the same group, and a push on one cancels the in-flight doc build on the other.Shared names are common, because many contributors push to their fork's default branch instead of creating one: in
transformers, 154 of the 1589 currently open PRs share a head branch name with another open PR, 84 of them onmainand 41 onpatch-1. I did not find a realized cancellation in the 1200 most recent runs of that doc build, so this is hardening rather than a fix for something currently failing.github.event.pull_request.numberis unique per pull request. The template only triggers onpull_request, so thegithub.run_idfallback is never reached, but keeping it means that a consumer who later adds another trigger falls back to never cancelling rather than to grouping by branch name.The snippet has been copied widely: 41 of the 42 repositories in the organization that have a
build_pr_documentation.ymlcarry this line byte for byte, and it has also been copied into test and benchmark workflows, where a cancelled run costs runner minutes rather than a doc preview.It also drops the reference to the
datasetslibrary from the sentence introducing the snippet. That claim did not hold anyway:datasetspins theusesfield to a commit SHA while the snippet shows@main, so the section reads better as a template than as a copy of one repository's workflow.