An AI-powered GitHub App that automatically reviews Pull Requests — analyzing code changes, detecting potential issues, and posting intelligent feedback comments line by line on the files directly on GitHub.
Built with Node.js, Express, Octokit (GitHub API), and OpenAI GPT.
Whenever a developer opens a new Pull Request (PR):
- GitHub triggers a Webhook event.
- The app receives the event and authenticates as a GitHub App using a JWT.
- It exchanges the JWT for a repo-scoped Installation Access Token.
- The server fetches changed files/diffs from the PR.
- The OpenAI API analyzes the changes and generates review feedback.
- The app posts this AI-generated review as a line by line review comment directly on the PR as review comment 🎯
| Layer | Technology |
|---|---|
| Backend Framework | Node.js + Express |
| Language | TypeScript |
| GitHub Integration | Octokit SDK + GitHub App API |
| AI Model | OpenAI GPT-4o-mini |
| Authentication | JWT (App identity) + Installation Access Token (repo access) |
| Tunnel | Cloudflare Tunnel (for localhost webhook exposure) |
| Environment Management | dotenv |
git clone https://github.com/your-username/ai-pr-coding-assistant.git
cd ai-pr-coding-assistantnpm installPORT=5000
GITHUB_APP_ID=<your_app_id>
GITHUB_WEBHOOK_SECRET=<your_webhook_secret>
GITHUB_PRIVATE_KEY_PATH=./ai-pr-assistant.pem
OPENAI_API_KEY=sk-xxxxnpm run devcloudflared tunnel --url http://localhost:5000Copy the generated public URL and paste it into your GitHub App’s Webhook URL field.
- When a Pull Request is opened or updated, GitHub sends a webhook event to your Express server.
- The server: Verifies the webhook signature (x-hub-signature-256) Authenticates using JWT + installation access token Fetches changed files and diff patches
- The AI reviewer system: Sends each diff chunk to OpenAI Each agent (Security, Performance, Style, Docs) analyzes the diff Comments inline or generates an overall summary
- The assistant posts comments directly on GitHub using Octokit.
- 🧾 GitHub Action integration for CI/CD
- 📊 PR quality scoring (based on AI feedback)
- 💾 Dashboard UI for tracking AI reviews
- 🧩 Caching and retry logic for rate limits
- ⚡ Fine-tuned review agents (custom OpenAI fine-tuning)
Contributions are welcome! Feel free to fork this repo, create a feature branch, and open a PR.

