Initial commit
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>
This commit is contained in:
40
BOT_README.md
Normal file
40
BOT_README.md
Normal file
@@ -0,0 +1,40 @@
|
||||
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](gitea_bot/main.py#L1) - FastAPI webhook server
|
||||
- [gitea_bot/gitea_client.py](gitea_bot/gitea_client.py#L1) - minimal Gitea API helper
|
||||
- [gitea_bot/gemini_client.py](gitea_bot/gemini_client.py#L1) - wrapper for Google AI Studio REST endpoint
|
||||
- [Dockerfile](Dockerfile) - container image
|
||||
- [requirements.txt](requirements.txt) - Python deps
|
||||
|
||||
Quick setup
|
||||
|
||||
1. Build the Docker image:
|
||||
|
||||
```bash
|
||||
docker build -t gitea-bot:latest .
|
||||
```
|
||||
|
||||
2. Run the container (example):
|
||||
|
||||
```bash
|
||||
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
|
||||
```
|
||||
|
||||
3. Configure a webhook in your Gitea repository pointing to `http://<host>:8000/webhook` and enable the `pull_request` event. 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_URL` to your Gitea API base (usually `https://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_ENDPOINT` and `GOOGLE_API_KEY` to point to your Generative AI Studio model endpoint.
|
||||
|
||||
Security
|
||||
- Keep `GITEA_TOKEN` and `GOOGLE_API_KEY` secret and prefer injecting via environment or secret manager.
|
||||
Reference in New Issue
Block a user