PRE (PR Engine) is a GitHub Action that automatically reviews pull requests using Large Language Models (LLMs) through the Bellman library.
- Automated code review for pull requests when they are opened
- On-demand reviews triggered by commenting
/bellman
on a pull request - Detailed feedback on potential bugs, security issues, and code quality
- Inline comments for specific issues
- Summary and scoring of pull requests
- Customizable system prompts
See examples in .github/workflows
directory
Add this to your GitHub workflow file to automatically review PRs when they are opened:
name: Bellman PR Evaluator
on:
pull_request:
types: [opened]
jobs:
pre-llm-review:
runs-on: ubuntu-latest
permissions:
contents: read
pull-requests: write
steps:
- name: Checkout code
uses: actions/checkout@v4
with:
fetch-depth: 0
- name: Review PR with LLM
uses: modfin/pre@master
with:
github-token: ${{ secrets.GITHUB_TOKEN }}
bellman-key: ${{ secrets.BELLMAN_KEY }}
bellman-url: ${{ secrets.BELLMAN_URL }}
bellman-model: 'VertexAI/gemini-2.0-flash'
Add this to your GitHub workflow file to enable on-demand reviews triggered by commenting /bellman
on a pull request:
name: Bellman PR Bot
on:
issue_comment:
types:
- created
jobs:
pr-bot-on-demand:
# Only run on pull request comments that start with '/bellman'
if: github.event.issue.pull_request && startsWith(github.event.comment.body, '/bellman')
runs-on: ubuntu-latest
permissions:
contents: read
pull-requests: write
steps:
- name: Checkout code
uses: actions/checkout@v4
with:
# Checkout the PR branch, not the base branch
ref: ${{ github.event.pull_request.head.sha }}
fetch-depth: 0
- name: Review PR with LLM
uses: modfin/pre@master
with:
github-token: ${{ secrets.GITHUB_TOKEN }}
bellman-key: ${{ secrets.BELLMAN_KEY }}
bellman-url: ${{ secrets.BELLMAN_URL }}
bellman-model: 'VertexAI/gemini-2.0-flash'
system-prompt-addition: ${{ github.event.comment.body }}
Input | Description | Required | Default |
---|---|---|---|
github-token |
GitHub token for API access | Yes | ${{ github.token }} |
bellman-key |
API key for LLM service | Yes | - |
bellman-url |
URL to Bellman service | Yes | - |
bellman-model |
LLM model to use for review | No | VertexAI/gemini-2.0-flash |
system-prompt |
Sets a specific system prompt | No | see DefaultSystemPrompt |
system-prompt-addition |
Additional instructions for the LLM | No | - |
- A Bellman API key and URL
- GitHub token with permissions to read contents and write to pull requests
- Add Agent mode allowing the LLM to eg read the entire files, and not just the diffs, if they want to.
- Refactor, cleanup and make testable
- Add built binaries instead of building from source each action
eg https://full-stack.blend.com/how-we-write-github-actions-in-go.html
This project is licensed under the MIT License - see the LICENSE file for details.