Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

VSTS run build on Pull Request branch

Tags:

azure-devops

Is there a way to have VSTS run a build of the PR branch?

I know you can set up VSTS' policies to trigger a build when there is a pull request but this is useless if you cant specify that the branch the PR is being made from should be the one that would need to be built. (I don't want master to build for example, I want my new code to build).

I know you could set up another "dev" branch where you could run these test but that is not desired.

Thanks!

like image 785
Chéyo Avatar asked Feb 20 '26 09:02

Chéyo


1 Answers

You misunderstand how branch policies work with regard to build definitions. A build definition specifies a default branch (e.g. the branch that is built if you queue the build manually), and can contain CI triggers on any number of branches.

When you link a build definition to a branch policy and open up a PR, the build definition is run for the PR branch. The default branch is overridden. You can easily validate this yourself by setting up a branch policy with a default branch that builds successfully, then opening a PR containing changes that cause the build to fail.

like image 63
Daniel Mann Avatar answered Feb 22 '26 02:02

Daniel Mann



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!