Hello,
We would like to clarify whether the “Auto-cancel redundant workflows” feature can be extended to branches other than the default branch.
Based on the current behavior and documentation:
“With the exception of your default branch, we will automatically cancel any outstanding workflows on a branch when a newer pipeline is triggered on that branch.”
Our understanding is that only the default branch is excluded from auto-canceling previous workflows, while all other branches have their running workflows canceled when a new pipeline is triggered.
Use case:
We maintain multiple long-lived branches (e.g., 4.0, 5.0, 6.0) and would like these branches to behave like the default branch—meaning workflows should not be auto-canceled on these branches, while the feature remains active for all others.
We are aware that the default branch is defined via the vcs_info field, for example:
https://circleci.com/api/v2/project/github/<mycompany>/<myproject>
{
...
"vcs_info": {
"default_branch": "4.0"
}
...
}
Additionally, we came across a workaround in the CircleCI community forum that suggests disabling the feature entirely and implementing a custom/scripted mechanism to cancel previous workflows manually:
https://discuss.circleci.com/t/workaround-auto-cancel-redundant-builds-on-the-default-branch/39468
However, given the number of workflows we maintain, this approach would be quite cumbersome and difficult to scale.
We also attempted to use pr_only_branch_overrides to define specific branches:
GET https://circleci.com/api/v2/project/github/<mycompany>/<myproject>/settings
{
"advanced": {
"autocancel_builds": true,
"build_prs_only": true,
"pr_only_branch_overrides": [
"4.0",
"5.0",
"6.0"
]
}
}
However, this configuration does not appear to have any effect on the auto-cancel behavior.
Questions:
-
Is it possible to configure multiple branches to behave like the default branch for this feature?
-
If not, is there any workaround or alternative approach to selectively disable auto-cancel for specific branches?
Thank you for your support.
Best regards,
João