Github Webhook Middleware
This middleware parses a Github webhook and validates the signature as documented https://developer.github.com/webhooks/#payloads
You will need to set a secret when you create the webhook and pass the same secret as options.secret
for validation.
The Github webhook payload will be accessible via req.body
Borrows ideas and code from https://github.com/developmentseed/jekyll-hook/ and https://github.com/rvagg/github-webhook-handler
Installation
npm install github-webhook-middleware --save
Usage
var express = ;var app = ;var githubMiddleware = secret: processenvGITHUB_SECRET; app; // The Github push event returns an array of commits.// Each commit object has an array of added, modified and deleted files.// getChangedFiles() returns a list of all the added and modified files// excluding any files which are subsequently removed. { return commits ;}
Contributing
Pull requests welcome. Needs tests.
Release History
- 0.0.1 Initial release