Skip to content

events

Source: src/GitHub/RepositoryEventSource.ts

Subscribe to events emitted by a GitHub repository.

Call it in the init phase of a host (e.g. a Cloudflare Worker) and pass a process function that receives each {@link WebhookEvent} and returns an Effect. The handler runs once per webhook delivery.

Wiring the webhook (delivery URL, secret, IAM/bindings) is handled by the host-specific runtime layer — see Cloudflare.GitHubRepositoryEventSourceLive for the Cloudflare Worker implementation.

// `event.name` is narrowed to "push" | "pull_request"
yield* GitHub.events({
owner: "my-org",
repository: "my-repo",
events: ["push", "pull_request"],
secret,
}).subscribe((event) =>
Effect.log(`received ${event.name} (${event.id})`),
);