GitHub
Repository and organisation webhooks, verified with X-Hub-Signature-256.
Set it up
briefkasten source add github --project acme-shop- In GitHub, open the repository's or organisation's Settings → Webhooks → Add webhook.
- Payload URL: the source's hook URL. Content type:
application/json. - Secret: the secret
source addprinted. - Choose the events, or Send me everything.
GitHub sends a ping right away; it shows up as an event.
Signature
GitHub signs the raw body with HMAC-SHA256 and the source's secret, hex, in X-Hub-Signature-256: sha256=…. A missing or wrong signature is refused with the reason, and never delivered.
Events
The event name is GitHub's X-GitHub-Event and, where there is one, the payload's action: pull_request.opened, issues.closed, push. The body is GitHub's payload. The adapter publishes these events; others are verified and acknowledged, and make no event:
| Event | Target |
|---|---|
push | owner/repo:<ref> |
pull_request.*, pull_request_review.*, pull_request_review_comment.*, pull_request_review_thread.* | owner/repo:pull:<number> |
issues.* | owner/repo:issue:<number> |
issue_comment.* | its pull request's or issue's target |
check_run.*, check_suite.* | owner/repo:pull:<number> for one pull request, else owner/repo:commit:<sha> |
workflow_run.* | owner/repo:run:<id> |
status | owner/repo:commit:<sha> |
ping | owner/repo:ping |
pushCommits pushed to mainevent pushtarget acme/shop:refs/heads/main
{
"ref": "refs/heads/main",
"before": "0d1a26e67d8f5eaf1f6ba5c57fc3c7d91ac0fd1c",
"after": "6dcb09b5b57875f334f61aebed695e2e4193db5e",
"created": false,
"deleted": false,
"forced": false,
"compare": "https://github.com/acme/shop/compare/0d1a26e67d8f...6dcb09b5b578",
"commits": [
{
"id": "6dcb09b5b57875f334f61aebed695e2e4193db5e",
"message": "Sort the Monday mail first",
"timestamp": "2026-12-04T12:00:00.000Z",
"author": {
"name": "The Octocat",
"email": "octocat@github.com",
"username": "octocat"
},
"added": [],
"removed": [],
"modified": [
"src/sort.ts"
]
}
],
"head_commit": {
"id": "6dcb09b5b57875f334f61aebed695e2e4193db5e",
"message": "Sort the Monday mail first",
"timestamp": "2026-12-04T12:00:00.000Z"
},
"repository": {
"id": 712334908,
"name": "shop",
"full_name": "acme/shop",
"private": true,
"html_url": "https://github.com/acme/shop",
"default_branch": "main"
},
"pusher": {
"name": "octocat",
"email": "octocat@github.com"
},
"sender": {
"login": "octocat",
"id": 583231,
"type": "User",
"html_url": "https://github.com/octocat"
}
}pull_request.openedA pull request was openedevent pull_request.openedtarget acme/shop:pull:42
{
"action": "opened",
"number": 42,
"pull_request": {
"number": 42,
"state": "open",
"title": "Letterbox jams on Mondays",
"body": "Fixes the Monday jam by sorting first.",
"html_url": "https://github.com/acme/shop/pull/42",
"draft": false,
"user": {
"login": "octocat",
"id": 583231,
"type": "User",
"html_url": "https://github.com/octocat"
},
"head": {
"ref": "fix/monday-jam",
"sha": "6dcb09b5b57875f334f61aebed695e2e4193db5e"
},
"base": {
"ref": "main",
"sha": "0d1a26e67d8f5eaf1f6ba5c57fc3c7d91ac0fd1c"
},
"created_at": "2026-12-04T12:00:00.000Z",
"updated_at": "2026-12-04T12:00:00.000Z"
},
"repository": {
"id": 712334908,
"name": "shop",
"full_name": "acme/shop",
"private": true,
"html_url": "https://github.com/acme/shop",
"default_branch": "main"
},
"sender": {
"login": "octocat",
"id": 583231,
"type": "User",
"html_url": "https://github.com/octocat"
}
}pull_request.closedA pull request was mergedevent pull_request.closedtarget acme/shop:pull:42
{
"action": "closed",
"number": 42,
"pull_request": {
"number": 42,
"state": "closed",
"merged": true,
"merged_at": "2026-12-04T12:00:00.000Z",
"title": "Letterbox jams on Mondays",
"html_url": "https://github.com/acme/shop/pull/42",
"user": {
"login": "octocat",
"id": 583231,
"type": "User",
"html_url": "https://github.com/octocat"
}
},
"repository": {
"id": 712334908,
"name": "shop",
"full_name": "acme/shop",
"private": true,
"html_url": "https://github.com/acme/shop",
"default_branch": "main"
},
"sender": {
"login": "octocat",
"id": 583231,
"type": "User",
"html_url": "https://github.com/octocat"
}
}issues.openedAn issue was openedevent issues.openedtarget acme/shop:issue:7
{
"action": "opened",
"issue": {
"number": 7,
"title": "Parcels pile up behind the door",
"body": "Since Tuesday the slot is full.",
"state": "open",
"html_url": "https://github.com/acme/shop/issues/7",
"user": {
"login": "octocat",
"id": 583231,
"type": "User",
"html_url": "https://github.com/octocat"
},
"labels": [
{
"name": "bug"
}
],
"created_at": "2026-12-04T12:00:00.000Z"
},
"repository": {
"id": 712334908,
"name": "shop",
"full_name": "acme/shop",
"private": true,
"html_url": "https://github.com/acme/shop",
"default_branch": "main"
},
"sender": {
"login": "octocat",
"id": 583231,
"type": "User",
"html_url": "https://github.com/octocat"
}
}issue_comment.createdA comment on an issueevent issue_comment.createdtarget acme/shop:issue:7
{
"action": "created",
"issue": {
"number": 7,
"title": "Parcels pile up behind the door",
"html_url": "https://github.com/acme/shop/issues/7"
},
"comment": {
"id": 1840112337,
"body": "Seen it too, on the second floor.",
"user": {
"login": "octocat",
"id": 583231,
"type": "User",
"html_url": "https://github.com/octocat"
},
"created_at": "2026-12-04T12:00:00.000Z",
"html_url": "https://github.com/acme/shop/issues/7#issuecomment-1840112337"
},
"repository": {
"id": 712334908,
"name": "shop",
"full_name": "acme/shop",
"private": true,
"html_url": "https://github.com/acme/shop",
"default_branch": "main"
},
"sender": {
"login": "octocat",
"id": 583231,
"type": "User",
"html_url": "https://github.com/octocat"
}
}check_run.completedA CI check finishedevent check_run.completedtarget acme/shop:commit:6dcb09b5b57875f334f61aebed695e2e4193db5e
{
"action": "completed",
"check_run": {
"id": 21830441112,
"name": "test",
"head_sha": "6dcb09b5b57875f334f61aebed695e2e4193db5e",
"status": "completed",
"conclusion": "success",
"started_at": "2026-12-04T12:00:00.000Z",
"completed_at": "2026-12-04T12:00:00.000Z",
"html_url": "https://github.com/acme/shop/runs/21830441112",
"app": {
"slug": "github-actions"
},
"pull_requests": []
},
"repository": {
"id": 712334908,
"name": "shop",
"full_name": "acme/shop",
"private": true,
"html_url": "https://github.com/acme/shop",
"default_branch": "main"
},
"sender": {
"login": "octocat",
"id": 583231,
"type": "User",
"html_url": "https://github.com/octocat"
}
}workflow_run.completedA workflow run finishedevent workflow_run.completedtarget acme/shop:run:12093884201
{
"action": "completed",
"workflow_run": {
"id": 12093884201,
"name": "CI",
"head_branch": "main",
"head_sha": "6dcb09b5b57875f334f61aebed695e2e4193db5e",
"event": "push",
"status": "completed",
"conclusion": "failure",
"run_number": 318,
"html_url": "https://github.com/acme/shop/actions/runs/12093884201",
"created_at": "2026-12-04T12:00:00.000Z",
"updated_at": "2026-12-04T12:00:00.000Z"
},
"repository": {
"id": 712334908,
"name": "shop",
"full_name": "acme/shop",
"private": true,
"html_url": "https://github.com/acme/shop",
"default_branch": "main"
},
"sender": {
"login": "octocat",
"id": 583231,
"type": "User",
"html_url": "https://github.com/octocat"
}
}Options
| Option | |
|---|---|
repos | Only these repositories (owner/repo); others are acknowledged and dropped. |
registerWebhooks | Create and repair the webhooks of repos at the hook URL (needs auth). |
webhookEvents | The events to subscribe when registering. Default: all. |
auth | A token or a GitHub App, for registering webhooks and the adapter's actions. |
apiUrl | GitHub Enterprise Server's API URL. |
In your app
import { github } from "@briefkasten/adapter-github";
const hooks = briefkasten({
sources: { github: github({ secret: process.env.GITHUB_WEBHOOK_SECRET, repos: ["acme/shop"] }) },
});
hooks.on("github:pull_request.opened", async (event) => {
console.log(event.body.pull_request.title);
});