README.md

mt-github-webhook

Most other solutions that I have found require you to have GIT installed on your server. In a shared hosting environment, that is sometimes not possible. This solution lets you pull changes to any server.

Currently supported event names:

PUSH

Currently provided actions:

Check the X-Hub-Signature header for the secret passphrase

Update your server filesystem with the changes pushed to a specific branch

Filter changes by repository tree path

Output a list of changes, viewable from the GitHub Webhook settings page

How-to

Put something like the code above in a .php file and put it on your web server. Be sure to provide the correct branch names, folder names, GitHub user account name and password.

Go to your GitHub repository's settings page

Click the Add webhook button

Provide the public url for your .php file in the Payload URL field

Pick a SECRET to secure the communication

Click the Add webhook button

Done!

The repository settings page has a Recent deliveries section. If you need to debug the Webhook handler, you can always inspect the response from the handler, and even make GitHub Redeliver the payload of any previous event.