Skip to content

GitHub Action

The GitHub Action is the easiest way to get started. Reviews run on GitHub-hosted runners — no server to provision or maintain.

Create .github/workflows/rusty-bot-review.yml:

on:
pull_request:
types: [opened, synchronize, reopened]
jobs:
review:
runs-on: ubuntu-latest
permissions:
pull-requests: write
contents: read
issues: read
steps:
- uses: jegork/rusty-bot@v1
with:
anthropic-api-key: ${{ secrets.ANTHROPIC_API_KEY }}
env:
RUSTY_LLM_MODEL: anthropic/claude-sonnet-4-20250514
RUSTY_REVIEW_STYLE: balanced
RUSTY_FOCUS_AREAS: security,bugs,performance
RUSTY_FAIL_ON_CRITICAL: "true"

The Getting started page has the bare minimum to get running. This page is the complete reference.

Set these on the job (not the whole workflow):

PermissionReason
pull-requests: writePost the summary comment and inline review findings
issues: readRead linked issues for ticket compliance checks
contents: readRead the diff and fetch the convention file from the target branch

Secret-bearing inputs only — everything else flows through env:. See Environment variables for non-secret config.

InputRequiredDefaultDescription
github-tokenNo${{ github.token }}GitHub token; the built-in token works when the permissions: block above is set
anthropic-api-keyConditionalRequired when RUSTY_LLM_MODEL targets an anthropic/* model
openai-api-keyConditionalRequired when RUSTY_LLM_MODEL targets an openai/* model
google-api-keyConditionalRequired when RUSTY_LLM_MODEL targets a google/* model
azure-openai-api-keyConditionalRequired when RUSTY_LLM_MODEL targets an azure-openai/* model
llm-api-keyConditionalAPI key for an OpenAI-compatible endpoint (set together with RUSTY_LLM_BASE_URL)
jira-api-tokenNoEnable Jira ticket compliance; combine with RUSTY_JIRA_BASE_URL + RUSTY_JIRA_EMAIL
linear-api-keyNoEnable Linear ticket compliance
PinBehaviour
@v1Floats to the latest 1.x.x release. Recommended.
@v1.2.3Pinned to an exact release.
@mainTracks main. Use only for development.

The Action exits early (no error, no review) for these PR event types:

  • closed, labeled, unlabeled, assigned, unassigned
  • Draft PRs — unless RUSTY_REVIEW_DRAFTS=true is set in env:

On synchronize events (every push after the first review), the Action only reviews the diff between the previously-reviewed commit and the new HEAD instead of re-reviewing the full PR diff. This typically cuts token usage by 60–80% on multi-commit PRs.

How it works:

  • After each successful review, the Action embeds the reviewed commit sha in a hidden HTML marker inside the summary comment (<!-- rusty-bot:last-sha:abc... -->).
  • On the next push the Action reads that marker, fetches git compare {last-sha}...{new-head} from GitHub, and runs the review against only that delta.
  • If the marker is missing (first run) or the previous sha is no longer reachable (force-push or rebase), the Action falls back to a full review.
  • If the new HEAD is identical to the previously-reviewed sha, the run exits without re-posting anything.
  • If the delta has no reviewable files (e.g. only ignored paths changed), the Action skips the LLM call and posts a one-line summary instead.

Enabled by default. To always review the full PR diff, set RUSTY_INCREMENTAL_REVIEW=false.

The Action runs inside ghcr.io/jegork/rusty-bot:latest, which includes OpenGrep. The first run in a fresh runner environment adds roughly 20–40s for the image pull; subsequent runs on cached runners skip this entirely.