rubenvanerk/ai-reviewer
Context-aware AI reviewer for Pull Requests. Instant summary, line-by-line comments, title generation and more
Optimize your code review process with Presubmit's AI Code Reviewer that catches bugs, suggests improvements, and provides meaningful summary - all before human reviewers take their first look.
- 🔍 Instant, In-depth PR Analysis: Catches bugs, security issues, and optimization opportunities in real-time
- 🎯 Focus on What Matters: Let AI handle the basics while humans focus on architecture and complex logic
- ✨ Title and description generation: Save time by having the AI generate meaningful title and description for your PR
- 💬 Interactive & Smart: Responds to questions and generates code suggestions right in your PR
- ⚡ Lightning-Fast Setup: Up and running in 2 minutes with GitHub Actions
🤝 Note: Presubmit is designed to complement human reviewers, not replace them. It helps catch security issues and bugs early on while also providing context about the overall change, making the human review process more efficient.
See it in Action
Automated analysis detects potential issues and provides actionable insights:
Interactive discussions help clarify implementation details:
Usage
Step 1: Add LLM_API_KEY secret
- Go to your repository's Settings > Secrets and Variables > Actions
- Click "New repository secret"
- Add a new secret with:
- Name:
LLM_API_KEY - Value: Your API key from one of these providers:
- Anthropic Console (Claude)
- OpenAI API (GPT-4)
- Google AI Studio (Gemini)
- Name:
Step 2: Create GitHub Workflow
Add this GitHub Action to your repository by creating .github/workflows/presubmit.yml:
name: Presubmit.ai
permissions:
contents: read
pull-requests: write
issues: write
on:
pull_request_target:
types: [opened, synchronize]
pull_request_review_comment:
types: [created]
jobs:
review:
runs-on: ubuntu-latest
steps:
- name: Check required secrets
run: |
if [ -z "${{ secrets.LLM_API_KEY }}" ]; then
echo "Error: LLM_API_KEY secret is not configured"
exit 1
fi
- uses: presubmit/ai-reviewer@latest
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
LLM_API_KEY: ${{ secrets.LLM_API_KEY }}
LLM_MODEL: "claude-sonnet-4-5"The action requires:
GITHUB_TOKEN: Automatically provided by GitHub ActionsLLM_API_KEY: Your API key (added in step 1)LLM_MODEL: Which LLM model to use. Make sure the model is supported and matches theLLM_API_KEY.
GitHub Enterprise Server Support
If you're using GitHub Enterprise Server, you can configure the action to work with your instance by adding these environment variables:
- uses: presubmit/ai-reviewer@latest
env:
GITHUB_API_URL: "https://github.example.com/api/v3"
GITHUB_SERVER_URL: "https://github.example.com"You can also configure these settings using input parameters:
- uses: presubmit/ai-reviewer@latest
with:
github_api_url: "https://github.example.com/api/v3"
github_server_url: "https://github.example.com"Make sure to replace https://github.example.com with your actual GitHub Enterprise Server URL.
Features
🤖 Smart Reviews
- In-depth Analysis: Line-by-line review with context-aware suggestions
- Auto PR Summary: Concise, meaningful summaries of changes
- Code Quality: Catches bugs, anti-patterns, and style issues
- Interactive: Responds to questions and clarifications in comments
🛡️ Security & Quality
- Vulnerability Detection: Catches security issues and leaked
secrets - Best Practices: Enforces coding standards and security
guidelines - Performance: Identifies potential bottlenecks and optimizations
- Documentation: Ensures proper code documentation and clarity
⚙️ Configurable
- Mention
@presubmitin PR title for auto-generation - Disable reviews with
@presubmit ignorecomment - Configurable review depth and focus areas
- Customizable rules and preferences
⚡ Seamless Integration
- 2-minute setup with GitHub Actions
- Works with all major LLM providers (Claude, GPT-4, Gemini)
- Instant feedback on every PR
- Zero maintenance required
Local CLI (Dry-Run) Testing
Run the reviewer locally against real PRs using your GitHub authentication.
Prerequisites
- Node.js 18+
- GitHub CLI authenticated:
gh auth login .envfile at repo root with:LLM_API_KEY=...(your API key)LLM_MODEL=...(e.g.,claude-3-5-sonnet-20241022,gpt-4o-mini)- Optional:
LLM_PROVIDER=ai-sdk(default)
Build
pnpm install
pnpm buildCommands
List PRs:
pnpm review -- --list-prs --state open --limit 5Review a PR (dry-run):
pnpm review -- --pr 123 --dry-runSave output to file:
# Auto-generates filename: dry/pr-123.txt
pnpm review -- --pr 123 --dry-run --out
# Custom output path
pnpm review -- --pr 123 --dry-run --out my-review.txtSpecify repository:
pnpm review -- --pr 123 --owner myorg --repo myrepo --dry-runOr set in .env:
GITHUB_REPOSITORY=myorg/myrepoNotes
- Uses your
gh auth tokenautomatically --dry-runmode skips all GitHub API writes and logs what would be posted- Without
--dry-run, the review will be posted to GitHub - Defaults to repository from
GITHUB_REPOSITORYenv var orpresubmit/ai-reviewer
Show Your Support! ⭐
If you find Presubmit helpful in improving the review process:
- Star this repository to show your support and help others discover it
- Share your experience by creating a GitHub Issue
- Follow me on X/Twitter for updates
- Consider contributing to make it even better