A teamcity plugin to get extra information of the GitHub pull request being built. Such as the
- Branch name, and it will also be displayed as part of the TeamCity build number label
- Base branch name
- Author, assignee, participants who commented on the pull request
- Pull request URL
- Labels
Copy the plugin to teamcity's plugins folder and restart the server
Add a build step with run type of PullRequest Extra Info
to your build configuration
-
Token
See GitHub's help page for how to create a personal access token -
GitHub Account
(highly not recommended) Just the username and password -
System Wide Token
This is also the personal access token. But instead of adding it in a specific build configuration, you can definesystem.prextras.github_token
parameter that can be shared with other build conifgurations
Tick the Append branch name to build num label
to display the branch name as part of the TeamCity build number label instead of the pull request number
Tick the Fail the build if the pull request has conflicts
to stop building a pull request that has conflicts.
it will output the follow parameters
teamcity.build.pull_req.branch_name
: the branch name of the pull request or branch being builtteamcity.build.pull_req.base_branch_name
: the base branch name of the pull request or branch being builtteamcity.build.pull_req.is_pull_req
: true if building a pull request, false otherwiseteamcity.build.pull_req.number
: the pull request number if it's a pull requestteamcity.build.pull_req.author_email
: the pull request author's emailteamcity.build.pull_req.author
: the authorteamcity.build.pull_req.url
: the pull request url, e.g. https://github.com/owner/repo/pull/123teamcity.build.pull_req.assignee
: the assigneeteamcity.build.pull_req.assignee_email
:assignee's emailteamcity.build.pull_req.participants
: paritcipants separated by;
who commented on the pull request (nothing to do with commits)teamcity.build.pull_req.is_merged
: indicate if the pull request has been merged or notteamcity.build.pull_req.is_closed
: indicate if the pull request has been closed or notteamcity.build.pull_req.labels
: labels of the pull request separated by;
For github enterprise, you will need to define a system property;therefore this plugin can know where is the API server.
The property name is system.prextras.github_api_url
and the value should be the API URL of your GitHub Enterprise server, for example: https://<githubserver.com>/api/v3
.
By default the plugin will use https
, if your server doesn't have https
support, then you need to explicitly prefix the URL with http
.
When using this plugin with Hedwig and User Mapping, you will be able to send Slack/HipChat notification of the build failures to the pull request author, assignee, participants and the guy who triggerred the build.