Automated GitHub Pull Request code review bot powered by Google Gemini.
This webhook intelligently analyzes PR changes and comments on code style, potential refactoring, and best practices — using an LLM context-driven approach inspired by MCP (Model Context Protocol) patterns.
- 🔍 Code Diff Analysis – Parses PR diffs to understand file changes
- 🤖 Gemini AI Integration – Uses Google's Gemini model to generate intelligent code reviews
- 🧠 Suggests Improvements – Code refactoring tips, lint issues, and mitigation suggestions
- 🧵 Autocomments on PR – Posts feedback as comments on the PR automatically
- 🔌 GitHub Webhook Friendly – Easily pluggable into any GitHub repo
- ♻️ Inspired by Agentic AI patterns and future MCP-style orchestration
- Node.js + Express
- Google Gemini API (via REST)
- GitHub REST API
serverless-http
+ Vercel compatible- dotenv + body-parser
- GitHub triggers webhook when a Pull Request is opened/updated
- Bot parses the changed files
- Sends file diffs as prompts to Gemini
- Receives code review suggestions
- Posts review comments back on the PR
webhook URL : https://pr-reviewer-bot.vercel.app/webhook
- Go to your GitHub repository
- Navigate to Settings → Webhooks → Add webhook
- Fill the fields:
Field | Value |
---|---|
Payload URL | https://pr-reviewer-bot.vercel.app/webhook |
Content type | application/json |
Secret | Your GITHUB_APP_SECRET |
Events to trigger | ✅ Pull requests |
NOTE : to add GITHUB_APP_SECRET contact me on mail : Contact
- Click Add Webhook
Now, when a contributor opens or updates a PR, the bot will:
- Read the diff
- Ask Gemini to review it
- Post feedback as comments
curl -X POST [https://pr-reviewer-bot.vercel.app/webhook](https://pr-reviewer-bot.vercel.app/webhook) \
-H "Content-Type: application/json" \
-H "X-Hub-Signature-256: sha256=<signature>" \
-d @mock-pr-payload.json
.
├── src/
│ ├── github.ts # GitHub API logic
│ ├── gemini.ts # Gemini API integration
│ └── verifySignature.ts # Signature validation
│ └── app.ts # Main app logic
└── .env
This bot is modeled after the Agentic AI pattern, with future compatibility for Anthropic’s Model Context Protocol (MCP).
It lays the foundation for context-rich, multi-step, tool-integrated AI workflows.
Want to add:
- Claude or GPT support?
- Custom review templates?
- Feedback loop with AI self-evaluation?
Feel free to open an issue or PR!
MIT
Built with ❤️ by @tamojit-123