Skip to content

alsutton/ollama-pr-review-action

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

 

History

24 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Ollama PR review action

A GitHub Action that uses an ollama install to review pull request changes and post feedback as a comment.

This is based on the Claude action by Eric Hellman.

Features

  • Analyzes code changes in pull requests
  • Provides feedback on code quality, potential bugs, security issues, and performance
  • Posts the review as a comment on the PR
  • Ignores binary files and deleted files

Setup

Prerequisites

Access to an ollama installation which is serving requests via HTTP (i.e. running ollama serve), which already has the models you wish to use (i.e. ollama pull {model_name} has already been executed).

You may wish to set up a self-hosted runner, either on the same machine as ollama, or on the same LAN, to maximise performance.

Usage

Add the following to your GitHub workflow file (e.g., .github/workflows/code-review.yml):

name: Code Review

on:
  pull_request:
    types: [opened, synchronize]

jobs:
  review:
    runs-on: ubuntu-latest
    steps:
      - uses: actions/checkout@v3
      - name: Ollama Code Review
        uses: alsutton/ollama-code-reviewer-action
        with:
          github-token: ${{ secrets.GITHUB_TOKEN }}
          url: ${{ secrets.OLLAMA_URL }}
          model: ${{ secrets.OLLAMA_MODEL }}

Inputs

Input Description Required Default
github-token GitHub token for API access Yes N/A
url URL to access the ollama install Yes N/A
model The AI model to use for the review Yes N/A

Example Secrets

Key Example Value Description
github-token None This will be set by the action runner and should not be set manually
url http://127.0.0.1:11434/ This will work when the action runner and ollama are installed on the same machine
model mistral-nemo:12b Use the Mistral Nemo model

Development

  1. Clone the repository
  2. Install dependencies with npm install
  3. Build the action with npm run build
  4. Test with npm test

License

MIT

About

GitHub Action to review a PR using an Ollama installation

Resources

Stars

Watchers

Forks

Packages

No packages published