Skip to content

Commit eefed58

Browse files
chore(ci): emit claude:review:passed/failed label from automated PR review [PYSDK-105]
Adds a machine-readable verdict from the automated Claude PR review so branch-protection rules can gate `auto-merge` on the review outcome without human intervention. Changes: * `.github/labels.yml`: two new mutually-exclusive labels - `claude:review:passed` (green) — no blocking findings on current head - `claude:review:failed` (red) — blocking findings on current head * `.github/workflows/claude-code-automation-pr-review.yml`: extend prompt with a mandatory "Machine-Readable Verdict" final step. Claude must emit PASS or FAIL based on the existing CRITICAL CHECKS criteria (test markers, coverage ≥85%, lint clean, conventional commits, architecture/security) and apply the corresponding label via `gh pr edit --add-label ... --remove-label ...`. The opposite label is always removed, so the labels stay mutually exclusive across re-reviews on subsequent pushes. Re-emission: every push to a PR re-runs the review (existing `synchronize` trigger), so the verdict is always tied to the current head commit — stale verdicts cannot persist. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
1 parent daf15a0 commit eefed58

2 files changed

Lines changed: 51 additions & 0 deletions

File tree

.github/labels.yml

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -117,6 +117,14 @@
117117
description: Trigger Claude Code automation
118118
color: "b41d8f"
119119

120+
- name: claude:review:passed
121+
description: Automated Claude PR review found no blocking issues on the current head commit
122+
color: "0e8a16"
123+
124+
- name: claude:review:failed
125+
description: Automated Claude PR review found blocking issues on the current head commit
126+
color: "b60205"
127+
120128
- name: copilot
121129
description: GitHub Copilot related
122130
color: "e6dac6"

.github/workflows/claude-code-automation-pr-review.yml

Lines changed: 43 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -214,6 +214,49 @@ jobs:
214214
215215
Use `gh pr comment` with your Bash tool to leave your comprehensive review as a comment on the PR.
216216
217+
## Machine-Readable Verdict (MANDATORY)
218+
219+
After posting your review comment, you MUST emit a single-label verdict on the PR. This label is consumed by branch-protection rules to gate auto-merge — it is the only deterministic signal of your review outcome.
220+
221+
**Verdict criteria** (all must hold for PASS):
222+
223+
- No blocking findings under "CRITICAL CHECKS" — i.e. no missing test markers, no coverage drop below 85%, no `make lint` failures, no conventional-commit violations.
224+
- No blocking architecture or security violations under "Repository-Specific Review Areas".
225+
- Suggestions / nice-to-haves do NOT block the verdict.
226+
227+
If any blocking finding remains: verdict is **FAIL**.
228+
Otherwise: verdict is **PASS**.
229+
230+
**Apply the label** (the two labels are mutually exclusive — always remove the opposite one):
231+
232+
```bash
233+
# PASS:
234+
gh pr edit ${{ github.event.pull_request.number }} \
235+
--add-label "claude:review:passed" \
236+
--remove-label "claude:review:failed"
237+
238+
# FAIL:
239+
gh pr edit ${{ github.event.pull_request.number }} \
240+
--add-label "claude:review:failed" \
241+
--remove-label "claude:review:passed"
242+
```
243+
244+
Note: `--remove-label` is a no-op if the label is not present, so it is safe to always include it.
245+
246+
Also include the verdict as the final line of your sticky review comment, formatted exactly as:
247+
248+
```
249+
**Verdict**: ✅ claude:review:passed
250+
```
251+
252+
or
253+
254+
```
255+
**Verdict**: ❌ claude:review:failed
256+
```
257+
258+
This makes the verdict visible to humans without scrolling through all findings.
259+
217260
---
218261
219262
**Remember**: This is medical device software. Insist on highest standards. Be thorough, actionable, and kind.

0 commit comments

Comments
 (0)