Skip to content

Instantly share code, notes, and snippets.

@michaelneale
Forked from bjhess/pull_request_webhook.md
Last active December 14, 2015 04:29
Show Gist options
  • Star 2 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save michaelneale/5028616 to your computer and use it in GitHub Desktop.
Save michaelneale/5028616 to your computer and use it in GitHub Desktop.

This is more complex than necessary probably.

There appears to be no way in the web UI to set up webhooks for other events. And so we go to the API.

{
  "name": "web",
  "active": true,
  "events": ["pull_request"],
  "config": {
    "url": "https://playground.ci.cloudbees.com/github-pull-request-hook/"
  }
}

eg:

curl -u username:password -X POST -d @pullhooks https://api.github.com/repos/:user/:repo/hooks 

where the JSON above is stored in a file called "pullhooks"

  • GET to https://api.github.com/repos/:username/:repo/hooks to check if the webhook you created has the proper event applied.
  • You will see the URL in the admin section of your repo, and you can change it. There will be no mention of what events the URL fires on, but it should stick to pull_request.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment