PullRequests

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
}
}







}
}




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
}
}











}
}




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
}
}









}
}




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
}
}











}
}




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
}
}










}
}




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
}
}









}
}




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
}
}








}
}




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
}
}







}
}




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
}
}







}
}




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
}
}










}
}




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:*****"
}
}
}





}
}




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
}
}









}
}




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
}
}









}
}




See also

Constructors

Link copied to clipboard
constructor(init: PullRequests.() -> Unit)
constructor()

Types

Link copied to clipboard

Pull request contributor role filter options

Link copied to clipboard

Properties

Link copied to clipboard

Specifies whether the feature is enabled, true by default

Link copied to clipboard
var id: String?

Build feature id, if not specified will be generated

Link copied to clipboard
Link copied to clipboard
var provider: <Error class: unknown class>
Link copied to clipboard

Build feature type

Link copied to clipboard
var vcsRootExtId: <Error class: unknown class>

Id of the VCS root to extract pull request information from. Set to an empty string to extract pull request information from the first VCS root attached to a build configuration.

Functions

Link copied to clipboard

Azure DevOps Services/Server

Link copied to clipboard
Link copied to clipboard
fun booleanParameter(customName: String? = null, trueValue: String? = "true", falseValue: String? = "false"): <Error class: unknown class><Parametrized, <Error class: unknown class><Parametrized, T?>>
Link copied to clipboard
fun clear()
Link copied to clipboard
fun <T : CompoundParam<T>> compoundParameter(customName: String? = null): <Error class: unknown class><Parametrized, <Error class: unknown class><Parametrized, T?>>
Link copied to clipboard
fun <T : Parametrized> copyParamsTo(target: T): T

Copies parameters of this object to the specified target

Link copied to clipboard
open fun create(): BuildFeature

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.

Link copied to clipboard
fun doubleParameter(customName: String? = null): <Error class: unknown class><Parametrized, <Error class: unknown class><Parametrized, T?>>
Link copied to clipboard
fun <E : Enum<E>> enumParameter(customName: String? = null, mapping: Map<E, String?>? = null): <Error class: unknown class><Parametrized, <Error class: unknown class><Parametrized, T?>>
Link copied to clipboard
fun findRawParam(paramName: String): Parameter?
Link copied to clipboard

GitHub or GitHub Enterprise

Link copied to clipboard

GitLab.com or GitLab CE/EE

Link copied to clipboard
fun hasParam(paramName: String): Boolean
Link copied to clipboard
fun intParameter(customName: String? = null): <Error class: unknown class><Parametrized, <Error class: unknown class><Parametrized, T?>>
Link copied to clipboard
fun param(name: String, value: String)

Adds parameter with specified name and value

Link copied to clipboard
fun removeRawParam(paramName: String)
Link copied to clipboard
open fun stringParameter(customName: String? = null): <Error class: unknown class><Parametrized, <Error class: unknown class><Parametrized, T?>>
Link copied to clipboard
open override fun toString(): String
Link copied to clipboard
open override fun validate(consumer: ErrorConsumer)

Validates this object and reports found errors to the provided consumer