π€ Intelligent pull request analysis, review, and auto-approval using Claude AI
Transform your pull request workflow with AI-powered automation that provides intelligent code reviews, generates comprehensive descriptions, and safely auto-approves quality changes.
- π Catch Issues Early - AI reviews every line for bugs, security issues, and best practices
- π Auto-Generate Descriptions - Never write PR descriptions again
- β‘ Speed Up Reviews - Auto-approve safe changes, focus human review on what matters
- π‘οΈ Security First - Built-in security analysis and safe auto-approval logic
License Notice: Modified version of PR-Agent by Codium AI, licensed under AGPL v3. Source code available here.
| Feature | Description | Benefits |
|---|---|---|
| π€ Auto Review | Comprehensive code analysis with security scanning | Catch bugs, security issues, and code quality problems |
| π Auto Description | AI-generated PR titles, summaries, and labels | Save time, improve PR documentation |
| π‘ Code Suggestions | Specific improvements and best practices | Learn better coding patterns, optimize performance |
| β Auto Approval | Safe approval of low-risk changes | Speed up workflow, focus reviews on complex changes |
| π― Smart Triggers | Flexible activation via PR events or manual commands | Control when and how the bot runs |
| π Repository Rules | Respects official Cursor rules files in your repository | Follows your project's coding standards automatically |
name: AI PR Bot
on:
pull_request:
types: [opened, reopened, ready_for_review, synchronize]
jobs:
ai-pr-bot:
runs-on: ubuntu-latest
steps:
- uses: jacsamell/github-pr-bot@v1
with:
anthropic_api_key: ${{ secrets.ANTHROPIC_API_KEY }}
auto_review: true
auto_describe: true
enable_auto_approval: falsename: AI PR Bot
on:
pull_request:
types: [opened, reopened, ready_for_review, synchronize]
jobs:
ai-pr-bot:
runs-on: ubuntu-latest
steps:
- uses: jacsamell/github-pr-bot@v1
with:
anthropic_api_key: ${{ secrets.ANTHROPIC_API_KEY }}
github_token: ${{ secrets.GITHUB_TOKEN }}
auto_review: true
auto_describe: true
auto_improve: true
enable_auto_approval: true
model: 'anthropic/claude-sonnet-4-20250514'
max_model_tokens: '1000000'
require_trigger: false1. Get Your Anthropic API Key
- Visit Anthropic Console
- Create an account and generate an API key
- Make sure you have Claude API access
2. Add Secret to GitHub
- Go to your repository β Settings β Secrets and variables β Actions
- Click "New repository secret"
- Name:
ANTHROPIC_API_KEY - Value: Your API key from step 1
| Secret | Description | Required |
|---|---|---|
ANTHROPIC_API_KEY |
Your Claude API key from Anthropic | β Yes |
| Input | Description | Required | Default |
|---|---|---|---|
anthropic_api_key |
Anthropic API key for Claude AI | β Yes | - |
github_token |
GitHub token for API access | β No | ${{ github.token }} |
auto_review |
Enable automatic code review | β No | true |
auto_describe |
Enable automatic PR description generation | β No | true |
auto_improve |
Enable code improvement suggestions | β No | true |
enable_auto_approval |
Enable automatic approval of safe changes | β No | false |
model |
AI model to use | β No | anthropic/claude-sonnet-4-20250514 |
max_model_tokens |
Maximum tokens for AI model | β No | 1000000 |
require_trigger |
Require ##prbot trigger in PR description | β No | false |
| Output | Description |
|---|---|
review_posted |
Whether a review was posted |
description_updated |
Whether PR description was updated |
improvements_posted |
Whether improvement suggestions were posted |
auto_approved |
Whether PR was automatically approved |
Create .pr_bot.toml:
[config]
model = "anthropic/claude-sonnet-4-20250514"
enable_auto_approval = true
max_model_tokens = 1000000
use_cursor_rules = true # Enable Cursor rules (default: true)
[github_action_config]
require_aidesc_trigger = true # Requires ##prbot in PR description
auto_describe = true
auto_review = true
auto_improve = trueThe bot automatically detects and respects official Cursor rules in your repository, ensuring AI reviews follow your project's specific coding standards.
The bot looks for these official Cursor rules files:
Current Format (Recommended):
.cursor/rules/*.mdc- Modern Cursor project rules files
Legacy Format (Deprecated but supported):
.cursorrules- Legacy Cursor rules file
Create .cursor/rules/style.mdc in your repository:
---
description: Code style and formatting rules
alwaysApply: true
---
# Project Coding Rules
## Code Style
- Use 2 spaces for indentation
- Prefer const over let when possible
- Always use semicolons
- Use single quotes for strings
## Naming Conventions
- Use camelCase for variables and functions
- Use PascalCase for classes and components
- Use UPPER_SNAKE_CASE for constants
## Patterns to Avoid
- Don't use console.log in production code
- Avoid nested ternary operators
- Never commit commented-out code
## Preferred Patterns
- Use TypeScript strict mode
- Prefer async/await over promises.then()
- Use destructuring for object propertiesThe bot will automatically include these rules in its analysis, ensuring consistent code reviews that match your project's standards.
By default, up to 10% of the model context (capped at 100k tokens) is allocated to Cursor rules. On 1M-context models, this allows up to 100k tokens of rules to be included.
- Runs on all PRs (default)
- Or add
##prbotto PR description ifrequire_aidesc_trigger = true
/review- Get code review/describe- Generate PR description/improve- Get code suggestions
The bot uses intelligent criteria to safely auto-approve low-risk changes:
- Documentation updates and README changes
- Test additions and improvements
- Minor refactoring and code cleanup
- Configuration file updates
- Dependency updates (non-breaking)
- Critical business logic changes
- Security-related code modifications
- Database schema changes
- API contract modifications
- Complex algorithmic changes
Safety First: The bot errs on the side of caution - when in doubt, it requests human review.
- API Keys: Your Anthropic API key is securely handled through GitHub Secrets
- Code Privacy: Code is only sent to Anthropic's Claude API for analysis
- No Storage: No code or data is permanently stored by this action
- Permissions: Only requires standard GitHub token permissions for PR operations
Contributions are welcome! This project is based on PR-Agent and maintains AGPL v3 licensing.
- Fork the repository
- Create a feature branch
- Make your changes
- Add tests if applicable
- Submit a pull request
This project is licensed under AGPL v3 - see the LICENSE file for details.
Based on PR-Agent by Codium AI.
- π Documentation
- π Report Issues
- π¬ Discussions
# Install dependencies
pip install -r requirements.txt
# Set environment variables
export ANTHROPIC__KEY="your-api-key"
export GITHUB_TOKEN="your-github-token"
# Run on a specific PR
python -m pr_agent.cli --pr_url=https://github.com/owner/repo/pull/123 review