- Notifications
You must be signed in to change notification settings - Fork0
Advanced AI-powered code reviews with multiple model support
License
dock-hq/ai-codereviewer
Folders and files
| Name | Name | Last commit message | Last commit date | |
|---|---|---|---|---|
Repository files navigation
AI Code Reviewer is a GitHub Action that leverages multiple AI providers (OpenAI, Anthropic, Google) to provide intelligent feedback and suggestions on your pull requests. This powerful tool helps improve code quality and saves developers time by automating the code review process.
- Supports multiple AI providers:
- OpenAI (ChatGPT)
- Anthropic (Claude)
- Google (Gemini)
- Provides intelligent comments and suggestions for improving your code
- Reviews only new changes in PR updates
- Filters out files that match specified exclude patterns
- Easy to set up and integrate into your GitHub workflow
Choose your preferred AI provider and get an API key:
Add the API key as a GitHub Secret in your repository:
OPENAI_API_KEYfor OpenAIANTHROPIC_API_KEYfor ClaudeGOOGLE_AI_KEYfor Google Gemini
Create
.github/workflows/code-review.yml:
name:AI Code Reviewon:pull_request:types:[opened, synchronize]permissions:write-alljobs:review:runs-on:ubuntu-lateststeps: -uses:actions/checkout@v4 -name:AI Code Reviewuses:your-username/ai-code-reviewer@mainwith:GITHUB_TOKEN:${{ secrets.GITHUB_TOKEN }}# Choose your AI provider and keyAI_PROVIDER:"openai"# or "anthropic" or "google"AI_API_KEY:${{ secrets.OPENAI_API_KEY }}AI_MODEL:"gpt-4o-mini"AI_TEMPERATURE:0.3# 0 to 1 - higher values = more creativity and variance# Optional configurationsAPPROVE_REVIEWS:trueMAX_COMMENTS:10# 0 to disablePROJECT_CONTEXT:"This is a Node.js TypeScript project"CONTEXT_FILES:"package.json,README.md"EXCLUDE_PATTERNS:"**/*.lock,**/*.json,**/*.md"
| Input | Description | Default |
|---|---|---|
AI_PROVIDER | AI provider to use (openai,anthropic,google) | openai |
AI_API_KEY | API key for chosen provider | Required |
AI_MODEL | Model to use (see supported models below) | Provider's default |
AI_TEMPERATURE | Temperature for AI model | 0 |
APPROVE_REVIEWS | Whether to approve PRs automatically | true |
MAX_COMMENTS | Maximum number of review comments | 0 |
PROJECT_CONTEXT | Project context for better reviews | "" |
CONTEXT_FILES | Files to include in review (comma-separated) | "package.json,README.md" |
EXCLUDE_PATTERNS | Files to exclude (glob patterns, comma-separated) | "**/*.lock,**/*.json,**/*.md" |
All models supported by the provider should be supported.
# Install dependenciesyarn install# Build TypeScript filesyarn build# Run unit testsyarntest# Package for distributionyarn package# Generate test PR payload (for e2e testing)yarn generate-pr<owner><repo><pr_number># Run end-to-end testsyarn test:e2e<repo><pr_number>
To test the action locally:
- Create a
.envfile with your credentials:
GITHUB_TOKEN=your_github_tokenAI_PROVIDER=openai# or anthropic, googleAI_API_KEY=your_api_keyAI_MODEL=your_preferred_model
- Generate a test PR payload:
yarn generate-pr your-org your-repo 123
- Run the e2e test:
yarn test:e2e your-repo 123
Note: Make sure you have write access to the repository you're testing with.
Contributions are welcome! Please feel free to submit issues or pull requests.
MIT License - seeLICENSE for details.
About
Advanced AI-powered code reviews with multiple model support
Resources
License
Uh oh!
There was an error while loading.Please reload this page.
Stars
Watchers
Forks
Releases
Packages0
Languages
- TypeScript88.3%
- JavaScript11.7%