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.
- 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
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.
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 }}| 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 |
| 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 |
- Clone the repository
- Install dependencies with
npm install - Build the action with
npm run build - Test with
npm test
MIT