How to stop TeamCity from building all but the latest open pull requests


I'm new in TC and recently my organization enabled new builds on pull requests, however the problem is that now TC is attempting to build all, past and present pull requests, we would prefer to only build the recent and open / valid PR, the “Branch Specification” field we are using is:


And the triagger rule is as follows:


Not sure if TC supports such mechanism or if the rules we're using are enforcing this behavior.


Kind Regards,

1 comment
Comment actions Permalink


I suppose being new to TeamCity you are using the latest version of it, i.e. 2019.1.+
Also judging by the branch spec I suppose you are using GitHub hosted repository.

Since recently TeamCity provides a handy Pull Requests build feature that can be used instead the branch specs. Please check our online documentation:

Among other things (like filtering by target branch, status and author's role, as well as showing pull request information on the build page) the build feature avoids triggering builds on old pull requests unless new commits are made into them. 

Please note that you have to remove the branch spec from the VCS root if you decide to use the build feature, as the build feature provides these branch specs internally for TeamCity changes collection.

Please try it and let us know if it helps.

That aside, the trigger rule looks rather peculiar. All it does is instructs TeamCity to do not trigger builds on any pending commits if the only thing that has changed in them is the content of the folder "accept". It has nothing to do with filtering pull requests. If you don't have any specific reason why this rule is there, I would remove it. 



Please sign in to leave a comment.