github
A GitHub channel.
Pass it as host({channels: {github: github({...})}}). A GitHub App webhook, verified with the webhook secret, turns a new issue or pull request comment into a run of agent; the reply is a comment on the same issue. GitHub has no buttons, so approvals are /approve <id> replies. Secrets are resolved on the host at ready().
Import from @threads/github (TypeScript) or threads.github (Python).
function github(options: {
agent: string;
webhookSecret: Secret;
token: Secret;
appSlug?: string;
tenant?: string | ((installationId: string) => string | undefined);
fetch?: (input: string | URL | Request, init?: RequestInit) => Promise<Response>;
}): ChannelAdapterParameters
agentstringrequiredThe key of host({agents}) this channel routes to. invalid_config: the channel's agent must be a key of host({ agents }).
webhookSecret / webhook_secretSecretrequiredThe App's webhook secret, which verifies every delivery. Unset at ready() is missing_secret. See Secret.
tokenSecretrequiredAn installation or fine-grained token with issues write, used to comment and to look a reply up. Unset at ready() is missing_secret. See Secret.
appSlug / app_slugstringThe App's slug: comments by <slug>[bot] are ignored, and a reply is looked up among its comments only. Omitted: every bot's comments are ignored, and a reply is found by its marker alone.
tenantstring | ((installationId: string) => string | undefined)TypeScript only. The tenant for an installation, or a function mapping an installation id to one (undefined refuses it). Omitted: github:<installation_id>. In Python each channel is github:<installation_id>.
tenant(installationId)stringrequiredTypeScript only. The App installation id the delivery came from.
fetch(input: string | URL | Request, init?: RequestInit) => Promise<Response>TypeScript only. Seam: the fetch the SDK sends through (tests); the run's fence wraps it either way. Omitted: the process's fetch.
apistrdefault https://api.github.comPython only. Seam: the GitHub REST API base URL (tests point it at a fake).
transporthttpx.AsyncBaseTransportPython only. Seam: the httpx transport replies are sent through (tests); the run's fence wraps it either way. Omitted: httpx's default.
Returns
Throws ConfigError with one of these codes: invalid_config, missing_secret.