Skip to content
POST/api/v1/webhooks/github

GitHub webhook receiver

Receives GitHub App webhook deliveries for PR code scanning — the URL customers paste into their GitHub App settings from /dashboard/security/code-scan. Verifies the `X-Hub-Signature-256` HMAC over the RAW body with `crypto.timingSafeEqual` (401 on a missing or mismatched signature, 500 if `GITHUB_WEBHOOK_SECRET` is unset). Only `pull_request` events with action `opened`, `synchronize` or `reopened` are acted on; every other event (push, issues, etc.) is acknowledged with `{action:"ignored", reason}`. For a matching PR it returns the scan plan `{action:"scan_pr", repo, pr, sha, changedFiles, message}` — the diff fetch and check-run creation are not performed on this path. Not used for deploy hooks or changelog automation. Authentication: the GitHub App webhook signature in `X-Hub-Signature-256` (the GitHubWebhookSignature scheme) — an HMAC over the raw body keyed with your app's webhook secret. The caller is GitHub: there is no `eg_` API key, no session and no organization on this request, and no API-key scope is evaluated.

Authentication

GitHub App webhook signature. GitHub sends X-Hub-Signature-256: sha256=<HMAC-SHA256 of the raw body>, keyed with your app's webhook secret.

The caller is GitHub, so there is no eg_ API key, no session and no organization on this request. The secret is configured in your GitHub App, not minted in EvalGuard; a missing or mismatched signature is a 401.

Parameters

X-Hub-Signature-256 in headerrequired
string
X-GitHub-Event in headerrequired
string

Response

All status codes

200Event processed.
400Bad Request.
401Signature verification failed.
500Internal Server Error.

Code samples

cURL

curl -X POST \
  https://evalguard.ai/api/v1/webhooks/github \
  -H "Authorization: Bearer $EVALGUARD_API_KEY"

TypeScript

// The TypeScript SDK (@evalguard/sdk) exposes TYPED methods — runEval,
// getEval, runSecurityScan, checkFirewall, … — not a generic request().
// For an arbitrary endpoint, call it directly:

const res = await fetch("https://evalguard.ai/api/v1/webhooks/github", {
  method: "POST",
  headers: { Authorization: `Bearer ${process.env.EVALGUARD_API_KEY}` },
});
console.log(res.status, await res.json());

Python

# The Python SDK (pip install evalguardai) exposes TYPED methods on
# EvalGuardClient — run_eval, get_eval, … — not a generic request().
# For an arbitrary endpoint, call it directly:

import os
import requests

headers = {"Authorization": f"Bearer {os.environ['EVALGUARD_API_KEY']}"}

response = requests.request("POST", "https://evalguard.ai/api/v1/webhooks/github", headers=headers)
print(response.status_code, response.json())

Go

package main

import (
	"context"
	"fmt"
	"net/http"
	"os"
)

func main() {
	req, _ := http.NewRequestWithContext(context.Background(), "POST", "https://evalguard.ai/api/v1/webhooks/github", nil)
	req.Header.Set("Authorization", "Bearer "+os.Getenv("EVALGUARD_API_KEY"))
	resp, err := http.DefaultClient.Do(req)
	if err != nil { panic(err) }
	defer resp.Body.Close()
	fmt.Println(resp.Status)
}

Errors

400401500

Other Webhooks endpoints