Skip to content

A GitHub Action that provides automated code review using AI to analyze pull request changes.

License

Notifications You must be signed in to change notification settings

drew2a/ai-review

Use this GitHub action with your project
Add this Action to an existing workflow or create a new one
View on Marketplace

Folders and files

NameName
Last commit message
Last commit date

Latest commit

4d21fa6 · Feb 26, 2025

History

12 Commits
Feb 26, 2025
Feb 24, 2025
Feb 26, 2025
Feb 23, 2025
Feb 24, 2025
Feb 23, 2025
Feb 26, 2025
Feb 26, 2025
Feb 26, 2025
Feb 24, 2025
Feb 26, 2025

Repository files navigation

Build and Test MIT License

AI Code Review Action

A GitHub Action that provides automated code review using AI to analyze pull request changes.

Features

  • Automatically reviews pull request changes using AI
  • Provides detailed code suggestions and improvements
  • Adds review comments directly to the PR
  • Works with any programming language
  • Supports different AI models and API endpoints
  • Optional review resolution statuses (e.g., "APPROVE", "REQUEST_CHANGES", "COMMENT")
  • Debug mode for enhanced logging

Supported models:

  • gpt-4o
  • o1
  • claude-3-7-sonnet
  • claude-3-5-sonnet

My (Subjective) Review of the Particular Models

I’ll grade them on a scale from 0 to 10, where:

  • 0 → Completely irrelevant comments
  • 3 → My fresh junior/mid-level colleague
  • 5 → My mid-level colleague who reads Stack Overflow
  • 8 → Me
  • 10 → My very smart colleague

So, based on this (highly unscientific) scale:

  • gpt-4o2
  • o13
  • claude-3-5-sonnet5
  • claude-3-7-sonnet6

Inputs

Name Description Required Default
api_endpoint LLM API endpoint true -
api_key LLM API key true -
api_version LLM API version false 2023-12-01-preview
llm_model LLM Model used for review false gpt-4o
debug Enable debug mode (true/false) false false
add_review_resolution Add review resolution (APPROVE, REQUEST_CHANGES, COMMENT) false false
github_token GitHub token for authentication true -

Usage

To use this action in your GitHub workflow, add the following step:

- uses: drew2a/ai-review@v1
  with:
    api_endpoint: ${{ secrets.LLM_ENDPOINT }}
    api_key: ${{ secrets.LLM_API_KEY }}
    api_version: ${{ secrets.LLM_API_VERSION }}
    llm_model: ${{ secrets.LLM_MODEL }}

    github_token: ${{ secrets.GITHUB_TOKEN }}

    debug: false
    add_review_resolution: false

Example Workflow

name: AI Code Review

on: [ pull_request ]

permissions:
  pull-requests: write

jobs:
  review:
    runs-on: ubuntu-latest
    steps:
      - uses: actions/checkout@v4

      - uses: drew2a/ai-review@v1
        with:
          api_endpoint: ${{ secrets.LLM_ENDPOINT }}
          api_key: ${{ secrets.LLM_API_KEY }}
          api_version: ${{ secrets.LLM_API_VERSION }}
          llm_model: ${{ secrets.LLM_MODEL }}

          github_token: ${{ secrets.GITHUB_TOKEN }}

          debug: true
          add_review_resolution: false

License

Released under the MIT License.

About

A GitHub Action that provides automated code review using AI to analyze pull request changes.

Resources

License

Stars

Watchers

Forks

Packages

No packages published