How-to guidemonitoring5–7 minCookbook

Triggering TG2G Incidents from GitHub Actions

Use GitHub Actions and the Event API to open incidents on critical pipeline failures.

Last updated 2025-11-26
githubcialerting
Share:

When to page on CI failure

Not every pipeline failure needs an incident, but certain critical branches or deployment jobs often do. Common examples: - `main` or `release/*` deployment failures - Migration jobs that affect production databases - Canary deploys that fail automated checks

Example GitHub Actions workflow

Workflow YAML
name: Notify TG2G on failure

on:
  workflow_run:
    workflows: ["Deploy"]
    types: [completed]

jobs:
  notify-tg2g:
    if: ${{ github.event.workflow_run.conclusion == 'failure' }}
    runs-on: ubuntu-latest
    steps:
      - name: Call TG2G Event API
        run: |
          curl -X POST "https://ingest.techguys2go.com/api/webhook/ingest"                                     -H "X-TG2G-Api-Key: $TG2G_EVENT_KEY"                                     -H "Content-Type: application/json"                                     -d '{
              "summary": "Deploy failed in GitHub Actions",
              "severity": "high",
              "labels": {
                "service": "web-app",
                "env": "prod"
              },
              "details": "Check GitHub Actions logs for full error output."
            }'
        env:
          TG2G_EVENT_KEY: ${{ secrets.TG2G_EVENT_KEY }}