GitHub Action that runs AI-powered PR reviews using pi and optionally dora for code intelligence.
Comment @pi review on a PR to trigger a structured code review posted as a reply.
Use a static API key from your provider. Does not expire.
- Add your API key as a repository secret named
API_KEY(Settings > Secrets and variables > Actions). - Add the workflow:
# .github/workflows/pi-review.yml
name: Pi Review
on:
issue_comment:
types: [created]
jobs:
review:
if: github.event.issue.pull_request && startsWith(github.event.comment.body, '@pi ')
runs-on: ubuntu-latest
permissions:
contents: read
pull-requests: write
issues: write
steps:
- uses: actions/checkout@v4
with:
fetch-depth: 0
ref: refs/pull/${{ github.event.issue.number }}/merge
- uses: butttons/pi-action-runner@v0
with:
api_key: ${{ secrets.API_KEY }}Use your local pi auth file. OAuth tokens rotate automatically, so the secret may need periodic updates.
base64 -i ~/.pi/agent/auth.json | pbcopyAdd as PI_AUTH secret, then:
- uses: butttons/pi-action-runner@v0
with:
pi_auth: ${{ secrets.PI_AUTH }}Comment on any PR:
@pi review
With additional context:
@pi review focus on error handling and edge cases
Only repository owners and members can trigger reviews.
| Input | Required | Default | Description |
|---|---|---|---|
api_key |
No | -- | API key for the model provider. Preferred auth method. |
pi_auth |
No | -- | Base64-encoded pi auth.json. Fallback if api_key is not set. |
pi_model |
No | openai/gpt-4.1 |
Model in provider/model-id format |
use_dora |
No | true |
Enable dora code intelligence. Set to false to skip dora entirely. |
dora_version |
No | latest |
Dora CLI release version |
scip_install |
No | bun install -g @sourcegraph/scip-typescript |
SCIP indexer install command. Empty string to skip. |
dora_pre_index |
No | -- | Commands to run after dora init but before indexing (e.g. install project deps) |
dora_index_command |
No | dora index |
Override the index command |
system_prompt |
No | -- | Path to a custom system prompt file (relative to repo root). See Customizing prompts. |
review_template |
No | -- | Path to a custom review output template file (relative to repo root). See Customizing prompts. |
extra_prompt |
No | -- | Additional instructions appended to every review |
Either api_key or pi_auth must be provided. When both are set, api_key takes precedence.
The dora_version, scip_install, dora_pre_index, and dora_index_command inputs are ignored when use_dora is false.
TypeScript/JavaScript (no extra config needed):
- uses: butttons/pi-action-runner@v0
with:
api_key: ${{ secrets.API_KEY }}Rust:
- uses: butttons/pi-action-runner@v0
with:
api_key: ${{ secrets.API_KEY }}
scip_install: 'cargo install rust-analyzer'Python:
- uses: butttons/pi-action-runner@v0
with:
api_key: ${{ secrets.API_KEY }}
scip_install: 'pip install scip-python'
dora_pre_index: 'pip install -e .'Skip the SCIP indexer (dora still provides file-level analysis):
- uses: butttons/pi-action-runner@v0
with:
api_key: ${{ secrets.API_KEY }}
scip_install: ''Uses git diff, grep, find, and file reading for context gathering. No dora install, indexing, or SCIP tooling required.
- uses: butttons/pi-action-runner@v0
with:
api_key: ${{ secrets.API_KEY }}
use_dora: 'false'- uses: butttons/pi-action-runner@v0
with:
api_key: ${{ secrets.ANTHROPIC_KEY }}
pi_model: 'anthropic/claude-sonnet-4'The system prompt and review output template are fully replaceable. Default files are in prompts/:
prompts/system-dora.md-- default system prompt when dora is enabledprompts/system-git.md-- default system prompt when dora is disabledprompts/review-template.md-- default review output structure
To customize, copy a default file into your repo and point the input to it:
- uses: butttons/pi-action-runner@v0
with:
api_key: ${{ secrets.API_KEY }}
system_prompt: '.github/review-prompt.md'
review_template: '.github/review-template.md'Use {base_branch} anywhere in your prompt -- it gets replaced with the PR's target branch (e.g. main).
When system_prompt is set, it replaces the entire default prompt. The use_dora toggle has no effect on the prompt content in this case -- you control everything.
The extra_prompt input and the per-review comment message are still appended after your custom prompt.
The review template defines the markdown structure the agent outputs. It gets appended to the system prompt under an "Output" heading with instructions to produce only that format.
- Validates the commenter is a repo owner/member.
- If dora is enabled: installs dora CLI and the SCIP indexer, runs
dora init, optional pre-index setup, thendora index. - Runs pi with bash and read tools. With dora, the agent uses
git diff,dora changes,dora file,dora rdeps, and other dora commands. Without dora, it usesgit diff,grep,find, and direct file reading. - Posts a structured review comment on the PR.
Each step logs to GitHub Actions output for full visibility into the review process.
The default review template produces this structure:
- Summary -- what the PR does and why.
- Risk Assessment -- LOW, MEDIUM, or HIGH with justification.
- Issues -- bugs, security, correctness problems with severity and file locations.
- Suggestions -- improvements worth considering.
- Architecture -- structural concerns, only when applicable.
Override with review_template to use your own format.
- GitHub Actions runner:
ubuntu-latest - One of:
API_KEYsecret (static API key) orPI_AUTHsecret (base64 pi auth.json) - With dora enabled (default): the action installs bun, dora (
@butttons/dora), and the SCIP indexer. - With dora disabled: the action only installs bun.
MIT