Skip to content

Key the workflow template concurrency group on the pull request number - #829

Open
albertvillanova wants to merge 2 commits into
mainfrom
key-template-concurrency-on-pr-number
Open

Key the workflow template concurrency group on the pull request number#829
albertvillanova wants to merge 2 commits into
mainfrom
key-template-concurrency-on-pr-number

Conversation

@albertvillanova

@albertvillanova albertvillanova commented Sep 11, 2026

Copy link
Copy Markdown
Member

What does this PR do?

The build_pr_documentation.yml template keys its concurrency group on github.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 on main and 41 on patch-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.number is unique per pull request. The template only triggers on pull_request, so the github.run_id fallback 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.yml carry 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 datasets library from the sentence introducing the snippet. That claim did not hold anyway: datasets pins the uses field 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.

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.

1 participant