Code of Conduct
What article on docs.github.com is affected?
https://docs.github.com/en/actions/learn-github-actions/workflow-syntax-for-github-actions#example-using-concurrency-to-cancel-any-in-progress-job-or-run
What part(s) of the article would you like to see updated?
👋🏽 I recently made a change to several of our GitHub Actions workflows that adds the config from https://docs.github.com/en/actions/reference/workflow-syntax-for-github-actions#example-using-concurrency-to-cancel-any-in-progress-job-or-run to cancel any redundant in-progress run on the current PR – to recreate the PR behavior other CI providers offer out of the box. (e.g. Azure Pipelines, CircleCI)
However, it wasn't having the intended effect – it resulted in progress runs of these workflows to get canceled no matter what branch they're on, so long as they have an open PR.
From a lot of back and forth with GitHub Support, it turns out the issue was that the repo has multiple workflows that run on pull requests. Concurrency group names must be unique for each workflow across the whole repo, otherwise they will auto-cancel each other on a single PR run (because that would mean they share the same concurrency group).
In the example given in the GitHub Actions docs, github.head_ref evaluates to the same string on every workflow on a given PR, leading to these workflow runs were clobbering each other.
The fix is to ensure that each concurrency group name is unique. But, this wasn't clear to me from the docs at all – I only found this out from messaging GitHub Support and a lot of trial and error. I'd like to do what I can to help other folks avoid similar frustration in the future, with any luck. 🙏🏽
Expected
The docs gives examples for how multiple workflows with auto-canceling in-progress runs / jobs can coexist without auto-canceling each other.
Actual
The docs' only example for enabling auto-canceling on a PR sets a single concurrency group name that doesn't allow for multiple workflows to coexist without auto-canceling each other on a pull request (github.head_ref as the whole concurrency group name)
Let me know if there's any more information I could add that would be helpful! 🙇🏽 I'll have a PR up for this shortly.
Additional information
Code of Conduct
What article on docs.github.com is affected?
https://docs.github.com/en/actions/learn-github-actions/workflow-syntax-for-github-actions#example-using-concurrency-to-cancel-any-in-progress-job-or-run
What part(s) of the article would you like to see updated?
👋🏽 I recently made a change to several of our GitHub Actions workflows that adds the config from https://docs.github.com/en/actions/reference/workflow-syntax-for-github-actions#example-using-concurrency-to-cancel-any-in-progress-job-or-run to cancel any redundant in-progress run on the current PR – to recreate the PR behavior other CI providers offer out of the box. (e.g. Azure Pipelines, CircleCI)
However, it wasn't having the intended effect – it resulted in progress runs of these workflows to get canceled no matter what branch they're on, so long as they have an open PR.
From a lot of back and forth with GitHub Support, it turns out the issue was that the repo has multiple workflows that run on pull requests. Concurrency group names must be unique for each workflow across the whole repo, otherwise they will auto-cancel each other on a single PR run (because that would mean they share the same concurrency group).
In the example given in the GitHub Actions docs,
github.head_refevaluates to the same string on every workflow on a given PR, leading to these workflow runs were clobbering each other.The fix is to ensure that each concurrency group name is unique. But, this wasn't clear to me from the docs at all – I only found this out from messaging GitHub Support and a lot of trial and error. I'd like to do what I can to help other folks avoid similar frustration in the future, with any luck. 🙏🏽
Expected
The docs gives examples for how multiple workflows with auto-canceling in-progress runs / jobs can coexist without auto-canceling each other.
Actual
The docs' only example for enabling auto-canceling on a PR sets a single concurrency group name that doesn't allow for multiple workflows to coexist without auto-canceling each other on a pull request (
github.head_refas the whole concurrency group name)Let me know if there's any more information I could add that would be helpful! 🙇🏽 I'll have a PR up for this shortly.
Additional information