cirolini/genai-code-review

GitHub Action that reviews pull request diffs with an LLM and posts the comments on the PR

What it solves

This project provides a GitHub Action that uses Large Language Models (LLMs) to automatically review pull request diffs and post inline comments. It specifically addresses the problem of "review fatigue" by implementing a comment budget, ensuring that only the most critical findings are highlighted to the reviewers, rather than overwhelming them with a high volume of low-value comments.

How it works

  1. Filtering: It first removes files matching ignore_paths (such as lockfiles or generated code) before sending data to the LLM.
  2. Incremental Review: On subsequent pushes, it only analyzes the new commits since the last review.
  3. Chunking: The diff is split into chunks to fit the model's context window; any content that cannot fit is reported in the summary.
  4. Schema-based Analysis: The model generates findings based on a JSON schema (including severity, confidence, and rationale). If the output doesn't validate, the tool performs one repair attempt.
  5. Validation: Findings are checked against the diff to ensure they can be placed correctly on GitHub. Invalid placements are moved to the summary.
  6. Posting: The top max_comments (ranked by severity and confidence) are posted as a grouped review, and a sticky summary comment is updated.

Who it’s for

Developers and teams using GitHub who want AI-assisted code reviews that are focused and high-signal, and who use providers like OpenAI, Anthropic, Google Gemini, or self-hosted OpenAI-compatible servers (e.g., Ollama, vLLM).

Highlights

  • Comment Budget: Prevents reviewer fatigue by limiting the number of inline comments and explicitly listing suppressed findings in the summary.
  • Broad Provider Support: Works with Gemini, OpenAI, Anthropic, and any OpenAI-compatible API.
  • Security-First Design: Treats diffs as untrusted data using sentinels to prevent prompt injection and avoids using pull_request_target for fork PRs.
  • Zero-Disk Footprint: Reads pull requests via API without needing actions/checkout.
  • Transparent Reporting: The summary comment explicitly states what was not reviewed (e.g., truncated diffs or ignored files).

Related

  • Project
  • Project
  • Project
  • Project