Search code examples
tfstfsbuild

Automatically merge approved PR in TFS on successful build


We use git via TFS (on-premises) and have a branch policy that requires the PR merge to build successfully via TFS Build before allowing a PR to be completed.

We also have a branch policy that requires a minimum of 1 reviewer for the changes. Problem is, that various builds take a lot of time (~10min) and code is usually reviewed faster than that. Specially since we trigger new builds for each PR and sometimes people is reviewing a bunch of PRs together.

This causes that even if we have already reviewed and approved a PR, we need to go back to manually complete it later on, after build has completed (which in turn, triggers that all the other affected and possibly already approved PRs will need to be merged/built once more and completed later).

Just in case we're missing something, is there an easy way that comes to mind to setup an auto-merge of already approved PRs if they build successfully? Or well, any other improvements to this setup are also welcomed.


Solution

  • Auto-completion of Pull Requests is a feature in TFS 2017 and beyond. If you're using TFS 2015, you're long overdue for an upgrade.