CoffeeScript JavaScript
Switch branches/tags
Nothing to show
View #2
#2 Compare This branch is 5 commits behind sinatra.
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Failed to load latest commit information.

Things you'll need

We'll pretend the following:

  • You have a Jenkins install at
  • You have a GitHub organization called MyCompany
  • You have a GitHub account called MyCompany-bot
  • You have a repo you'd like pull requests on called FooBar

Initial setup

Clone the repo locally

git clone
cd jenkins-comments 

Create a Heroku application

First we'll need a Heroku app running their Cedar stack, and a Redis server. We'll also set the url of our Jenkins server. Chose a name (we'll use "mycompany-jenkins-comments" for the example), and create it:

heroku create mycompany-jenkins-comments --stack cedar
git push heroku master

heroku addons:add redistogo:nano

heroku config:add JENKINS_URL=
heroku config:add NODE_ENV=production

heroku ps:dynos 1

Setup your app with permissions for GitHub

Create a new Authorization using the GitHub Authorizations API:

curl -u "MyCompany-bot:password" \
  -H "Content-Type: application/json" \
  -X POST \
  -d '{"scopes":["repo"],"note": ""}'
  "scopes": [
  "updated_at": "2012-05-21T16:33:05Z",
  "note_url": null,
  "app": {
    "url": "",
    "name": " (API)"
  "url": "",
  "token": "a55199221f3f66a7d238be5fa32e2cd84735ffc1",
  "note": "",
  "created_at": "2012-05-21T16:33:05Z",
  "id": 369874

In the reponse is the token the app will use to comment on pull requests. Add that token to Heroku:

heroku config:add GITHUB_USER_TOKEN=a55199221f3f66a7d238be5fa32e2cd84735ffc1

Per repo

Configure Jenkins Job

Under Build > Inject environemnt variables > Properties Content, set BUILD_STATUS to success. This will only be set if the build succeeds:


In Post-build Actions > Post build task > script, we'll add a curl statement to post the job status to

curl "\

Configure GitHub to notify us of an opened pull request

We'll use the GitHub PubSubHubBub API to subscribe to pull requests events:

curl -u "MyCompany-bot:password" \
  -Fhub.mode=subscribe \
  -Fhub.topic= \