Workflows / Github / check_suite

Github Check Suite Completed Notification to Slack & Email

Use the Github integration by MagicBell to setup a workflow when check_suite triggers in Github.

Connect Github to MagicBell to receive events and trigger workflows. This guide uses the MagicBell CLI.

Add the Github integration

Save your Github webhook signing secret in MagicBell. See GitHub webhooks.

magicbell integration save_github \
  --data '{"webhook_signing_secret":"your_secret_here"}'

Copy the ID from the response and use it to build your webhook URL:

https://api.magicbell.com/v2/integrations/github/webhooks/incoming/{id}

Setup the webhook

  • Setup a webhook in Github with the URL from the last step.
  • Select the check_suite event.
  • If you already have a webhook configured, make sure it includes this event.

Add a workflow

Create a workflow that triggers automatically when Github sends this event.

Workflow key

Use this key to trigger the workflow when Github sends a check_suite event:

integration.github.check_suite

Filter by action: GitHub sends the event type in the header and the action in the payload body. Use an if condition to filter for the completed action:

"if": "payload.action == 'completed'"

Example workflow

Notify when all CI checks complete for a branch.

{
  "key": "integration.github.check_suite.completed",
  "steps": [
    {
      "command": "broadcast",
      "input": {
        "content": "All checks {{payload.check_suite.conclusion}} for {{payload.check_suite.head_branch}} in {{payload.repository.full_name}}.",
        "overrides": {
          "providers": {
            "slack": {}
          }
        },
        "recipients": [
          {
            "external_id": "engineering-team"
          }
        ],
        "title": "Check suite {{payload.check_suite.conclusion}} on {{payload.check_suite.head_branch}}"
      }
    }
  ]
}

Save with the CLI

Use the MagicBell CLI to save this workflow to your project. You can also use the Workflows API endpoint instead.

magicbell workflow save \
  --data '{"key":"integration.github.check_suite.completed","steps":[{"command":"broadcast","input":{"content":"All checks {{payload.check_suite.conclusion}} for {{payload.check_suite.head_branch}} in {{payload.repository.full_name}}.","overrides":{"providers":{"slack":{}}},"recipients":[{"external_id":"engineering-team"}],"title":"Check suite {{payload.check_suite.conclusion}} on {{payload.check_suite.head_branch}}"}}]}'

Event payload

Sample payload for the check_suite event. Use liquid templates to access fields in your workflow.

{
  "action": "completed",
  "check_suite": {
    "conclusion": "success",
    "head_branch": "main",
    "head_sha": "abc123def456",
    "id": 123456789,
    "status": "completed",
    "url": "https://api.github.com/repos/acme/project/check-suites/123456789"
  },
  "repository": {
    "full_name": "acme/project",
    "html_url": "https://github.com/acme/project",
    "id": 987654321,
    "name": "project"
  },
  "sender": {
    "id": 41898282,
    "login": "github-actions[bot]"
  }
}
View all Github workflows →