Skip to content

An intelligent GitHub Pull Request reviewer that automatically analyzes code changes and provides detailed feedback using AI

Notifications You must be signed in to change notification settings

ACM-Thapar/acm-pr-bot

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

1 Commit
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

ACM PR Bot

Automated code review bot for GitHub pull requests using Google Gemini AI.

Overview

This bot automatically reviews pull requests and provides line-by-line feedback on code changes. It integrates with GitHub webhooks and uses Google's Gemini API for intelligent code analysis.

Features

  • Automatic PR review on open/sync events
  • Line-by-line code comments
  • Support for multiple programming languages
  • Webhook signature verification
  • Cloudflare Workers deployment

Tech Stack

  • Runtime: Cloudflare Workers
  • Framework: Hono
  • Language: TypeScript
  • AI: Google Gemini 2.0 Flash
  • Deployment: Wrangler CLI

Project Structure

src/
├── types/           # TypeScript interfaces and types
├── services/        # Business logic services
│   ├── github.ts    # GitHub API integration
│   ├── gemini.ts    # Gemini AI integration
│   └── reviewer.ts  # Code review orchestration
├── utils/           # Utility functions
│   └── webhook.ts   # Webhook verification
└── index.ts         # Main application entry point

Setup

1. Environment Variables

Configure these environment variables in your Cloudflare Workers dashboard or via Wrangler:

wrangler secret put GITHUB_SECRET
wrangler secret put GITHUB_TOKEN
wrangler secret put GEMINI_API_KEY

Or update wrangler.jsonc with your values:

{
  "vars": {
    "GITHUB_ID": "your-github-id",
    "SECRET_CODE": "your-secret-code"
  }
}
  • GITHUB_SECRET: Webhook secret from GitHub repository settings
  • GITHUB_TOKEN: Personal access token with repo permissions
  • GEMINI_API_KEY: Google AI Studio API key

2. GitHub Webhook Configuration

  1. Go to your repository settings
  2. Navigate to Webhooks section
  3. Add webhook with:
    • Payload URL: Your deployed worker URL + /webhook
    • Content type: application/json
    • Secret: Same value as GITHUB_SECRET
    • Events: Select "Pull requests"
    • Active: Checked

3. Deployment

npm install
npm run deploy

Development

npm run dev

API Endpoints

  • GET /health - Health check
  • POST /webhook - GitHub webhook handler

Supported File Types

  • JavaScript/TypeScript (.js, .ts, .jsx, .tsx)
  • Python (.py)
  • Java (.java)
  • Go (.go)
  • Ruby (.rb)
  • PHP (.php)
  • C# (.cs)
  • C/C++ (.c, .cpp)

Future Enhancements

  • Custom review rules configuration
  • Multi-language support expansion
  • Review history tracking
  • Team-specific review templates
  • Integration with issue tracking
  • Performance metrics dashboard
  • Custom AI model selection
  • Review approval workflows

About

An intelligent GitHub Pull Request reviewer that automatically analyzes code changes and provides detailed feedback using AI

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published