Merge request on master branch has to trigger the build
We have the build configuration which has to trigger when the pull request has been merged on master branch. I will attach the pictures of VCS trigger and branch specification to this message. This has been configured by the employer who left the organization recently.
From the configuration, refer the pictures, what I have understood is the build will trigger when ever the pull request has been created (/ref/pull/*/head) which included the changes in project folder including the sub directories (VSC - trigger "+:%teamcity.ProjectName%/**" ) . Instead, the configuration has been triggered the build whenever the PR has been merged, which is our requirement but the JETBRAIN document clearly mentioned the following statement
"+:refs/pull/*/head
So to recap, adding merge builds the result of the merge, and adding head, just the pull request without the merge."
Can you please educate me why the existing configuration triggered the build when PR merged?


Please sign in to leave a comment.
Hi,
the branch specification in the VCS Root configuration determines which changes are going to be tracked by teamcity. Changes are tracked and listed, *but* no builds are triggered unless a VCS Trigger is set up.
On your VCS Trigger, you have set up a Branch filter that only triggers builds on the default branch, which means only commits on "master" will be triggered. If you want to trigger on all branches, including when a PR is created, then simply remove the branch filter, or add the same branches that you have in the spec (+:refs/pull/*/head). More information on the branch filter here: https://confluence.jetbrains.com/display/TCD10/Configuring+VCS+Triggers#ConfiguringVCSTriggers-BranchFilterbranchFilter
Also, you have a filter for files, so only changes in files that are located in the %teamcity.projectName% directory will trigger a build. I assume that this is intentional, but wanted to point it out just in case.