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?
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.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With