fix: parse verdict from PR comment instead of temp file

Claude writes "Verdict: FAIL/PASS" in the PR comment but doesn't
execute the python3 file-write command. The check step now reads
the claude[bot] comment via gh api and greps for the verdict line.
This commit is contained in:
Kevin Turcios 2026-03-27 06:40:40 -05:00
parent b81c50f7f4
commit cae86f669b

View file

@ -144,24 +144,33 @@ jobs:
</step>
<step name="verdict">
If ANY step above found issues OR warnings, write FAIL. Warnings are blocking — treat them the same as errors.
Run: python3 -c "open('/tmp/validation-verdict','w').write('FAIL')"
End your summary comment with exactly one of these lines (no other text on that line):
Only write PASS if every step passed with zero issues and zero warnings:
Run: python3 -c "open('/tmp/validation-verdict','w').write('PASS')"
**Verdict: PASS**
**Verdict: FAIL**
Use FAIL if ANY step found issues or warnings. Warnings are blocking.
Use PASS only if every step passed with zero issues and zero warnings.
</step>
claude_args: '--model us.anthropic.claude-sonnet-4-6 --allowedTools "Agent,Read,Glob,Grep,Bash(gh pr diff*),Bash(gh pr view*),Bash(gh pr comment*),Bash(gh api*),Bash(git diff*),Bash(git log*),Bash(git status*),Bash(cat *),Bash(python3 *),Bash(jq *)"'
- name: Check validation verdict
if: always()
env:
GH_TOKEN: ${{ github.token }}
run: |
if [ ! -f /tmp/validation-verdict ]; then
echo "::warning::No validation verdict file — Claude may not have reached the verdict step"
# Parse verdict from Claude's PR comment
VERDICT=$(gh api repos/${{ github.repository }}/issues/${{ github.event.pull_request.number }}/comments \
--jq '[.[] | select(.user.login == "claude[bot]")] | last | .body' \
| grep -oP 'Verdict:\s*\K(PASS|FAIL)' | tail -1 || true)
if [ -z "$VERDICT" ]; then
echo "::warning::Could not find verdict in Claude's PR comment"
exit 0
fi
verdict=$(cat /tmp/validation-verdict)
echo "Verdict: $verdict"
if [ "$verdict" = "FAIL" ]; then
echo "Verdict: $VERDICT"
if [ "$VERDICT" = "FAIL" ]; then
echo "::error::Plugin validation found issues that need fixing"
exit 1
fi