aweiker 582ebf7ff6
CI / test (push) Successful in 13s
CI / review (gpt-5, sonnet, SONNET_REVIEW_TOKEN) (push) Has been skipped
CI / review (gpt-5-mini, gpt, GPT_REVIEW_TOKEN) (push) Has been skipped
Merge pull request 'ci: add release workflow + install script' (#2) from ci/release-workflow into main
Reviewed-on: #2
2026-05-01 19:24:15 +00:00

review-bot

Automated code review bot for Gitea. Fetches a pull request diff, sends it to an LLM for analysis, and posts a structured review back to the PR.

Features

  • Fetches PR metadata, diff, and CI status from Gitea API
  • Sends context-rich prompts to any OpenAI-compatible LLM
  • Parses structured JSON review responses
  • Posts formatted reviews (APPROVE / REQUEST_CHANGES) back to Gitea
  • Supports custom coding conventions via repo files
  • Zero external dependencies — Go stdlib only

Usage

review-bot \
  --gitea-url https://gitea.example.com \
  --repo owner/name \
  --pr 42 \
  --reviewer-token "$GITEA_TOKEN" \
  --llm-base-url https://api.openai.com/v1 \
  --llm-api-key "$OPENAI_API_KEY" \
  --llm-model gpt-4 \
  --reviewer-name "Sonnet" \
  --conventions-file CONVENTIONS.md \
  --dry-run

Environment Variables

All flags can be set via environment variables:

Flag Env Var Required Description
--gitea-url GITEA_URL Yes Gitea instance base URL
--repo GITEA_REPO Yes Repository in owner/name format
--pr PR_NUMBER Yes Pull request number
--reviewer-token REVIEWER_TOKEN Yes Gitea API token for posting reviews
--llm-base-url LLM_BASE_URL Yes OpenAI-compatible API base URL
--llm-api-key LLM_API_KEY Yes LLM API key
--llm-model LLM_MODEL Yes Model identifier
--reviewer-name REVIEWER_NAME No Display name in review footer
--conventions-file CONVENTIONS_FILE No Path to conventions file in repo
--dry-run No Print review to stdout instead of posting

Adding to a Gitea Repository

  1. Build the binary or use the CI workflow approach (build in CI).

  2. Add secrets to your Gitea repo (Settings → Actions → Secrets):

    • SONNET_REVIEW_TOKEN — Gitea token for the Sonnet reviewer account
    • GPT_REVIEW_TOKEN — Gitea token for the GPT reviewer account
    • LLM_BASE_URL — Your LLM API endpoint
    • LLM_API_KEY — Your LLM API key
  3. Copy .gitea/workflows/ci.yml to your repo (or adapt it).

  4. On every PR, the bot will:

    • Run tests and vet
    • Build review-bot
    • Post reviews from each configured LLM reviewer

Development

# Run tests
go test ./...

# Run vet
go vet ./...

# Build
go build -o review-bot ./cmd/review-bot

# Integration tests (requires env vars)
go test -tags=integration ./...

Architecture

cmd/review-bot/     CLI entrypoint
gitea/              Gitea API client
llm/                OpenAI-compatible LLM client
review/             Prompt building, response parsing, formatting

License

MIT

S
Description
AI-powered code review bot for Gitea pull requests
Readme 4.5 MiB
v0.4.0 Latest
2026-05-15 13:05:19 +00:00
Languages
Go 99.1%
Shell 0.8%