GitCode integration
Login + Bot write operations + event ingestion: all three are required before automation can trigger.
Prerequisites
| What you need | Why | How to confirm |
|---|---|---|
| An account that can create OAuth apps and Bot tokens on GitCode | OAuth login and Bot write operations use two separate sets of credentials | The GitCode settings page can create apps |
| The platform's public domain | redirect_uri can be left empty in the development environment and is derived automatically; the production gate requires an explicit value, and an explicit value must match the third-party registration byte for byte |
server_base_url in configs/server-config.json or the admin console |
| 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 |
GitCode integration = login (OAuth) + Bot write operations (create repository / post comments) + event ingestion (webhook). Only when all three are configured can Grape listen to GitCode repositories and write operations back.
Integration steps
| Step | What to do | Completion criteria |
|---|---|---|
| Step 1 | Create an OAuth app in GitCode and register the callback URL | Obtain client_id / client_secret |
| Step 2 | Enter the GitCode credentials under Login channels | GitCode appears on the login page |
| Step 3 | Configure the Bot Token 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 is normal |
| 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 |
Step 1: Create a GitCode OAuth app
Create an OAuth app in GitCode and set the callback URL to:
https://<your-domain>/api/auth/callback/gitcode
Record client_id and client_secret.
Step 2: Configure the login channel
Enter the GitCode client_id / client_secret under Admin → Login channels. The values are encrypted in the database after you save. redirect_uri can be left empty in the development environment and is derived automatically; in production it must match the address registered in GitCode byte for byte.
Step 3: Configure the Bot Token
Configure the Bot PAT in Code hosting platforms → GitCode card. The PAT must cover at least repository read/write, Issue/PR comments, and webhook management. The Bot username is declared by the platform card; after you enter the token, select Verify to fill it in.
Step 4: Host the repository and confirm the webhook
After the repository is connected, Grape creates the webhook automatically. When you add one manually, enter:
https://<your-domain>/webhook/gitcode
The Secret must equal that repository's webhook_secret. A webhook test should return 200.
Step 5: Verify events and write operations
Create or comment on an Issue, or open a pull request, in a hosted repository: the 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 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; credentials written to the file are stripped by the loader with a warning. redirect_uri can be left empty in the development environment (server_base_url derives https://<your-domain>/api/auth/callback/gitcode). The production gate requires an explicit value, and an explicit value must match the callback address registered in the GitCode OAuth App byte for byte.
How to verify: open the Grape home page → select Sign in with GitCode → you are redirected to the GitCode authorization page and can return with a successful login. If so, the three OAuth fields are correct.
Bot Token (platform write operations)
Grape performs write operations on GitCode as the Bot (create/close/comment on Issues, create repositories, and so on).
Where to configure: gitcode_api_token in configs/global-bot-token.json is only a startup migration seed (migration reads it once; it is not read at runtime). After that, configure it in the Bot credentials of Code hosting platforms → GitCode card (write-only, never read back; leave empty to keep the current value); the database is authoritative at runtime.
Configuration example:
{
"gitcode_api_token": "<your-gitcode-bot-pat>"
}
gitcode_api_token: the personal access token (PAT) of the GitCode Bot. It needs repository and Issue write permission.bot_usernameis not configured in this file: the bot account name is declared bybot_usernameon the platform card (unique per platform; used for self-comment detection and collaborator invitations). After you enter the token, select Verify to fill in the login name that owns the token. The oldbot_usernamespool is retired; a value in this file is ignored.
How to verify: after you save the Bot credentials in Code hosting platforms → GitCode card, have any Agent create an Issue comment in a hosted repository. If the comment appears in GitCode and the author is the Bot account, the Token is valid.
Webhook (event ingestion)
Where to configure: webhook_url is on the Platform credentials page (the DB meta is authoritative at runtime; the field of the same name in configs/global-bot-token.json is only a startup migration seed). Signature verification does not read the global configuration: the Secret on the GitCode side must equal the webhook_secret in that repository's credentials.
{
"webhook_url": "https://<your-grape-domain>"
}
webhook_url: enter only the public base URL (for examplehttps://<your-grape-domain>). The actual callback address is the base URL plus the/webhook/gitcodeappended by the platform card (POST /webhook/gitcode); a/webhook/xxxalready present in the value is ignored.webhook_secret: the repository-level webhook signing secret, stored in the repository credentials. Hosted repositories generate it automatically.
How to verify (hosted repository → test webhook → confirm the event arrives):
- When you host a repository, Grape creates the webhook automatically (no manual setup needed). To add one manually: in the GitCode repository, open Settings → Webhooks and enter "public base URL +
/webhook/gitcode". The Secret must be that repository'swebhook_secret(the same value written during hosting; query it through the internal endpoint/internal/repos/{repo_key}/webhook-config). A mismatch returns 403 directly. - On the GitCode webhook details page, select Test → GitCode shows 200 OK.
- Create or comment on an Issue in that repository → the corresponding event appears on the Events page in the Grape console and the Pipeline (Scene) starts. The full chain is working.
Note
If the webhook test returns 403 or fails verification, check whether the Secret on the GitCode side matches the
webhook_secretin that repository's credentials (both sides must be identical).
What success looks like
| If you do this | You should see | Evidence |
|---|---|---|
| Open the login page | The GitCode login entry appears | Button on the login page |
| Log in with GitCode | You reach the Workbench after the callback to /api/auth/callback/gitcode | Browser address bar and the Workbench |
| Bot performs one write | The Issue comment is posted by the Bot identity, not your account | Author in the Issue comment area |

