Reputation: 85
so I have a jenkinsfile
where I have my pipeline. I would like to be able to distinguish between a pull request which is going to the master and pull requests going elsewhere. I have found example code for detecting pull requests - something like this:
env.BRANCH_NAME.startsWith('PR-')
But is there any way to find out the target of the pull request from some env.
variable?
Upvotes: 8
Views: 5587
Reputation: 6513
As per https://yourjenkinsurl/pipeline-syntax/globals
:
CHANGE_TARGET
For a multibranch project corresponding to some kind of change request, this will be set to the target or base branch to which the change could be merged, if supported; else unset.
Upvotes: 5