genai-code-review  by cirolini

GitHub Action for automated code review using GPT

created 2 years ago
359 stars

Top 79.1% on sourcepulse

GitHubView on GitHub
Project Summary

This project provides an automated code review solution for GitHub Pull Requests using OpenAI's GPT models. It's designed for developers and teams seeking to enhance code quality and consistency by leveraging AI for feedback on code changes.

How It Works

The action integrates with GitHub Actions to process pull requests. Upon a pull_request event (opened or synchronized), it authenticates with OpenAI using a provided API key and GitHub using the GITHUB_TOKEN. It can operate in two modes: files (analyzing changed files) or patch (analyzing diffs). For each relevant code segment, it sends the code to a specified GPT model (defaulting to gpt-3.5-turbo) with an optional custom prompt, then posts the AI's review as a comment on the pull request.

Quick Start & Requirements

  • Install/Run: Use the action directly in a GitHub Actions workflow: uses: cirolini/genai-code-review@v2.
  • Prerequisites:
    • OpenAI API Key (stored as openai_api_key GitHub secret).
    • GitHub repository with appropriate permissions for Actions to write comments.
  • Setup: Requires creating a GitHub secret and a .github/workflows/chatgpt-review.yaml file.
  • Docs: Workflow configuration details are provided in the README.

Highlighted Details

  • Supports configurable OpenAI models (gpt-4o, gpt-4-turbo, etc.) and parameters like temperature and max_tokens.
  • Offers files and patch modes for analyzing code changes.
  • Allows customization of AI review behavior via a custom_prompt parameter.
  • Supports specifying the review comment language.

Maintenance & Community

  • The project is maintained by CiroLini, with a contributor Glauber Borges listed.
  • No explicit community links (Discord/Slack) or roadmap are provided in the README.

Licensing & Compatibility

  • Licensed under the MIT License.
  • Compatible with commercial use and closed-source projects as per MIT license terms.

Limitations & Caveats

The README notes that user data sent to OpenAI may be collected for model training, recommending precautions for sensitive code. It also advises using unique API keys per project for security.

Health Check
Last commit

1 year ago

Responsiveness

Inactive

Pull Requests (30d)
0
Issues (30d)
0
Star History
8 stars in the last 90 days

Explore Similar Projects

Feedback? Help us improve.