Run CI build on pull request merge in TeamCity

JonSquared picture JonSquared · Aug 12, 2014 · Viewed 8.2k times · Source

I have a CI build that is setup in TeamCity that will trigger when a pull request is made in BitBucket (git). It currently builds against the source branch of the pull request but it would be more meaningful if it could build the merged pull request.

My research has left me with the following possible solutions:

  1. Script run as part of build - rather not do it this way if possible
  2. Server/agent plugin - not found enough documentation to figure out if this is possible

Has anyone done this before in TeamCity or have suggestions on how I can achieve it?

Update: (based on John Hoerr answer)

Alternate solution - forget about TeamCity doing the merge, use BitBucket web hooks to create a merged branch like github does and follow John Hoerr's answer.

Answer

John Hoerr picture John Hoerr · Aug 12, 2014

Add a Branch Specification refs/pull-requests/*/merge to the project's VCS Root. This will cause TeamCity to monitor merged output of pull requests for the default branch.