7

I am using Jenkins GitHub pull request builder plugin for running my unit tests when a pull request is made vis a vis a web hook. For the build step, I need to know the name of the branch that is being merged in (e.g. I need develop branch if merging that into master branch). Is there a way to get access to this in the Jenkins execute shell? Thanks,

Naman
  • 27,789
  • 26
  • 218
  • 353
i_trope
  • 1,554
  • 2
  • 22
  • 42

2 Answers2

8

Your link has the answer:

The plugin makes some very useful environment variables available.

  1. ghprbActualCommit

  2. ghprbActualCommitAuthor

  3. ghprbActualCommitAuthorEmail

  4. ghprbPullDescription

  5. ghprbPullId

  6. ghprbPullLink

  7. ghprbPullTitle

  8. ghprbSourceBranch

  9. ghprbTargetBranch

  10. sha1

You'll want to use $ghprbSourceBranch to get the value of the branch being built somewhere else in your script.

Community
  • 1
  • 1
acanby
  • 2,936
  • 24
  • 26
0

In the "Branch Specifier", enter ${sha1}.

Danijel
  • 8,198
  • 18
  • 69
  • 133