Senior-SWE LLM Review Gate for a Specific Author¶
Goal¶
When GitHub user arexwu opens a pull request, run an LLM “senior software
engineer” review of the diff and block merge until that review passes. PRs from
any other author are unaffected.
Mechanism¶
A single workflow, .github/workflows/senior-review.yml, with one job named
senior-swe-review. The job name is the status-check context that branch
protection marks as required.
Trigger¶
on:
pull_request:
types: [opened, synchronize, reopened, ready_for_review]
Runs on every PR so the required check always reports a result. The review work
only executes for arexwu; for everyone else the job passes immediately.
Job steps¶
Author gate. A first step exports whether
github.event.pull_request.user.login == 'arexwu'. Subsequent review steps are guarded on that condition. If the author is not arexwu, the job ends green with no review.Checkout with
fetch-depth: 0.Compute diff:
git diff origin/$BASE...HEAD > pr.diffwhere$BASEis the PR base ref.Review with
anthropics/claude-code-action@v1, authenticated by theANTHROPIC_API_KEYrepo secret. The prompt frames Claude as a senior SWE reviewingpr.difffor correctness, simplicity, duplication/reuse, naming, dead code, tests, and repo conventions. Claude posts the review as a PR comment and writes a verdict file whose last line isPASSorFAIL.Gate. A final step reads the verdict file and
exit 1onFAIL, turning the check red and blocking merge.
Fail-open behaviour¶
The gate blocks merge only on an explicit FAIL. Every other outcome ends
green with a ::warning:: annotation, because a flaky reviewer must never be
the reason a good PR cannot merge:
The review step is
continue-on-error, so an API outage, rate limit, or action-level crash does not fail the job.verdict.txtis parsed leniently — surrounding whitespace,**bold**, backticks, trailing punctuation and lowercase all still resolve. If the file is prose (Verdict: PASS), the firstPASS/FAILword wins.If
verdict.txtis missing or unparseable, the## Verdictsection ofreview.mdis used as a fallback.If neither yields a verdict, the gate passes with a warning. Same for a PR whose diff against the base is empty, in which case the review is skipped entirely.
The prompt matches this posture: FAIL is reserved for genuinely blocking
issues (correctness bugs, regressions, security holes, data loss, a missing
test for risky logic). Nits, refactor ideas and subjective disagreements are
reported but still PASS, and ties go to PASS.
Model¶
claude-opus-4-8 (strongest available) for review quality.
Merge blocking¶
The workflow alone cannot make a check “required” — that is branch protection.
After the workflow is on main, mark the senior-swe-review context required:
gh api -X PUT repos/stickms/rmhstudios.com/branches/main/protection/required_status_checks \
-f strict=false -f 'contexts[]=senior-swe-review'
(Needs admin on the repo. The context must have run at least once for GitHub to recognize it.)
Constraints / notes¶
Requires an
ANTHROPIC_API_KEYrepo secret.arexwu must push branches within the repo; fork PRs do not receive secrets, so the review step would be skipped for forks.
Gating target branch:
main.