Hey dev.to community!
I’m excited to announce that I’ve open-sourced AI-Powered Code Review Action – a GitHub Action that leverages state-of-the-art AI models like Gemini and OpenAI GPT-4 to automate your pull request code reviews.
Key Features
- 🔌 Pluggable Architecture: Easily add new/experimental AI providers.
- 🎯 Smart Filtering: Select files for review using flexible include/exclude glob patterns.
- 📦 Chunking Support: Handles large diffs by splitting them into chunks.
- 🎨 Customizable Rules: Add your own review rules and priorities.
- 💰 Cost Tracking: Monitor token usage and estimated API costs.
- 🔒 Secure: API keys are never logged; only diffs are sent to AI providers.
- 📊 Detailed Reports: In-depth review statistics and reporting.
Current Provider Support
Provider | Status | Model | Notes |
---|---|---|---|
Gemini | ✅ Ready | gemini-1.5-flash | Fast, latest from Google |
OpenAI | ✅ Ready | gpt-4-turbo-preview | High quality, higher cost |
HuggingFace | 🚧 Soon | Various | Open source models planned |
Quick Start
Create a new workflow at .github/workflows/ai-code-review.yml
:
name: AI-Powered Code Review
on:
pull_request:
types: [opened, synchronize]
permissions:
issues: write
pull-requests: write
contents: read
jobs:
ai-review:
runs-on: ubuntu-latest
steps:
- name: AI-Powered Code Review
uses: legiaquan/code-review-action@v1.0.1
with:
provider: 'gemini'
api_key: ${{ secrets.GEMINI_API_KEY }}
pr_number: ${{ github.event.pull_request.number }}
Easily configurable for more advanced usage!
How to Contribute 🚀
This is an early-stage project and all contributions are very welcome!
You can help by:
- Adding support for new AI models/providers (open source or SaaS)
- Improving tests and CI/CD
- Suggesting or refining review rules
- Fixing bugs, enhancing performance
- Improving documentation, examples, and usability
👉 See the CONTRIBUTING.md for more details
👉 The code is written in TypeScript.
Example
👉 See the live example review by the bot on a demo PR: #21
Final thoughts
If you’re interested in AI-powered dev tools and automation, please star the repository, try integrating it with your projects, and especially send your pull requests and suggestions.
Thank you for reading and happy contributing!