Gerald the Github Action Pug
Let me Introduce you to Gerald, but who and what is he?
Gerald is a Slack bot built on top of a GitHub webhook receiver to alert the data team when actions fail in our repositories. He’s helped the data team by improving the visibility of our failing actions, prevented us spending hours updating every workflow to include alerting and has removed the maintenance task of remembering to add said alerting to each new workflow. But most importantly he’s saved us time, Nice work Gerald !!
But how do you create an action notifying good boy, find out below for more info.
Testing and Initial Setup
To test the behaviour of the GitHub Webhook and workflow events, we quickly spun a webhook receiver using Mockoon and ngrok. Mockoon allows you to quickly create mock apis and then ngrok temporarily exposes the local server to the public internet with a one line command:
./ngrok http <LOCAL_SERVER_PORT>
We settled on using AWS API Gateway integrated with a Lambda function to be the Webhook receiver. We went with this architecture since it was easy to set up and API gateway makes it easy to deal with the complexities like securing the API.
The lambda function verifies the signature of the webhook event, then if successful, filters the event to only send a Slack message if the event is on either main or master branch and the workflow has failed. The Slack message sent includes both the workflow name and link to the action logs (see below):
To disable noisy github actions, a list of workflows names can be passed to the lambda through the deploy script, if a failing action is within the provided list no Slack message will be sent.
Gerald has been very useful in helping catch bugs early, in addition to providing more visibility into our deployment process. Why he’s a pug I don’t know, I guess I just like pugs 👍.
We are the engineers behind LandInsight and LandEnhance. We’re helping property professionals build more houses, one line of code at a time. We're a remote-first company with our tech team in Europe, and yes, we're hiring!