feat(ci): replace opencode review with PR-Agent
PR Check / Security scan (Snyk) (pull_request) Skipped
PR Check / Lint + typecheck (pull_request) Canceled after 45s
PR Check / Secret scan (gitleaks) (pull_request) Canceled after 0s
PR Check / Dependency audit (pull_request) Canceled after 0s
PR Check / Dockerfile lint (droast) (pull_request) Canceled after 0s

Run PR-Agent as a pinned webhook server on the Gitea Docker network and review on PR open plus slash commands. The per-PR opencode installer and verdict-posting step are removed.

The server-side .env stays outside the repository; deploy/pr-agent/ holds the compose definition and operator notes.
This commit is contained in:
Noel Sabia committed 2026-10-30 21:00:53 +01:00
1 parent 9ecf504843
commit c626cc9c1d
11 files changed
+251 -236

No files matched your search

+53
View File
@@ -0,0 +1,53 @@
# PR-Agent for Gitea
PR-Agent runs as a webhook server next to Gitea on `server0`. Gitea sends
pull-request and comment events over the `gitea_gitea` Docker network; the
endpoint is not published to the internet.
| Piece | Value |
|---|---|
| Image | `pragent/pr-agent:0.49.0-gitea_app` |
| Container | `pr-agent` |
| Webhook URL, from Gitea | `http://pr-agent:3000/api/v1/gitea_webhooks` |
| Config | `/home/noel/self-hosted/pr-agent/.env` (mode 600) |
| Logs | `docker logs -f pr-agent` |
| Upgrade | bump the image tag, then `docker compose up -d` in this directory |
## Gitea side
1. The bot user `pr-agent` is a collaborator on `CV_Website/CV_Site_Nuxt` with
write permission. Its personal access token is scoped to
`read:repository`, `write:issue` and `read:user`.
2. The repository webhook sends `push`, `issues`, `pull_request` and
`issue_comment` events, with JSON content type and the shared secret.
3. Gitea's `[webhook] ALLOWED_HOST_LIST` includes `private:3000`. Without it,
Gitea's default egress policy refuses webhook deliveries to private
addresses, including the Docker network.
## AI model
The agent uses OpenCode Go's OpenAI-compatible endpoint:
```text
model openai/glm-5.3-flash
fallback openai/glm-5.3
api base https://opencode.ai/inference/go/openai/v1
```
`CONFIG__CUSTOM_MODEL_MAX_TOKENS` tells PR-Agent the context limit, because
the model is not in its token table. The effective review budget is still
capped by PR-Agent's default `config.max_model_tokens` of 32000.
## First check
Open a pull request in `CV_Website/CV_Site_Nuxt`. The server runs `/describe`
and `/review` on open/reopen; comment commands such as `/review`, `/improve`
and `/ask` are handled from the PR conversation. If nothing appears:
```sh
docker compose logs --tail=100 pr-agent
```
A `403` in the Gitea webhook delivery log means the secret does not match or
`ALLOWED_HOST_LIST` is still missing; a `401` from PR-Agent means the
signature header and secret disagree.