🔥Let’s Do DevOps: Making a GitHub Action Event Driven + New Repo Immediate Configuration + GitHub Apps + Python3 Lambda (Part 2)

Kyler Middleton
13 min readMay 8

This blog series focuses on presenting complex DevOps projects as simple and approachable via plain language and lots of pictures. You can do it!

Hey all!

This article is a continuation of what we built last time — namely, an event-driven GitHub Action, utilizing a custom GitHub App to send a webhook to an API gateway, which triggers a python3 lambda, which trigger a GitHub Action. We built all those resources last time in Part 1. If you haven’t read part 1, you should:

Now we’re going to look at the python3 code in the lambda, as well as the changes needed in the GitHub Action to take a repo name as input for a REST call.

If you just care about the code, scroll to the end of this write-up — a github repo is linked that contains all the terraform to build all the resources, as well as the python3 lambda.

First, let’s talk Lambda.

Lambda: Context

Before we look at the lambda code, we need to talk about the context — how is Lambda being launched, what does the json package in the webhook that makes its way to Lambda look like?

Let’s first go to our GitHub App and look at what the json payload looks like before we send it over. Go to your Org Settings → Third-Party Access → GitHub Apps → (Your app name) Configure → App Settings → Advanced. This very awesome page shows all the webhooks generated by the events the GitHub App is listening to and what their json payload looks like.

You’ll see one on this window that has a green check mark, which means it received a successful html code back from our lambda — we’ll build that soon. If you’re following along, yours likely all have the red exclamation mark, because your lambda isn’t in ship shape yet. We’ll get there soon!

Kyler Middleton

DevNetSecOps, DevRel, cloud security chick. I will teach you, it’s unavoidable. She/Her 🏳️‍🌈🏳️‍🌈, INFJ-A, support the EFF!