Published: Feb 28, 2019 by Isaac Johnson
We have now created a PR but there are some features we can explore that make it even more automated.
Auto-complete is a great feature that lets me, as the author, say “when all conditions are met, then just complete (merge) and be done”. This lets me automate the post-approval activities and is fantastic when you have teams spread over the globe in different time zones.
We now see when my review user completes the review, it will get auto-merged.
Approve versus Complete:
For those not as familiar with AzDO, this creates some confusion. “Approve” is the verb that indicates I have reviewed the changes and approve their eventual merging into the destination (repo/branch). However, nothing, by default, will happen when i approve (auto-complete not withstanding). Which means when all conditions are met as set by the branch policy, someone will need to actually “Complete” the PR which:
- Merges the code
- Moves the PR status to Completed.
If the branch policies allow for it, after completing, someone will also need to delete the source branch.
Auto-Complete (example):
I, as an approver, log in and choose to Approve the change:
Almost immediately the branch has merged and the state has changed:
Because we set autocomplete with delete branch, the branch was deleted as well
Why we delete branches:
- The full history (unless you choose squash) is brought into the destination branch, so nothing is lost
- The PR as a completed item remains showing details about the approval process
- We can un-delete a branch: Search for the exact name and choose to search deleted branches. Then choose the elipse menu to restore
Problems with leaving branches that have already merged
- creates the opportunity for unmerged changes to propagate - that is, it is easy to keep pushing changes after the branch was merged - wheras if you delete, you’ll be notified that the branch doesn’t exist anymore
- Creates a messy list of active branches that becomes hard to navigate and later requires validation that all were handled.