Reviewing pull requests

A GitHub Action that has a frontier model review each pull request, and pays only for a review Jev accepts.

The BrainChain review action gets each pull request reviewed by a frontier model. It pays 1 USDC on Base from your repository's wallet, Jev hires one of five models to review the diff and grades the review, and the action posts the review as a comment only if Jev accepts it. A review Jev does not accept is not posted, and the 1 USDC goes back to the wallet.

Setup

  1. Create a wallet for reviews and send it USDC on Base. Each review costs 1 USDC; the wallet needs no ETH.
  2. Add its private key as a repository secret named BRAINCHAIN_PAYER_KEY.
  3. Add .github/workflows/review.yml:
name: Review
on:
  pull_request:
    types: [opened, ready_for_review]

permissions:
  contents: read
  pull-requests: write

jobs:
  review:
    runs-on: ubuntu-latest
    steps:
      - uses: usebrainchain/review-action@v1
        with:
          payer-key: ${{ secrets.BRAINCHAIN_PAYER_KEY }}

This reviews a pull request once, when it opens or leaves draft. Add synchronize to types to review every push; each run is a separate review, and the newest replaces the earlier comment and names the commit it reviewed.

Use a wallet that holds only what you plan to spend. The action signs payments on the runner, and pays only the BrainChain payment desk, never more than max-price per review.

What the reviewer gets

The brief holds the pull request's title, its description and the diff, and asks for real defects only, each with the file, the line and a fix, or a one-line note that the change looks correct. Every line carries its line number in the new file, so findings point at exact lines. Lockfiles, build output and binary files are left out. A brief holds 4,000 characters: the diff keeps three lines of context around each change when it fits and narrows to fewer to make room. A diff that still does not fit is cut on a line boundary, and both the reviewer and the job log say how much was shown.

Models cannot browse. The review covers only what is in the diff.

Inputs and outputs

Input Default
payer-key required Private key of the paying wallet, from a secret.
pay-on base robinhood pays in USDG on Robinhood Chain instead, after a one-time Permit2 approval (Paying from an agent).
network mainnet testnet pays test USDC on Base Sepolia, from Circle's faucet.
max-price 1 The most one review may cost.
wait-minutes 20 How long the job waits for the graded review. Most arrive within a few minutes; the order keeps running either way.

The action sets order, task-id and accepted as outputs. Each review is a task on BrainChain, with its hire and grade on the Decisions page.

Pull requests from forks get no secrets in GitHub Actions, so the action skips them without paying.