From efc784ff887281d5f002237390cf766b11eba2a6 Mon Sep 17 00:00:00 2001 From: Valentin Lorentz Date: Fri, 28 Feb 2014 23:52:21 +0100 Subject: [PATCH] GitHub: Document the configuration. --- GitHub/README.txt | 19 ++++++++++++++----- 1 file changed, 14 insertions(+), 5 deletions(-) diff --git a/GitHub/README.txt b/GitHub/README.txt index 5aa3a4d..c0aa18e 100644 --- a/GitHub/README.txt +++ b/GitHub/README.txt @@ -1,4 +1,4 @@ -This plugin announces pushes and (commits) to GitHub repositories to IRC. +This plugin announces events GitHub repositories to IRC. To use this plugin you must forward/open the port which is specified by the configuration variable "supybot.servers.http.port" (8080 is the default value). @@ -8,9 +8,18 @@ and repo what git repository the bot should announce. When you want to remove an Please note that the names are case-sensitive. If you use mis-spelled repository names, the bot will not announce commits to that repository. -To get the bot notified about commits, you must tell GitHub to post to your bot. (GitHub explanation: http://help.github.com/post-receive-hooks/ ) -In order to do that, you must go admin page of repo, tab service hooks (direct link: https://github.com///admin/hooks ) and select "Post-Receive URLs". Choose it +To get the bot notified about events, you must tell GitHub to post to your bot. (GitHub explanation: http://help.github.com/post-receive-hooks/ ) +In order to do that, you must go admin page of repo, tab webhooks (direct link: https://github.com///settings/hooks ) and click “Add webhook“ and add URL of your bot there. The URL is http://:/github . +Fill the other fields of the form according to what you want. -Now your bot should announce all commits. To test this go back to "Post-Reveive URLs" and press "Test Hook". -This causes your bot to announce the last three commits. If the bot doesn't see them, check what you ordered it to announce and is that correct URL correct in "Post-Receive URLs" and is the port opened/forwarded. +Now your bot should announce all push events. +To announce other events type, you have to set config variables `supybot.plugins.GitHub.format.` (where `type` is a type referenced at http://developer.github.com/webhooks/#events to a template. +A template is a string, which contains variables. Variable names are prefixed with a $. +Replacements will be made using the data sent by GitHub. As this data contains lists and dictionnaries, it is “flattened”, ie. `data['foo']['bar']['baz']` can be accessed with `$foo__bar__baz` (note the douple underscores). +There are also special variables: +* if $foo is an url, $foo__tiny will be the tinyfied version of the URL +* if $foo is a git ref, $foo__branch will be the matching branch +* if $foo is a string, $foo__firstline will contain the first line of $foo + +Concerning push events, one line is formatted per commit; it is given extra variables: `$__commit__foo` for each `data['commits'][X]['foo']`.