GitHub repository_dispatch
Goal: when DownBad confirms an incident, a GitHub Actions workflow in your repository runs with DownBad’s diagnosis of it, and runs again when the incident recovers.
GitHub Actions runs workflows, files in .github/workflows/ that say what
to do when something happens in a repository. A repository_dispatch event
is one that something outside GitHub sends through GitHub’s API, here DownBad.
GitHub documents it under
Create a repository dispatch event
and
Events that trigger workflows › repository_dispatch.
You need a paid DownBad plan and a GitHub repository you can push to.
-
Make a token that can send the event. In GitHub, go to Settings › Developer settings › Personal access tokens. A fine-grained token needs only this repository and Contents: Read and write; a classic token needs the
reposcope. GitHub’s guide: Managing your personal access tokens. -
Add a workflow that runs on DownBad’s events. Commit a file such as
.github/workflows/downbad.ymlto the repository’s default branch:name: DownBad incidenton:repository_dispatch:types: [downbad.incident.confirmed, downbad.incident.recovered]jobs:respond:runs-on: ubuntu-lateststeps:- name: Show what DownBad foundenv:BRIEF: ${{ github.event.client_payload.brief }}INCIDENT: ${{ github.event.client_payload.incidentId }}EVENT: ${{ github.event.action }}run: |echo "Incident $INCIDENT: $EVENT"echo "$BRIEF"github.event.actionis the event type DownBad sent, andgithub.event.client_payloadis the payload. Pass payload values to a script throughenv:as above, never by pasting${{ }}into arun:line, sincedossier.untrustedEvidenceholds text the monitored site wrote. -
Add it in DownBad. Go to Settings › Alerts, press Add webhook and paste either the repository’s page, such as
https://github.com/acme/web-app, or its dispatches address,https://api.github.com/repos/acme/web-app/dispatches. DownBad recognizes it as GitHub repository_dispatch and asks for:- GitHub token: from step 1.
-
Save. DownBad makes a signing secret for the channel and shows it once. GitHub doesn’t pass request headers on to the workflow, so the workflow never sees the
X-DownBad-Signatureheader: keep the secret only if something else reads the requests, and otherwise press Done. -
Press Test now on the saved channel. DownBad sends the event type
downbad.test, which the workflow above ignores. Adddownbad.testtotypes:to see a test run. -
Add the channel to the notification profiles of the monitors the workflow should hear about.
DownBad never shows the token or the signing secret again once saved. To keep the token when you edit the channel, leave its field empty. To get a new signing secret, press Rotate signing secret on the channel.
Expected result
Section titled “Expected result”The test answers GitHub accepted the repository_dispatch event downbad.test. For a real incident:
- When DownBad confirms the incident, it sends
downbad.incident.confirmedonce. - When the incident closes, it sends
downbad.incident.recoveredonce. - Nothing else is sent: not each failing check, not escalation reminders, and not quiet-hours summaries. Quiet hours and maintenance hold it the same way they hold your other alerts.
The client_payload is described in
Agent Webhook › The payload.
Failed deliveries are retried like any webhook’s: see
Webhooks › What happens when delivery fails.
Troubleshooting
Section titled “Troubleshooting”The delivery fails with HTTP 404, “Not Found”. GitHub answers 404 when the token can’t see the repository: the owner or name is misspelled, or the token wasn’t given this repository. Check the URL, and the token’s Repository access.
The delivery fails with HTTP 401 or 403.
The token expired, was revoked, or lacks Contents: Read and write (the
repo scope for a classic token). Make a new one and paste it into the
channel.
The delivery is accepted but no workflow runs.
GitHub runs a repository_dispatch workflow only from the default branch, and
only for an event type in its types: list. Check the file is on the default
branch and lists downbad.incident.confirmed.
Alerts stopped and the bell says the webhook was switched off. Ten deliveries in a row failed. Fix the cause above, then press Test now to switch the channel back on.