Skip to main content

Quick Start

Install the plugin:
pnpm install @corsair-dev/github
Add the GitHub plugin to your Corsair instance:
corsair.ts
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 authentication
  • oauth_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-token
Check that it was stored correctly:
pnpm corsair auth --plugin=github --credentials
See 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=github
The 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-secret
See 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:
OptionTypeDescription
authType'api_key' | 'oauth_2'Authentication method
credentialsobjectCredentials object (token for api_key, clientId/clientSecret for oauth_2)
webhookSecretstringWebhook signing secret (optional)
hooksobjectEndpoint hooks for custom logic
webhookHooksobjectWebhook hooks for event handling
For complete documentation on getting credentials, see the Plugin Credentials Guide.