GitHub webhooks: failed workflows, deployments and Dependabot alerts as signals
Send a repository's or an organization's GitHub webhooks to Pulso and turn failed workflow runs, failed deployments and critical Dependabot alerts into signals.
GitHub can tell Pulso when a workflow fails on the main branch, a deployment to production goes wrong or Dependabot finds a critical vulnerability. Each becomes a signal with an owner and the steps to follow, instead of an email nobody reads.
Connect GitHub#
Add GitHub to Pulso to create a webhook source called GitHub; it shows these steps with the source’s URL and secret, then creates the monitors below that you pick, but the heartbeat, which needs your workflow’s path, with their playbooks and a report. To start from scratch instead, create a webhook data source called GitHub.
- In the repository, open Settings > Webhooks and click Add webhook. For every repository of an organization, do it in the organization’s Settings instead.
- Paste the source’s Endpoint URL,
https://hooks.pulso.run/webhooks/<id>/<token>, as the Payload URL. - Set Content type to application/json. With
application/x-www-form-urlencoded, GitHub sends the payload as one form field, and it arrives as a singlepayloadcolumn holding JSON text. - Set the Secret GitHub signs each delivery with to the source’s Signing secret, under Signatures with the GitHub scheme: Add to Pulso makes one up and refuses deliveries not signed with it; from scratch, set a long random one there.
- Choose Let me select individual events and pick the events you need, such as
workflow_run,deployment_statusanddependabot_alert. - Keep Active checked and click Add webhook.
GitHub sends a ping event right away, which shows up under the source’s Recent events. The REST API creates the same webhook with POST /repos/{owner}/{repo}/hooks or POST /orgs/{org}/hooks.
What arrives#
This is GitHub’s example of a workflow_run event with the completed action, trimmed:
{
"action": "completed",
"workflow_run": {
"id": 289782451,
"name": "",
"display_title": "ci(action): update actions/setup-node digest to 8c91899",
"head_branch": "master",
"head_sha": "3484a3fb816e0859fd6e1cea078d76385ff50625",
"event": "repository_dispatch",
"status": "completed",
"conclusion": "success",
"run_number": 163,
"run_attempt": 1,
"html_url": "https://github.com/octo-org/octo-repo/actions/runs/289782451",
"pull_requests": [],
"actor": { "login": "Codertocat" }
},
"workflow": {
"name": "test",
"path": ".github/workflows/test.yml"
},
"repository": { "full_name": "octo-org/octo-repo" },
"sender": { "login": "Codertocat" }
}
Its monitors see these columns:
| Column | Value |
|---|---|
action |
completed |
workflow_run.id |
289782451 |
workflow_run.display_title |
ci(action): update actions/setup-node digest to 8c91899 |
workflow_run.head_branch |
master |
workflow_run.event |
repository_dispatch |
workflow_run.conclusion |
success |
workflow_run.run_attempt |
1 |
workflow_run.html_url |
https://github.com/octo-org/octo-repo/actions/runs/289782451 |
workflow_run.pull_requests |
[], the whole list in one column |
workflow_run.actor.login |
Codertocat |
workflow.name |
test |
workflow.path |
.github/workflows/test.yml |
repository.full_name |
octo-org/octo-repo |
workflow_run.conclusion is one of success, failure, neutral, cancelled, timed_out, action_required, stale or skipped.
Telling events apart#
GitHub names the event only in the X-GitHub-Event header, which Pulso keeps as the http_headers.x_github_event column. Filter on it, http_headers.x_github_event equals workflow_run, alongside the event’s own columns, like workflow_run.conclusion. The delivery’s id is in http_headers.x_github_delivery, the same when GitHub redelivers it.
Monitors to build#
Failed workflow runs on main#
- Filters:
http_headers.x_github_eventequalsworkflow_run,actionequalscompleted,workflow_run.conclusionequalsfailure,workflow_run.head_branchequalsmain. - Uniq by:
workflow_run.idandworkflow_run.run_attempt, so a re-run that fails again opens a new signal. - Playbook: a question, “Flaky or a real failure?”, with
{{signal.workflow_run.html_url}}and a task for each answer, so the answers show which workflows to fix. Add a Slack notification to tell the team. The default branch may be calledmasterrather thanmain.
Failed deployments to production#
- Filters:
http_headers.x_github_eventequalsdeployment_status,deployment_status.stateequalsfailure,deployment_status.environmentequalsproduction. GitHub also reportserror; a second monitor with that state covers it. - Uniq by:
deployment_status.id. - Playbook: a task to check the deployment, an approval to roll back, and a task to do it. An HTTP request step can start the rollback workflow through GitHub’s API instead.
Critical Dependabot alerts#
- Filters:
http_headers.x_github_eventequalsdependabot_alert,actionequalscreated,alert.security_advisory.severityequalscritical. - Uniq by:
repository.full_nameandalert.number. - Playbook: a task with
{{signal.alert.html_url}}and{{signal.alert.dependency.package.name}}, and an approval once the fix is merged. Assign it to the repository’s team.
Heartbeat: the nightly workflow didn’t run#
A heartbeat monitor with filters http_headers.x_github_event equals workflow_run, action equals completed and workflow.path equals .github/workflows/nightly.yml, Frequency daily at the workflow’s time and a grace period that covers how long it takes. Any completed run counts, so a run that fails is the first monitor’s job; this one catches the night the schedule didn’t fire at all.
Limits#
- Signatures. With the webhook’s secret and the GitHub scheme, Pulso checks
X-Hub-Signature-256. GitHub signs no timestamp, so a delivery captured on its way could be sent again; the URL’s token still keeps anyone else out. - The ping. The first delivery is a
pingwithzen,hook_idandhook. It matches no monitor that filters onhttp_headers.x_github_eventor on another event’s columns. - No automatic retries. GitHub doesn’t redeliver a failed delivery, and counts one as failed when the answer takes longer than 10 seconds. Pulso answers as soon as it stores the event; a delivery that fails anyway can be redelivered by hand or through GitHub’s REST API.
- Lists stay whole.
workflow_run.pull_requestsor an issue’slabelsare one column each; acontainsfilter searches their text.
Sources: GitHub’s creating webhooks, webhook events and payloads, handling failed deliveries, and the payload examples and schemas in octokit/webhooks.
Add GitHub to Pulso: a webhook source, 3 monitors with their playbooks and a report, then these steps with the source's URL.
- GitHub failed workflow runs on main
- GitHub failed deployments to production
- GitHub critical Dependabot alerts
- Report: GitHub