GitHub Branch name from which the Pull Request is raised

Sunil Boga picture Sunil Boga · Dec 12, 2017 · Viewed 10.2k times · Source

I'm using Multibranch Pipeline Job in Jenkins.

How do I find the branch name from which the Pull Request is raised in GitHub?

I'm using /github-webhook/ & also tried with /ghprbhook/ and tried with the following environment variables: GIT_LOCAL_BRANCH, GIT_BRANCH, ghprbSourceBranch, but I didn't get any result.

If there are any suggestions, I would love to try them.

Answer

jayas picture jayas · Mar 16, 2019

CHANGE_BRANCH gives the correct name of the source branch of the PR.

CHANGE_TARGET gives the target name of the PR merge