Supybot-plugins/GitHub
Valentin Lorentz 63d86909f8 GitHub: Fix announces. 2014-03-26 07:06:15 +00:00
..
local GitHub: first commit (has only @repo search) 2011-02-20 20:02:59 +01:00
README.txt GitHub: Document the configuration. 2014-02-28 23:52:21 +01:00
__init__.py All plugins: Add Python 3 support. 2013-03-25 19:12:08 +01:00
config.py GitHub: enhance formatting. 2014-03-16 22:15:45 +00:00
plugin.py GitHub: Fix announces. 2014-03-26 07:06:15 +00:00
test.py GitHub: Add announce feature 2011-02-27 09:31:54 +01:00

README.txt

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).

To add announces use the command "github announce add <owner> <repo>" Owner means owner of the repository (GitHub username.)
and repo what git repository the bot should announce. When you want to remove announce, use the command "github announce remove <owner> <repo>".

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 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 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']`.