GitHub
Integrate GitHub repositories, issues, pull requests, and releases
Quick Start
Install the plugin:
pnpm install @corsair-dev/githubAdd the GitHub plugin to your Corsair instance:
import { createCorsair } from "corsair";
import { github } from "@corsair-dev/github";
export const corsair = createCorsair({
plugins: [
github(),
],
});Once configured, you can access the GitHub API through your Corsair instance:
const issues = await corsair.github.api.issues.list({
owner: "octocat",
repo: "Hello-World",
});Authentication
Supported Auth Types
The GitHub plugin supports two authentication methods:
api_key- Personal Access Token authenticationoauth_2- OAuth App authentication
API Key Authentication (Personal Access Token)
Store the token using the Corsair CLI:
pnpm corsair setup --github api_key=your-personal-access-tokenCheck that it was stored correctly:
pnpm corsair auth --plugin=github --credentialsSee Get Credentials for step-by-step instructions on obtaining a Personal Access Token.
OAuth 2.0 Authentication
Store your OAuth app credentials, then kick off the flow:
pnpm corsair setup --github client_id=your-client-id client_secret=your-client-secret
pnpm corsair auth --plugin=githubThe CLI will print an authorization URL. Open it in a browser — once you approve, tokens are saved automatically.
See Get Credentials for step-by-step instructions on setting up OAuth 2.0.
Webhook Secret
Store the webhook secret using the CLI:
pnpm corsair setup --github webhook_signature=your-webhook-secretSee Get Credentials for step-by-step instructions on setting up webhooks.
See Authentication for details on managing credentials.
Options
The GitHub plugin accepts the following configuration options:
| Option | Type | Description |
|---|---|---|
authType | 'api_key' | 'oauth_2' | Authentication method |
credentials | object | Credentials object (token for api_key, clientId/clientSecret for oauth_2) |
webhookSecret | string | Webhook signing secret (optional) |
hooks | object | Endpoint hooks for custom logic |
webhookHooks | object | Webhook hooks for event handling |
For complete documentation on getting credentials, see the Plugin Credentials Guide.