Thanks for the quick response and the links.
I have successfully configured a pull request gate build project as code in TeamCity, but that was not the issue. The issue that i am trying to solve now is that gate build updates (changes to .teamcity stuff, that could be part of any PR) are not tested as part of the gate build (corresponding Kotlin code is taken from the master and not from the actual PR branch). I know that this is kind of a chicken egg problem, but i hoped it should be solvable somehow (a PR gate build should be based on the corresponding branch). The thing is that the gate related Kotlin code is taken from the master branch (maybe a configuration issue, but i do not know how to configure it otherwise). The gate is run, and if it succeeds, and the branch is then merged with the master, the following build could break (because the gate program changed with the previous commit, and the change was not tested). Any thoughts on that?