GitHub integration

Symmetric to GitCode: OAuth App + Bot PAT + a dedicated webhook path.

Prerequisites

What you need Why How to confirm
An account that can create a GitHub OAuth App and a PAT OAuth and the Bot PAT are two separate sets of credentials GitHub Developer settings
The platform's public domain redirect_uri must match the value registered in GitHub server_base_url
Ability to edit configs/ and restart the service Channel cards ship with the repository; credentials are configured on the login channel page (encrypted in the database) After the restart, the channel appears in the admin console

The integration is fully symmetric to GitCode integration; only the credentials change to a GitHub OAuth App + Bot PAT, and the webhook uses a dedicated path.

Integration steps

Step What to do Completion criteria
Step 1 Create an OAuth App in GitHub Settings → Developer settings Obtain client_id / client_secret
Step 2 Enter the GitHub credentials under Login channels GitHub appears on the login page
Step 3 Configure the Bot PAT under Code hosting platforms Issue comments show the Bot identity
Step 4 Host the repository and confirm the webhook The repository shows Hosted and the webhook returns 200
Step 5 Create an Issue or a comment, and confirm the event reaches Grape The event appears on the Events page and the Pipeline can start

GitHub OAuth Apps entry: register a new app when none exists

Step 1: Create a GitHub OAuth app

Create an app in GitHub under Settings → Developer settings → OAuth Apps → New OAuth App and set the Authorization callback URL to:

https://<your-domain>/api/auth/callback/github

Use the channel card default read:user user:email repo for scope. Record client_id and client_secret.

Step 2: Configure the login channel

Enter the GitHub client_id / client_secret under Admin → Login channels. The values are encrypted in the database after you save. In production, redirect_uri must be configured explicitly and must match the address registered in GitHub exactly.

Step 3: Configure the Bot Token

Configure the Bot PAT (classic, with the repo scope selected) and github_bot_username in Code hosting platforms → GitHub card. The Bot creates, closes, and comments on Issues; the login token is not used to write to repositories.

Step 4: Host the repository and confirm the webhook

Grape creates the webhook automatically when you host a repository. When you add one manually, enter the following in Settings → Webhooks → Add webhook:

https://<your-domain>/webhook/github

Set Content type to application/json and use that repository's webhook_secret as the Secret. GitHub verifies with HMAC-SHA256 through X-Hub-Signature-256.

Step 5: Verify events and write operations

Create an Issue or comment on one in a hosted repository: Recent deliveries for the GitHub webhook should show 200, the corresponding event should appear on the Grape Events page, and the Agent comment author should be the Bot account.

OAuth app (user login)

Where to configure: the github channel card is in configs/oauth-providers.json (it ships with the repository; you do not need to copy the example). client_id / client_secret are entered under Login channels and stored encrypted in grape_t_oauth_channels; values written to the file are stripped. In production, redirect_uri must be configured explicitly.

  • Create an app in GitHub under Settings → Developer settings → OAuth Apps and set Authorization callback URL to https://<your-domain>/api/auth/callback/github (identical to redirect_uri).
  • Use the channel card default read:user user:email repo for scope (user information and repository scope). The login token is no longer used to write to repositories; all repository reads and writes use the repository bot PAT, so admin:repo_hook and offline_access are not required.

How to verify: the Grape login page shows the GitHub entry → select it → after GitHub authorization you return to Grape and log in successfully.

Bot Token and username (write operations)

Where to configure: configs/global-bot-token.json is only a startup migration seed (migration reads it once). After that, configure the values in the Bot credentials of Code hosting platforms → GitHub card (write-only, never read back; leave empty to keep the current value).

Configuration example:

{
  "github_bot_token": "<your-github-bot-pat>",
  "github_bot_username": "<your-bot-username>"
}
  • github_bot_token: the PAT of the GitHub Bot account (classic, with the repo scope selected), used for write operations such as creating, closing, and commenting on Issues.
  • github_bot_username: the username of the Bot account (used for collaborator management and similar scenarios).

How to verify: host a GitHub repository and trigger one Issue run. If the Agent comment appears in GitHub and the author is the Bot account, the Token is valid.

Webhook (event ingestion)

Where to configure: GitHub repository Settings → Webhooks → Add webhook; the receiving path on the Grape side is fixed at POST /webhook/github.

Configuration example:

  • Payload URL: https://<your-grape-domain>/webhook/github
  • Content type: application/json
  • Secret: that repository's webhook_secret (Grape creates the hook and writes the value when you host a GitHub repository; for a manually created hook, copy it from the repository configuration, or query the internal endpoint /internal/repos/{repo_key}/webhook-config). Grape verifies with HMAC-SHA256 over that repository secret through X-Hub-Signature-256 and returns 403 on any mismatch; no global shared secret exists.

How to verify: the GitHub webhook details page shows a green ✓ (Recent deliveries contains a 200 record) → create an Issue in that repository → the corresponding event appears on the Grape Events page. The integration is working.

Note

The GitHub PAT and the webhook Secret are both sensitive values: documentation and configuration examples always use <placeholder> placeholders. Real values live only in the repository credentials (encrypted database columns) and the Admin code hosting platform card.

What success looks like

If you do this You should see Evidence
Open the login page The GitHub entry appears Button on the login page
Send a webhook through a dedicated path GitHub events enter the event stream without affecting the GitCode channel Source field in the event list