Automatic Email Notification on Github Pushes

It would be sweet if we can get auto email notifications whenever someone pushes to our github project. Unfortunately, the default email service hook of github only supports 2 email addresses at most. Although putting everyone into a mailing list is one solution, for small teams like us, it's also convenient to get a quick php script to do this.

The underlying process is, github provides a post-receiving web hook. Whenever it receives a push, a URL specified by the user will be hit with a JSON payload about the details. We then get a php script parsing the payload and send out the summary emails.

Example code

Note mail() function in php may need extra setup. Check here for a brief introduction about the configuration.
Of course this can be used to do more such as blog deployment. Stephen Zhang got his blog deployed this way.



Recent Comments