Skip to content

mattsavarino/ai-code-review

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

7 Commits
 
 
 
 
 
 
 
 

Repository files navigation

AI Code Review

  • Automatically generate an AI code review on every PR.
  • Easily customize the AI prompt as needed.
  • Works with both Azure OpenAI or OpenAI APIs.
  • Add to any GitHub repo with only 3 files.
  • View Sample AI Code Review

Solution Files

  1. ai_code_review.yml
    GitHub Actions file triggered upon pull request.

  2. ai_code_review.py
    Python script to generate AI code review.

  3. requirements.txt
    Python package dependencies (only openai and requests).

How to Use

  1. Open or create a GitHub repo.
  2. Confirm or create the .github/workflows/ directory.
  3. Add 3 files from this repo to your project.
  4. Choose your AI provider:
    • Azure OpenAI is highly recommended for private and enterprise use.
    • OpenAI is for public repos or when you give training consent.
  5. Update your GitHub repo settings:
    1. Browse to Repo > Settings > Security and variables > Actions
    2. Add action secrets:
      • OPENAI_API_KEY
      • AZURE_OPENAI_ENDPOINT
      • AZURE_OPENAI_API_KEY
      • AZURE_OPENAI_API_VERSION (optional, default 2024-02-15-preview)
      • OPENAI_MODEL_NAME (optional, default gpt-4, or Azure deployment name)
      • Learn more about encrypted secrets
  6. Create new branch, push changes, and create new PR.
  7. Improve your code based on the automated AI feedback.
    • Comment with AI code review posted on PR.
    • workflow.log created within each action run.

About

AI Code Review with GitHub Actions

Topics

Resources

License

Stars

Watchers

Forks