Building GitHub pull requests with TeamCity is a real nice feature ; and encourages to add many PR checks, like the SonarQube Pull Request Analysis.
Managing parameters for master / branch / PR builds could be a little tricky, and TeamCity offers many ways (Meta Runner, the official JetBrains SonarQube TeamCity plugin in the future: #69) to simplify that by auto-managing these parameters (e.g.: in sysenv) from TeamCity build parameters.
This kind of third-party integration could requires the original branch from which pull request is built (Here the 'sonar.pullrequest.branch' mandatory parameter for SonarQube analysis).
This information is displayed in TeamCity UI when you enable PR integration:
But this information (i.e.: 'refs/heads/branch-alix' here) can not be found in TeamCity (displayed) build parameters.
The TeamCity parameters 'teamcity.build.branch' contains the pull-request key (e.g.: 'pull/42') in this case (and used for SonarQube parameter 'sonar.pullrequest.key').
Is there a way to retrieve this information ? (perhaps in a hidden TeamCity parameter ?)