A webhook for GitHub's push events to provide a unified diff in an email. Created as a Lambda function to be used with API Gateway.
For some additional information on some settings in AWS head over here: http://www.tonytruong.net/getting-github-unified-diff-emails-using-aws-lambda-and-api-gateway/
AWS Lambda currently supports up to version 4.3.2 but I've built this and packaged it on 5.7+ so that should be fine.
- API Gateway full access
- IAM Execution Role creation access
- Lambda full access
- SMTP server credentials
Make sure you modify the config.json:
{
"mailConfig":{
"host": "SMTP SERVER",
"username": "USERNAME",
"password": "PASSWORD",
"from": "[email protected]",
"to": "[email protected],[email protected]"
},
"github":{
"secret": "github web hook secret"
}
}
The code uses Secure SMTP connections to send emails on port 465.
The high level overview of what you need is:
- Clone this repository and use
npm install --save
and zip up the contents includingnode_modules
- Create the API Gateway endpoint and point to a lambda function
- Create the lambda function using the zip file you created with this code
- Create an IAM Execution role for the lambda function and give the API Gateway permissions to invoke this function
- Point the API Gateway endpoint to use this lambda function
- Apply pass-through mappings on the API Gateway so the lambda function can access the headers and body. Use the provided body-mapping for 'application/json' from AWS in the dropdown. It should look similar to this: