Skip to content

Repository files navigation

codereview

LLM-powered pull request code review as a GitHub Action. Posts inline review comments using conventional comments format and submits a verdict (approve, request changes, or comment).

Features

  • Reviews PR diffs with full file context
  • Uses conventional comment labels: nit:, suggestion:, issue:, question:, thought:, chore:, praise:
  • Replies to comment threads when developers respond
  • Resolves threads automatically when concerns are addressed
  • Remembers prior comments to avoid repeating itself
  • Configurable LLM provider (Gemini supported, more planned)

Quick start

Add a workflow file to your repository:

# .github/workflows/review.ymlname: Code Reviewon:
pull_request:
types: [opened, synchronize]pull_request_review_comment:
types: [created]permissions:
pull-requests: writecontents: readjobs:
review:
runs-on: macos-lateststeps:
- uses: actions/checkout@v4
- uses: LimpidTech/codereview@mainwith:
gemini-api-key: ${{ secrets.GEMINI_API_KEY }}

Get a Gemini API key from Google AI Studio and add it as a repository or organization secret named GEMINI_API_KEY.

Inputs

InputRequiredDefaultDescription
github-tokenno${{ github.token }}GitHub token for API access
providernogeminiLLM provider to use
gemini-api-keynoAPI key for Google Gemini
modelnogemini-2.5-flashModel name override
instructionsnoAdditional review instructions
bot-loginnogithub-actions[bot]Bot username for loop prevention

Providers

Gemini (default)

- uses: LimpidTech/codereview@mainwith:
provider: geminigemini-api-key: ${{ secrets.GEMINI_API_KEY }}

To use a specific model:

- uses: LimpidTech/codereview@mainwith:
gemini-api-key: ${{ secrets.GEMINI_API_KEY }}model: gemini-2.5-pro

Adding providers

The codebase is designed for easy provider addition. Each provider implements a single function type:

typeReviewFuncfunc(ctx context.Context, reqRequest) (Response, error)

See internal/provider/gemini/ for a reference implementation.

Custom instructions

Use the instructions input to guide the reviewer toward your project's conventions:

- uses: LimpidTech/codereview@mainwith:
gemini-api-key: ${{ secrets.GEMINI_API_KEY }}instructions: | This is a Go project using the standard library only. We prefer table-driven tests. Error messages should not be capitalized. All exported functions must have doc comments.

Instructions are prepended to the review prompt, so the LLM will consider them alongside the diff and file context.

How it works

On PR open / push

  1. Fetches the PR diff and full contents of changed files
  2. Fetches any prior review comments it has already made
  3. Sends everything to the configured LLM with review instructions
  4. Posts inline review comments with conventional labels
  5. Submits a verdict: APPROVE, REQUEST_CHANGES, or COMMENT

On review comment reply

  1. Fetches the full conversation thread
  2. Sends the thread context and relevant diff hunk to the LLM
  3. Posts a reply
  4. If the concern is resolved, automatically resolves the thread (only for threads it started)

Permissions

The workflow needs these permissions:

permissions:
pull-requests: write # post reviews, reply to comments, resolve threadscontents: read # fetch file contents for context

Using with a GitHub App token

If you use a GitHub App token instead of the default GITHUB_TOKEN, set bot-login to the app's bot username so it doesn't reply to its own comments:

- uses: LimpidTech/codereview@mainwith:
github-token: ${{ steps.app-token.outputs.token }}gemini-api-key: ${{ secrets.GEMINI_API_KEY }}bot-login: my-app[bot]

License

BSD 2-Clause. See LICENSE for details.

About

LLM-powered PR code review with conventional comments

Resources

Stars

0 stars

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages