Jenkins and Github Pull Requests

Jenkins Logo

One of the things people love about travis-ci is it will build pull requests, but most people don’t realize Jenkins can do pull requests as well. It is also very simple to configure Jenkins to do pull requests using the correct plugin.

Install the Plugin

Install this plugin through the manage Jenkins admin section.

Configure Github User

This is fairly simple. Follow the trail of links then add the relevant information. Make sure you have a user you want to access github with, and they have the appropriate permissions for the repos.

  1. Manage Jenkins
  2. Configure System
  3. Find Github pull requests builder Configuration Section
  4. Fill in the relevant information similar to the image below

System Configuration

Configure Your Git Pull

You need to configure where Jenkins pulls from Github to build pull requests. Specifically Github stores all the pull requests in a “secret” location. It isn’t really secret, but most people don’t explore where refs are stored. So adding the following to the correct refspec is a must. In the advanced tab of the your git configuration add the following:


In the branch specifier section add:


Here is what that section should look like:

Git Configuration

You also need to set Build triggers and add users to the whitelist so people whom submit pull requests can have their pull requests automatically build. If you don’t add people to the white list you will need to tell Jenkins to build the PR.

Build Triggers

Your Done

If everything was configured correctly. Your pull requests will look like this at the bottom of the PR:

Successful Build


Pull requests create an awesome workflow, and really help teams collaborate on a lot of different parts of code. The real problem has been, for a while, that the Pull Requests are outside the main refspec and will not build on a push. So with the pull request builder plugin it targets the location the PRs are at. The best part is it tells you the build status of the build inside the PR, similar to Travis-ci. If you aren’t using Jenkins or Github PR’s I recommend starting.

Related Posts:


  1. says

    Hey Buddy,

    Great article, I am trying to use your tutorial to get Jenkins to build my pull requests. My only problem is I am not getting any notification on GitHub saying that the builds are successful or failing. Did you have to install another plugin to get the message you show above on GitHub?

  2. shir avr says

    Hey Spencer,

    well No, make sure that the github’s user you connect to jenkins has a administrator permission on the repository.

Leave a Reply

Your email address will not be published. Required fields are marked *

You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <s> <strike> <strong>