GitHub: Document the configuration.

master
Valentin Lorentz 2014-02-28 23:52:21 +01:00
parent 162fa221cc
commit efc784ff88
1 changed files with 14 additions and 5 deletions

View File

@ -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/<owner>/<repo>/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/<owner>/<repo>/settings/hooks ) and click “Add webhook“
and add URL of your bot there. The URL is http://<IP or dynamicdns-service>:<port>/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.<type>` (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']`.