Difference between revisions of "Diagrams/Dev/IRCHooks"

From HaskellWiki
< Diagrams‎ | Dev
Jump to navigation Jump to search
(IRC hook instructions)
 
m (Fix url for second step of setting up IRC hooks)
 
Line 17: Line 17:
 
Of course, you should replace <code>USERNAME</code> with your github username, and <code>REPO</code> 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 <code>id</code> of the IRC configuration record (it will probably be a 7-digit number). Now run
 
Of course, you should replace <code>USERNAME</code> with your github username, and <code>REPO</code> 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 <code>id</code> 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"]}'
+
curl -u USERNAME -H "Accept: application/json" -H "Content-type: application/json" -X PATCH https://api.github.com/repos/diagrams/REPO/hooks/ID -d '{"events":["push", "pull_request", "commit_comment", "pull_request_review_comment", "issues", "issue_comment"]}'
   
 
where <code>ID</code> is replaced by the 7-digit ID you found via the previous <code>curl</code> call. This will enable IRC notifications for all the supported events.
 
where <code>ID</code> is replaced by the 7-digit ID you found via the previous <code>curl</code> call. This will enable IRC notifications for all the supported events.

Latest revision as of 13:42, 17 October 2014

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/repos/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.