Integrations / GitHub

    G

    GitHub

    Capture GitHub repository events — pushes, pull requests, issues, releases — and forward or replay them to your CI/CD or notification systems.

    Auto-detected:Paggio detects GitHub events via the x-github-event header.

    Setup

    1

    Create a Paggio endpoint

    Go to Dashboard → Webhooks → New Endpoint.

    Set the destination URL to your webhook handler if you want forwarding:

    text
    https://your-app.com/api/github/webhook
    2

    Go to your GitHub repository settings

    Navigate to your repository on GitHub → Settings → Webhooks → Add webhook.

    3

    Configure the webhook

    Fill in the fields:

    • · Payload URL — your Paggio endpoint URL
    • · Content typeapplication/json
    • · Secret — optional HMAC secret for signature verification
    • · Events — choose individual events or "Send me everything"
    4

    Verify delivery

    GitHub shows a recent deliveries list. You should also see the event appear in your Paggio dashboard immediately.

    Handling GitHub events

    app/api/github/webhook/route.ts
    import { createHmac } from 'crypto';
    
    export async function POST(req: Request) {
      const body = await req.text();
      const event = req.headers.get('x-github-event');
      const signature = req.headers.get('x-hub-signature-256');
    
      // Verify signature (optional but recommended)
      if (process.env.GITHUB_WEBHOOK_SECRET) {
        const expected = 'sha256=' + createHmac('sha256', process.env.GITHUB_WEBHOOK_SECRET)
          .update(body).digest('hex');
        if (signature !== expected) {
          return Response.json({ error: 'Invalid signature' }, { status: 401 });
        }
      }
    
      const payload = JSON.parse(body);
    
      switch (event) {
        case 'push':
          console.log('Push to', payload.ref, 'by', payload.pusher.name);
          break;
        case 'pull_request':
          console.log('PR', payload.action, ':', payload.pull_request.title);
          break;
        case 'issues':
          console.log('Issue', payload.action, ':', payload.issue.title);
          break;
      }
    
      return Response.json({ received: true });
    }

    Common GitHub event types

    EventWhen it fires
    pushCode pushed to a branch
    pull_requestPR opened, closed, merged, or updated
    issuesIssue opened, closed, or commented on
    releaseRelease published or pre-released
    workflow_runGitHub Actions workflow completes
    check_runCI check completes
    starRepository starred
    GitHub Apps vs webhooks:Paggio works with both GitHub repository webhooks and GitHub Apps webhooks. The setup is the same — just point the webhook URL at your Paggio endpoint.