GitHub.consumeRepositoryEvents reference
consumeRepositoryEvents
Section titled “consumeRepositoryEvents”Source:
packages/github/src/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 WebhookEvent and returns an
Effect. The handler runs once per webhook delivery.
Wiring the webhook (delivery URL, secret) is handled by
GitHub.RepositoryEventSourceLive, over the host’s WebhookHost.
consumeRepositoryEvents: Examples
Section titled “consumeRepositoryEvents: Examples”Example
// `event.name` is narrowed to "push" | "pull_request"yield* GitHub.consumeRepositoryEvents( { owner: "my-org", repository: "my-repo", events: ["push", "pull_request"], secret, }, (event) => Effect.log(`received ${event.name} (${event.id})`),);Example
// When you don't need to pass any options, the handler is the only argument.yield* GitHub.consumeRepositoryEvents((event) => Effect.log(`received ${event.name} (${event.id})`),);