Skip to main content

An AI-powered code review assistant

Project description

✨ CoriAI 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 human with multiple degrees in Computer Science! 🎓

[Cori Repo]https://github.com/theboringhumane/cori-ai

✨ CoriAI ✨ CoriAI

✨ 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)

Skip Code Review

✨ CoriAI 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-cori: Your message
skip-cori: Your message
no-coriai: Your message
skip-coriai: Your message
cori-no: Your message
cori-bye: Your message
cori-restricted: Your message

# Multiple flags (comma-separated)
no-review,skip-cori: Complex update
skip-review,cori-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: "cori-restricted: Security patch"

# Skip review with multiple flags
title: "no-review,cori-restricted: Confidential update"

# Regular PR (will be reviewed)
title: "feat: Add new feature"

When a review is skipped:

  • ✨ CoriAI 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: theboringhumane/cori-ai@v1.2.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

✨ CoriAI will:

  1. Review your code changes
  2. Add detailed comments
  3. Create a new PR with suggested fixes (coming soon)

This will be a new PR that has the fixes

  1. Link the fix PR to your original PR (coming soon)

This will be a link to the new PR that has the fixes

  1. Create relevant labels for the PR (coming soon)

This will be a list of labels that need to be added to the PR

  1. Create relevant issues for the PR (coming soon)

This will be a list of issues that need to be fixed

  1. Generate a summary of the PR (coming soon)

This will be a summary of the PR and the changes made

  1. 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 cori-ai 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

  1. Store API keys securely in GitHub Secrets
  2. Use repository-specific tokens
  3. Set appropriate permissions in workflow
  4. Review auto-generated fixes before merging

🐛 Troubleshooting

Common Issues

  1. API Key Issues: Ensure the correct API key is set for your chosen provider
  2. Model Availability: Some models might be region-restricted
  3. Rate Limits: Consider using different providers during high load

Provider Status

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 human who created this action (and their PhD committee)

🦦 Support


Made with 💖 by @theboringhumane, PhD in Computer Science, Machine Learning, and Fish Recognition

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

cori_ai-0.1.3.tar.gz (17.8 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

cori_ai-0.1.3-py3-none-any.whl (12.7 kB view details)

Uploaded Python 3

File details

Details for the file cori_ai-0.1.3.tar.gz.

File metadata

  • Download URL: cori_ai-0.1.3.tar.gz
  • Upload date:
  • Size: 17.8 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.0.1 CPython/3.12.2

File hashes

Hashes for cori_ai-0.1.3.tar.gz
Algorithm Hash digest
SHA256 f60da9ec7781ca0b287043632f07bb33a92fda06413f6c95335a405e084618f2
MD5 0bfcb3e7116393ab430a6675c9d99642
BLAKE2b-256 dcb47919a10076923a8b3f4b18997dad9b9418be7ced3c95e07f013b4fd4cbf5

See more details on using hashes here.

File details

Details for the file cori_ai-0.1.3-py3-none-any.whl.

File metadata

  • Download URL: cori_ai-0.1.3-py3-none-any.whl
  • Upload date:
  • Size: 12.7 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.0.1 CPython/3.12.2

File hashes

Hashes for cori_ai-0.1.3-py3-none-any.whl
Algorithm Hash digest
SHA256 350a50413751176cc1b26aacdc3fcbc6895b5ab16aa43772b6f189d849d4358c
MD5 7e75f28f3fb9fdc7bd5014c66dbbde46
BLAKE2b-256 f0d7fef0ccab8a15886eaba117432a363212ac3992ce3977af0729f600819b1c

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page