Land Technologies
< all posts

Gerald the Github Action Pug

Posted by Edward Burroughes on August 17, 2022 · 2 min read serverlesswebhookgithub

Let me Introduce you to Gerald, but who and what is he?

Gerald the pug

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>

By experimenting with different GitHub webhooks events and reviewing the Mockoon logs, the workflow_run event appeared to be the best fit for Gerald.

Alerting

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.

architecture diagram

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):

slack message screenshot

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.

Conclusion

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 👍.


serverlesswebhookgithub
Land Technologies

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!

© 2022, Built with Gatsby
LAND TECHNOLOGIES LTD, m: WeWork c/o LandTech, 10 Devonshire Square, London, EC2M 4PL t: 0203 086 7855
© 2016 Land Technologies Ltd. Registered Company Number 08845300.