notify-webhook is a git post-receive hook script that posts JSON data to a webhook capable server.
This implements the GitHub Web hooks API as closely as possible. It allows arbitrary git repositories to use webhook capable services.
As an example, this script works very well with commitbot which sends commit notifications to XMPP group chat rooms.
- simplejson
easy_install simplejson || sudo easy_install simplejson
To use notify-webhook, just copy notify-webhook.py
to your
repository's .git/hooks
dir and call it post-receive
. Be sure to
set it executable with chmod 755 post-receive
as well.
Configuration is handled through git config
. We use sensible defaults
where possible.
Here's an example:
git config meta.url "http://example.com"
git config hooks.webhookurl "http://example.net"
The URL to the webhook consumer - the commit details will be POSTed here.
Defaults to None
which will echo the JSON data instead of sending
it.
Details about the repository owner.
Defaults to the first commit's author's details.
The name of the repository.
Defaults to the repository name as determined by its path.
The URL of your repository browser
Defaults to None
The URL of a commit in your repository browser. %s
is replaced with
the SHA1 hash of the commit.
Defaults to meta.url+'/commit/%s'
or None
Description of the repo.
Defaults to the contents of the "description" file.
Username to use for basic authentication.
Password to use for basic authentication. Note that it is stored in plaintext in git's config file!
This code is copyright (c) 2008 by Jack Moffitt [email protected] and
is available under the GPLv3.
See LICENSE.txt
for details.