Diagrams/Dev/IRCHooks

From HaskellWiki
< Diagrams‎ | Dev
Revision as of 14:11, 7 July 2014 by Byorgey (talk | contribs) (IRC hook instructions)
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to navigation Jump to search
The printable version is no longer supported and may have rendering errors. Please update your browser bookmarks and please use the default browser print function instead.

It's helpful to have repositories in the diagrams organization on github generate notifications in the IRC channel when various events happen (like pushes, new issues, comments, etc.).

Upon creating a new repository in the diagrams organization, navigate to Settings > Webhooks and Services. Select "Add service" and then "IRC". Set the configuration as follows:

  • Server: irc.freenode.net
  • Port: 6667
  • Room: #diagrams
  • Nick: diagramsbot
  • Check "Message without join"
  • Check "Notice"
  • Check "Active" (should be checked by default)

After creating this web hook, notifications will be sent to the IRC channel for pushes and pull requests only. However, it is useful to get notifications for other sorts of events too. Strangely, this is not possible to configure through the github web interface, but can be configured via the JSON API. In particular, using curl, I have found the following to work. First, run

 curl -u USERNAME -H "Accept: application/json" https://api.github.com/repos/diagrams/REPO/hooks

Of course, you should replace USERNAME with your github username, and REPO with the name of the repo. After entering your github password you should get back a JSON response showing the configuration of all the hooks. (If you just set up the repo and added the IRC hook, that will be the only one listed. But there might be more, for example if you have set up a Travis-CI hook.) Find the id of the IRC configuration record (it will probably be a 7-digit number). Now run

 curl -u USERNAME -H "Accept: application/json" -H "Content-type: application/json" -X PATCH https://api.github.com/diagrams/REPO/hooks/ID -d '{"events":["push", "pull_request", "commit_comment", "pull_request_review_comment", "issues", "issue_comment"]}'

where ID is replaced by the 7-digit ID you found via the previous curl call. This will enable IRC notifications for all the supported events.