Pull Requests
A build feature that introduces GitHub pull requests integration
Example. Enables watching for JetBrains Space merge requests. The target branch filter applies patterns similar to branch specifications to target branches limiting which merge requests are watched.
buildType {
// Other Build Type settings ...
features {
// Other Build Features ...
pullRequests {
vcsRootExtId = "${<VCS root object>.id}" // optional, if omitted uses the first attached git VCS root
provider = jetbrainsSpace {
authType = connection {
connectionId = "<JetBrains Space connection id>"
}
filterTargetBranch = "<target branch filter>" // optional
}
}
Content copied to clipboard }
}
Example. Enables watching for GitHub.com and GitHub Enterprise pull requests. The source and target branch filters apply patterns similar to branch specifications to source and target branches respectively limiting which pull requests are watched. The author role filter filters pull requests by the role of the author in respect to the GitHub organisation where the repository is hosted. The ignoreDrafts
setting enables optionally ignoring pull requests marked as draft. It is not recommended to store secure values directly in the DSL code, see Managing Tokens section of our documentation.
buildType {
// Other Build Type settings ...
features {
// Other Build Features ...
pullRequests {
vcsRootExtId = "${<VCS root object>.id}" // optional, if omitted uses the first attached git VCS root
provider = github {
serverUrl = "<GitHub server URL>" // optional, if omitted will be guessed by the VCS root fetch URL
authType = token { // authType = vcsRoot() to take credentials from the VCS root
token = "credentialsJSON:*****"
}
filterSourceBranch = "<source branch filter>" // optional
filterTargetBranch = "<target branch filter>" // optional
filterAuthorRole = PullRequests.GitHubRoleFilter.MEMBER // optional
ignoreDrafts = false // optional
}
}
Content copied to clipboard }
}
Example. Enables watching for GitHub.com and GitHub Enterprise pull requests. Uses the credentials of the VCS root.
buildType {
// Other Build Type settings ...
features {
// Other Build Features ...
pullRequests {
vcsRootExtId = "${<VCS root object>.id}" // optional, if omitted uses the first attached git VCS root
provider = github {
serverUrl = "<GitHub server URL>" // optional, if omitted will be guessed by the VCS root fetch URL
authType = vcsRoot()
filterSourceBranch = "<source branch filter>" // optional
filterTargetBranch = "<target branch filter>" // optional
filterAuthorRole = PullRequests.GitHubRoleFilter.MEMBER // optional
ignoreDrafts = false // optional
}
}
Content copied to clipboard }
}
Example. Enables watching for GitHub.com and GitHub Enterprise pull requests. Uses a GitHub App installation token stored in TeamCity.
buildType {
// Other Build Type settings ...
features {
// Other Build Features ...
pullRequests {
vcsRootExtId = "${<VCS root object>.id}" // A VCS root must be specified to use this authentication type
provider = github {
serverUrl = "<GitHub server URL>" // optional, if omitted will be guessed by the VCS root fetch URL
authType = storedToken {
tokenId = "tc_token_id:*****"
}
filterSourceBranch = "<source branch filter>" // optional
filterTargetBranch = "<target branch filter>" // optional
filterAuthorRole = PullRequests.GitHubRoleFilter.MEMBER // optional
ignoreDrafts = false // optional
}
}
Content copied to clipboard }
}
Example. Enables watching for GitLab.com or GitLab CE/EE merge requests. The source and target branch filters apply patterns similar to branch specifications to source and target branches respectively limiting which merge requests are watched. It is not recommended to store secure values directly in the DSL code, see Managing Tokens section of our documentation.
buildType {
// Other Build Type settings ...
features {
// Other Build Features ...
pullRequests {
vcsRootExtId = "${<VCS root object>.id}" // optional, if omitted selects the first attached git VCS root as a source of merge requests
provider = gitlab {
serverUrl = "<GitLab server URL>" // optional, if omitted will be guessed by the VCS root fetch URL
authType = token { // authType = vcsRoot() to take credentials from the VCS root
token = "credentialsJSON:*****"
}
filterSourceBranch = "<source branch filter>" // optional
filterTargetBranch = "<target branch filter>" // optional
ignoreDrafts = true // optional
}
}
Content copied to clipboard }
}
Example. Enables watching for GitLab.com or GitLab CE/EE merge requests. Instead of personal token authentication a refreshable access token stored in TeamCity is used.
buildType {
// Other Build Type settings ...
features {
// Other Build Features ...
pullRequests {
vcsRootExtId = "${<VCS root object>.id}" // optional, if omitted selects the first attached git VCS root as a source of merge requests
provider = gitlab {
serverUrl = "<GitLab server URL>" // optional, if omitted will be guessed by the VCS root fetch URL
authType = storedToken { // authType = vcsRoot() to take credentials from the VCS root
tokenId = "tc_token_id:*****"
}
filterSourceBranch = "<source branch filter>" // optional
filterTargetBranch = "<target branch filter>" // optional
}
}
Content copied to clipboard }
}
Example. Enables watching for Bitbucket Cloud pull requests. The target branch filters applies patterns similar to branch specifications to target branches limiting which pull requests are watched. It is not recommended to store secure values directly in the DSL code, see Managing Tokens section of our documentation.
buildType {
// Other Build Type settings ...
features {
// Other Build Features ...
pullRequests {
vcsRootExtId = "${<VCS root object>.id}" // optional, if omitted uses the first attached git VCS root
provider = bitbucketCloud {
authType = password { // authType = vcsRoot() to take credentials from the VCS root
username = "<username>"
password = "credentialsJSON:*****"
}
filterTargetBranch = "<target branch filter>" // optional
}
}
Content copied to clipboard }
}
Example. Enables watching for Bitbucket Cloud pull requests. You can also use Repository/Project/Workspace access token authentication.
buildType {
// Other Build Type settings ...
features {
// Other Build Features ...
pullRequests {
vcsRootExtId = "${<VCS root object>.id}" // optional, if omitted uses the first attached git VCS root
provider = bitbucketCloud {
authType = token {
token = "credentialsJSON:*****"
}
filterTargetBranch = "<target branch filter>" // optional
}
}
Content copied to clipboard }
}
Example. Enables watching for Bitbucket Cloud pull requests. Instead of permanent token authentication a refreshable access token stored in TeamCity is used.
buildType {
// Other Build Type settings ...
features {
// Other Build Features ...
pullRequests {
vcsRootExtId = "${<VCS root object>.id}" // optional, if omitted uses the first attached git VCS root
provider = bitbucketCloud {
authType = storedToken {
tokenId = "tc_token_id:*****"
}
filterTargetBranch = "<target branch filter>" // optional
}
}
Content copied to clipboard }
}
Example. Enables watching for Bitbucket Server / Data Center pull requests. The source and target branch filters apply patterns similar to branch specifications to source and target branches respectively limiting which pull requests are watched. If usePullRequestBranches is set to true it makes the build feature watch pull-request specific numerical branches officially unsupported by Bitbucket Server. By default the build feature watches source branches in Bitbucket Server / Data Center. It is not recommended to store secure values directly in the DSL code, see Managing Tokens section of our documentation.
buildType {
// Other Build Type settings ...
features {
// Other Build Features ...
pullRequests {
vcsRootExtId = "${<VCS root object>.id}" // optional, if omitted uses the first attached git VCS root
provider = bitbucketServer {
serverUrl = "<Bitbucket Server / Data Center URL>" // optional, if omitted, the URL will be composed based on the VCS root fetch URL.
authType = token { // authType = vcsRoot() to take credentials from the VCS root, or authType = password { ... } to use username and password
token = "credentialsJSON:*****"
}
filterSourceBranch = "<source branch filter>" // optional
filterTargetBranch = "<target branch filter>" // optional
usePullRequestBranches = true // optional
}
}
Content copied to clipboard }
}
Example. Enables watching for Bitbucket Server / Data Center pull requests. Instead of permanent token authentication a refreshable access token stored in TeamCity is used.
buildType {
// Other Build Type settings ...
features {
// Other Build Features ...
pullRequests {
provider = bitbucketServer {
authType = storedToken {
tokenId = "tc_token_id:*****"
}
}
}
Content copied to clipboard }
}
Example. Enables watching for Azure DevOps pull requests. The source and target branch filters apply patterns similar to branch specifications to source and target branches respectively limiting which pull requests are watched. It is not recommended to store secure values directly in the DSL code, see Managing Tokens section of our documentation.
buildType {
// Other Build Type settings ...
features {
// Other Build Features ...
pullRequests {
vcsRootExtId = "${<VCS root object>.id}" // optional, if omitted uses the first attached git VCS root
provider = azureDevOps {
projectUrl = "<Azure DevOps project URL>"
authType = token {
token = "credentialsJSON:*****"
}
filterSourceBranch = "<source branch filter>" // optional
filterTargetBranch = "<target branch filter>" // optional
}
}
Content copied to clipboard }
}
Example. Enables watching for Azure DevOps pull requests. Uses Azure DevOps OAuth 2.0 token stored in TeamCity.
buildType {
// Other Build Type settings ...
features {
// Other Build Features ...
pullRequests {
vcsRootExtId = "${<VCS root object>.id}" // optional, if omitted uses the first attached git VCS root
provider = azureDevOps {
projectUrl = "<Azure DevOps project URL>"
authType = storedToken {
tokenId = "tc_token_id:*****"
}
filterSourceBranch = "<source branch filter>" // optional
filterTargetBranch = "<target branch filter>" // optional
}
}
Content copied to clipboard }
}
See also
Types
Properties
Functions
Azure DevOps Services/Server
Bitbucket Cloud
Bitbucket Server / Data Center
Copies parameters of this object to the specified target
Creates an instance of this build feature via reflection using a no argument constructor, used during copying. Throws an error if this class doesn't have a default constructor. Subclasses can override it to create an instance without using a default constructor.
GitHub or GitHub Enterprise
GitLab.com or GitLab CE/EE
JetBrains Space
Validates this object and reports found errors to the provided consumer