An AI-powered code review assistant
Project description
🦦 Dr. OtterAI Code Review, PhD
🤖 A GitHub Action that provides AI-powered code reviews for your pull requests using multiple LLM providers. Created by a very smart otter with multiple degrees in Computer Science! 🎓
✨ Features
- 🔍 Automated code review comments on pull requests
- 🧠 Multiple LLM providers support (OpenAI, Gemini, Groq, Mistral)
- 🔌 Custom API endpoint support
- 💬 Customizable review focus
- 📝 Line-specific comments on code changes
- 🤖 Auto-fix suggestions with new PRs
- 🎯 Project-specific guidelines
- 🚫 Skip review functionality with special PR titles or descriptions
🛠️ How to Use
1. Skip Code Review (Optional)
Dr. OtterAI can automatically skip reviews based on certain patterns in your PR title or description. Here's how to use it:
🎯 Skip Patterns
You can use any of these patterns (case-insensitive):
# Using hyphens
no-review: Your message
skip-review: Your message
no-otter: Your message
skip-otter: Your message
no-otterai: Your message
otter-no: Your message
otter-bye: Your message
otter-restricted: Your message
# Multiple flags (comma-separated)
no-review,skip-otter: Complex update
skip-review,otter-restricted: Sensitive change
🔄 Automatic Skip Conditions
Reviews are automatically skipped when:
- 🏷️ PR title contains any of the skip patterns
- 📝 PR description contains any of the skip patterns
- 🔒 PR state is 'merged' or 'closed'
📋 Example Usage
# Skip review for documentation updates
title: "no-review: Update README.md"
# Skip review for sensitive changes
title: "otter-restricted: Security patch"
# Skip review with multiple flags
title: "no-review,otter-restricted: Confidential update"
# Regular PR (will be reviewed)
title: "feat: Add new feature"
When a review is skipped:
- 🦦 Dr. OtterAI will leave a comment notifying the PR author
- ⏭️ No code review will be performed
- 🚫 Dependencies won't be installed
2. Set up Secrets
First, add the API key for your preferred LLM provider:
OpenAI (Default)
OPENAI_API_KEY=your-openai-key
Google Gemini
GOOGLE_API_KEY=your-gemini-key
Groq
GROQ_API_KEY=your-groq-key
Mistral
MISTRAL_API_KEY=your-mistral-key
3. Create Workflow File
Create .github/workflows/code-review.yml with:
name: AI Code Review
on:
pull_request:
types: [opened, synchronize]
jobs:
review:
runs-on: ubuntu-latest
permissions:
contents: read
pull-requests: write
steps:
- uses: actions/checkout@v4
- name: AI Code Review
uses: fofsinx/otterai@v1.0.0
with:
# Choose your preferred provider
provider: 'openai' # or 'gemini', 'groq', 'mistral'
# Provider-specific settings
openai_api_key: ${{ secrets.OPENAI_API_KEY }}
# or
# google_api_key: ${{ secrets.GOOGLE_API_KEY }}
# or
# groq_api_key: ${{ secrets.GROQ_API_KEY }}
# or
# mistral_api_key: ${{ secrets.MISTRAL_API_KEY }}
github_token: ${{ secrets.GITHUB_TOKEN }}
4. Provider-Specific Configurations
OpenAI
with:
provider: 'openai'
openai_api_key: ${{ secrets.OPENAI_API_KEY }}
model: 'gpt-4-turbo-preview' # Optional, default model
openai_base_url: 'https://api.openai.com/v1' # Optional, for custom endpoints
Google Gemini
with:
provider: 'gemini'
google_api_key: ${{ secrets.GOOGLE_API_KEY }}
model: 'gemini-1.5-flash' # Optional, default model
Groq
with:
provider: 'groq'
groq_api_key: ${{ secrets.GROQ_API_KEY }}
model: 'mixtral-8x7b-32768' # Optional, default model
Mistral
with:
provider: 'mistral'
mistral_api_key: ${{ secrets.MISTRAL_API_KEY }}
model: 'mistral-large-latest' # Optional, default model
5. Customize Review Focus (Optional)
Add specific focus areas for the review:
with:
# ... provider settings ...
extra_prompt: |
Focus on:
- Security best practices
- Performance optimizations
- Code maintainability
6. Auto-Fix Feature
Dr. OtterAI will:
- Review your code changes
- Add detailed comments
- Create a new PR with suggested fixes (coming soon)
This will be a new PR that has the fixes
- Link the fix PR to your original PR (coming soon)
This will be a link to the new PR that has the fixes
- Create relevant labels for the PR (coming soon)
This will be a list of labels that need to be added to the PR
- Create relevant issues for the PR (coming soon)
This will be a list of issues that need to be fixed
- Generate a summary of the PR (coming soon)
This will be a summary of the PR and the changes made
- Generate feature guide for the PR (coming soon)
This will be a guide for the developer to understand the feature and how to build it otter will suggest the best way to build the feature and the best practices to follow
🎓 Default Models by Provider
| Provider | Default Model | Alternative Options |
|---|---|---|
| OpenAI | gpt-4-turbo-preview | gpt-4, gpt-3.5-turbo |
| Gemini | gemini-1.5-flash | gemini-1.5-pro |
| Groq | mixtral-8x7b-32768 | llama2-70b-4096 |
| Mistral | mistral-large-latest | mistral-medium, mistral-small |
🔒 Security Best Practices
- Store API keys securely in GitHub Secrets
- Use repository-specific tokens
- Set appropriate permissions in workflow
- Review auto-generated fixes before merging
🐛 Troubleshooting
Common Issues
- API Key Issues: Ensure the correct API key is set for your chosen provider
- Model Availability: Some models might be region-restricted
- Rate Limits: Consider using different providers during high load
Provider Status
- OpenAI: status.openai.com
- Gemini: status.generativeai.google
- Groq: status.groq.com
- Mistral: status.mistral.ai
License
This project is licensed under the MIT License - see the LICENSE file for details.
🙏 Acknowledgments
- Thanks to all LLM providers for their amazing models
- Thanks to GitHub for their platform
- Thanks to the otter who created this action (and their PhD committee)
🦦 Support
- 📧 Email: thehuman@boring.name
- 🐙 GitHub Issues: Create an issue
- 🦦 Otter Signal: splashes water playfully
Made with 💖 by Dr. OtterAI, PhD in Computer Science, Machine Learning, and Fish Recognition
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file cori_ai-0.1.0.tar.gz.
File metadata
- Download URL: cori_ai-0.1.0.tar.gz
- Upload date:
- Size: 17.7 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.0.1 CPython/3.12.2
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
1539e1290bb319c9db2c39c8167df7c4d563b3f65a70df0739f96fe6a7652cc2
|
|
| MD5 |
5a4873a5b302ab92ac75b57ab5f63e2c
|
|
| BLAKE2b-256 |
e5e28593becb11012f415580b9b4277d09883c80c76879245337cc03d8ebdb66
|
File details
Details for the file cori_ai-0.1.0-py3-none-any.whl.
File metadata
- Download URL: cori_ai-0.1.0-py3-none-any.whl
- Upload date:
- Size: 12.4 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.0.1 CPython/3.12.2
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
adeb6edfe4f3d25079c82cc983c87f20af72e1a1ce63c8c0de000c873d93af5b
|
|
| MD5 |
4b94f3524c193ec674d08c54ecd5aae6
|
|
| BLAKE2b-256 |
7c50818c2b5fb8c7e89e7d3aae757003506ed0cb90169dc2fb0fd2c48e842a8d
|