Creates an agent bot that reviews code to repositories that is has access to if it gets added as code reviewer Co-authored-by: Copilot <copilot@github.com>
1.8 KiB
1.8 KiB
Gitea Bot
This repository contains a Python-based Gitea bot that listens for pull request events and posts an automated review when the bot account is requested as a reviewer. The bot uses a configurable Google AI Studio / Gemini REST endpoint to generate review text.
Files added:
- gitea_bot/main.py - FastAPI webhook server
- gitea_bot/gitea_client.py - minimal Gitea API helper
- gitea_bot/gemini_client.py - wrapper for Google AI Studio REST endpoint
- Dockerfile - container image
- requirements.txt - Python deps
Quick setup
- Build the Docker image:
docker build -t gitea-bot:latest .
- Run the container (example):
docker run -e GITEA_API_URL="https://gitea.example.com/api/v1" \
-e GITEA_TOKEN="${GITEA_TOKEN}" \
-e BOT_USERNAME="your-bot-username" \
-e GOOGLE_AI_ENDPOINT="https://generativelanguage.googleapis.com/v1beta/models/gemini-2.5-flash:generateContent" \
-e GOOGLE_API_KEY="YOUR_KEY" \
-p 8000:8000 gitea-bot:latest
- Configure a webhook in your Gitea repository pointing to
http://<host>:8000/webhookand enable thepull_requestevent. When you request a review from the bot account the service will fetch the PR diff and post a review comment.
Notes & configuration
- Set
GITEA_API_URLto your Gitea API base (usuallyhttps://gitea.example.com/api/v1). - The bot posts a single comment on the PR; for per-line review comments the Gitea API endpoint may differ and needs adjustment in
gitea_client.py. - Configure
GOOGLE_AI_ENDPOINTandGOOGLE_API_KEYto point to your Generative AI Studio model endpoint.
Security
- Keep
GITEA_TOKENandGOOGLE_API_KEYsecret and prefer injecting via environment or secret manager.