A very simple github post-receive web hook handler that executes per default a pull uppon receiving. The executed action is configurable per repository.
It will also verify that the POST request originated from github.com and has a valid signature (only when the key setting is properly configured).
Edit repos.json to configure repositories, each repository must be registered under the form GITHUB_USER/REPOSITORY_NAME.
{
"razius/puppet": {
"path": "/home/puppet",
"key": "MyVerySecretKey",
"action": [["git", "pull", "origin", "master"], ],
},
"d3non/somerandomexample/branch:live": {
"path": "/home/exampleapp",
"key": "MyVerySecretKey",
"action": [["git", "pull", "origin", "live"],
["echo", "execute", "some", "commands", "..."] ]
}
}Install dependencies.
pip install -r requirements.txtSet environment variable for the repos.json config.
export FLASK_GITHUB_WEBHOOK_REPOS_JSON=/path/to/repos.jsonStart the server.
python index.py 80Start the server behind a proxy (see: http://flask.pocoo.org/docs/deploying/wsgi-standalone/#proxy-setups)
USE_PROXYFIX=true python index.py 8080Go to your repository's settings on github.com and register your public URL under Service Hooks -> WebHook URLs.