@restaq/github
GitHub webhook plugin with signature verification and fully-typed event catalog.
Install
pnpm add @restaq/githubPeer dependency: @restaq/core
Exports
| Export | Kind | Description |
|---|---|---|
github | Function | Creates a GitHub plugin for webhook ingestion. |
GitHubEventMap | Type | Fully-typed catalog of every GitHub webhook event. |
GitHubPluginOptions | Type | Configuration for the GitHub plugin. |
Types
GitHubEventMap
type GitHubEventMap =
UnionToIntersection<
{ [K in keyof EventPayloadMap & string]: EventEntries<K> }[keyof EventPayloadMap & string]
> extends infer TMap
? { [K in keyof TMap]: TMap[K] }
: never;A fully-typed map of every GitHub webhook event. Events are keyed by their event name and action (e.g., "github.pull_request.opened", "github.push"), mapped to their payload types from the @octokit/webhooks-types package. Actions are automatically parsed from the request body, so each combination has its own type-safe entry.
GitHubPluginOptions
type GitHubPluginOptions = {
webhookSecret?: string;
};Configuration for the GitHub plugin. webhookSecret defaults to process.env.GITHUB_WEBHOOK_SECRET if not passed.
Functions
github
function github(options?: GitHubPluginOptions): RelayPlugin<GitHubEventMap>;Creates a GitHub plugin. Verifies webhook signatures using GitHub's HMAC-SHA256 scheme (X-Hub-Signature-256 header), parses event type and action from request headers and body, and normalizes deliveries into Restaq's format. Registers as the "github" provider and makes all GitHub event types available for typed handler registration via relay.on().