Azure DevOps auto-complete: required vs optional policies, and why it does not complete
Set auto-complete completes a pull request by itself once its branch policies are met, with the merge type and options you chose. Which policies it waits for depends on how it was set: the web portal waits on the required ones, while the command line and the REST API can end up waiting on the optional ones too. Below is how it works, from Microsoft's Set a pull request to autocomplete and the REST reference for Pull Requests - Update.
Setting it in the web portal
- Choose Set auto-complete from the Complete dropdown, then the merge type and the post-completion options (complete linked work items, delete the source branch, a custom merge commit message), as for a normal completion.
- By default it waits only on required policies. In the Enable automatic completion panel you can choose to wait on optional policies as well; on the Overview page a policy you made required there can be set back to optional.
- The Overview page lists the policy criteria the pull request is still waiting for (TFS 2018 Update 2 and later), and the list of pull requests shows an Auto-complete badge. Cancel auto-complete turns it off.
- You get an email when the pull request is completed, or when a conflict or error keeps it from completing.
Why auto-complete does not complete
- A required policy has not passed. A reviewer has not approved, a build failed or expired, comments are not resolved, a linked work item is missing. The Overview page names what it is waiting for.
- It waits on an optional policy too. If someone chose to wait on an optional policy, or it was set from the command line or the API (below), an optional build that failed blocks it as well.
- There is a merge conflict. Conflicts have to be resolved before a pull request can be merged or set to auto-complete (resolving merge conflicts).
- New commits reset the approvals. Setting auto-complete names no commit, so commits pushed before it completes are completed too. A Minimum number of reviewers policy set to reset votes when new changes are pushed makes the reviewers approve again first.
- There is no Set auto-complete at all. Microsoft notes it shows only when the branch has branch policies; without any, the pull request can simply be completed.
From the command line and the REST API
az repos pr create --auto-complete trueandaz repos pr update --id <id> --auto-complete true. Microsoft's page describes--auto-completeas completing when all policies have passed and the source branch can be merged into the target, and none of the completion options skips optional policies. The Azure DevOps CLI is not supported for Azure DevOps Server.- In the REST API, auto-complete is on when
autoCompleteSetByis set to the identity that turned it on, with the merge type and options incompletionOptions. completionOptions.autoCompleteIgnoreConfigIdsis the list of policy configuration ids auto-complete should not wait for. It applies only to optional policies (isBlockingfalse); required ones are always waited for. A request that leaves it empty therefore does not get the web portal's default of required policies only. To match it, put the ids of the pull request's optional policies there; they are in the configurations of its policy evaluations.
Auto-complete in IntelliJ IDEA
Azure DevOps Pull Requests, a plugin by Lesstep for JetBrains IDEs 2024.1 or later and Android Studio, lists the pull requests of Azure DevOps Services and Azure DevOps Server in an IDE tool window with their branch policies. Its Complete dialog can set auto-complete with your merge type and branch deletion, refuses it if the source branch got new commits after you opened the pull request, and, from version 1.0.54, waits on the required policies only, as the web portal does. Auto-complete can be cancelled from the pull request. The review inbox and the branch policies are free; voting, commenting, completing and creating pull requests are Pro, with a 30-day trial.
Get it on JetBrains Marketplace
Azure DevOps is a trademark of Microsoft Corporation; IntelliJ IDEA is a trademark of JetBrains s.r.o. This page is not affiliated with or endorsed by Microsoft or JetBrains.
More: az repos pr commands · build validation and expired builds · completing the linked work items · comment status and the comment resolution policy · merge types and Limit merge types · required reviewers and path filters · why an approval does not count · explicit override to bypass policies · 日本語