Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Hubot's github-pull-request-notifier.coffee

Tags:

hubot

I recently got a hubot setup for irc and works fine. I'm trying to add this script.

I'm not entirely understanding the setup instructions however. The setup instructions read

curl -H "Authorization: token <your api token>" \
-d '{"name":"web","active":true,"events":["pull_request"],"config":{"url":"<this script url>","content_type":"json"}}' \
https://api.github.com/repos/<your user>/<your repo>/hooks

I don't understand what the "url":"<this script url>" refers to. Anyone know?

I'm deploying to heroku if that helps.

like image 810
Blaine Kasten Avatar asked Aug 19 '13 16:08

Blaine Kasten


1 Answers

Add more explanation for @MikeKusold 's answer

The curl command is to create the github hook, therefore it is set hook to the receiver for the notification.

"config": {
  "url": "http://example.com/webhook",
  "content_type": "json"
}

The hook is the hubot plugin, so the url path is defined in that script, see line

robot.router.post "/hubot/gh-pull-requests", (req, res) ->

Below two lines in that scripts tell you what is after the path, it has parameters room & type

user.room = query.room if query.room
user.type = query.type if query.type

Hubot itself define the port number, it route the path to the plugin as it requested, check this part in robot.coffee, the default port is 8080

Therefore the URL is like below

http://<your hubot sever>:8080/hubot/gh-pull-requests/?room=<room>&type=<type>

Actually you can use curl command to test it towards hubot directly first.

like image 189
Larry Cai Avatar answered Oct 04 '22 20:10

Larry Cai