GitHub Setup
CodeSpider v1.1.0 can review pull requests on GitHub in addition to Gitea. The GitHub provider lives in internal/provider/github and uses only the Go standard library. Select it with forge.provider: github.
This page was checked against upstream v1.1.0 (45f334d), file docs/github-provider.md.
What it supports
Section titled “What it supports”- Reading pull request metadata and the unified diff.
- Submitting reviews with a summary and inline comments.
- A marker-based sticky summary comment, kept up to date on every review.
- Commit status with the
codespidercontext. - Permission checks (
write,maintain, oradmin) for collaborator-only commands. - Listing open pull requests and repositories for periodic reconciliation.
- Labels and CODEOWNERS reviewer requests when repository policy enables them.
/resolve, implemented through the GraphQL API by resolving the review threads that contain the bot’s comments.
/webhook serves only the selected provider, so run two CodeSpider instances if you need Gitea and GitHub at the same time.
Configure the daemon
Section titled “Configure the daemon”With a static token:
forge: provider: github # Optional. Empty discovers repositories the token can access. repos: [acme/service]
github: api_url: https://api.github.com token: "${CODESPIDER_GITHUB_TOKEN}" webhook_secret: "${CODESPIDER_GITHUB_WEBHOOK_SECRET}" bot_username: "codespider[bot]"With a GitHub App (omit token):
github: api_url: https://api.github.com webhook_secret: "${CODESPIDER_GITHUB_WEBHOOK_SECRET}" app_id: 123456 installation_id: 987654321 app_private_key_path: /run/secrets/codespider-github-app.pemIn App mode CodeSpider requests an installation token on first use and refreshes it five minutes before it expires. The same token serves API calls and HTTPS git fetches. The RSA key must be at least 2048 bits and is read at startup, so restart the daemon after rotating it. Mount the key as a read-only secret and grant the App only the repository permissions your enabled features need.
Configuration validation rejects a GitHub setup that has neither a token nor complete App credentials, that sets both, that has no github.webhook_secret, or whose github.api_url is not an HTTPS URL without user info, query, or fragment. For GitHub Enterprise Server, set api_url to its REST endpoint, commonly https://github.example.com/api/v3.
Create the webhook
Section titled “Create the webhook”In the repository settings add a webhook that targets https://<codespider-host>/webhook, uses application/json, and has the same secret as github.webhook_secret. Subscribe to:
| Event | Used for |
|---|---|
pull_request |
opened, reopened, synchronize, and ready_for_review actions start automatic reviews |
issue_comment |
PR conversation comments that mention the bot, such as @codespider /review |
pull_request_review_comment |
Inline comments that mention the bot |
Signatures are verified from X-Hub-Signature-256 with HMAC-SHA256 and a constant-time comparison. A request without a valid signature is rejected before any payload parsing. A pull request whose head repository is missing, which happens when a fork was deleted, is treated as a fork and gets the restricted fork capabilities.
Verify the first test review
Section titled “Verify the first test review”Start the daemon using the GitHub install path. Confirm the test repository’s signed webhook delivered successfully, then open or update a small pull request. Check that the bot posts a review summary and updates the expected commit status. Inline comments only appear for findings attached to the diff. Keep CI and human approval enabled.
Current boundaries
Section titled “Current boundaries”- The client has a 30-second HTTP timeout, sends the GitHub REST API version header, bounds response bodies, and honors cancellation.
- GitHub may reject inline comments whose line is not part of the current diff, or when the token lacks review write permission.
/resolvecan be rejected if the App has no access to the pull request.- Fork pull requests follow the same rule as on Gitea: settings, instruction files, and
CODEOWNERScome from the base branch. See Configuration. - The provider is not validated against live GitHub.com or GitHub Enterprise Server.