Skip to content

Commit 91d9ded

Browse files
fix(ci): fix auto-approve to check claude[bot] comment (#583)
- Check PR comments from claude[bot] for 'No issues found' message - Add branch-protection annotation to scorecard config explaining why last_push_approval is disabled (required for auto-approve bot) Signed-off-by: JasonXuDeveloper - 傑 <jason@xgamedev.net>
1 parent a7407cc commit 91d9ded

2 files changed

Lines changed: 18 additions & 9 deletions

File tree

.github/workflows/auto-approve.yml

Lines changed: 8 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -50,17 +50,16 @@ jobs:
5050
HEAD_SHA=$(gh api repos/${{ github.repository }}/pulls/$PR_NUMBER --jq '.head.sha')
5151
echo "Head SHA: $HEAD_SHA"
5252
53-
# Check Claude review status and output
54-
CLAUDE_CHECK=$(gh api repos/${{ github.repository }}/commits/$HEAD_SHA/check-runs --jq '.check_runs[] | select(.name == "claude-review")')
55-
CLAUDE_STATUS=$(echo "$CLAUDE_CHECK" | jq -r '.conclusion' | head -1)
56-
CLAUDE_OUTPUT=$(echo "$CLAUDE_CHECK" | jq -r '.output.summary // .output.text // ""' | head -1)
57-
echo "Claude review status: $CLAUDE_STATUS"
58-
echo "Claude review output: $CLAUDE_OUTPUT"
59-
60-
# Check if Claude found no issues (exact message check)
53+
# Check Claude review - look for "No issues found" comment from claude[bot]
54+
# Claude posts a PR comment with this message when review passes
55+
CLAUDE_COMMENTS=$(gh api "repos/${{ github.repository }}/issues/$PR_NUMBER/comments" --jq '[.[] | select(.user.login == "claude[bot]") | .body] | join("\n")')
56+
6157
CLAUDE_APPROVED="false"
62-
if [ "$CLAUDE_STATUS" == "success" ] && echo "$CLAUDE_OUTPUT" | grep -q "No issues found. Checked for bugs and CLAUDE.md compliance"; then
58+
if echo "$CLAUDE_COMMENTS" | grep -q "No issues found. Checked for bugs and CLAUDE.md compliance"; then
59+
echo "Claude review: No issues found"
6360
CLAUDE_APPROVED="true"
61+
else
62+
echo "Claude review: Issues found or not yet complete"
6463
fi
6564
echo "Claude approved: $CLAUDE_APPROVED"
6665

.scorecard.yml

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -47,3 +47,13 @@ annotations:
4747
- token-permissions
4848
reasons:
4949
- reason: not-applicable # Write permissions required for test reporting and release automation
50+
51+
# Branch protection: Using GitHub Rulesets with auto-approve bot
52+
# - Rulesets require 1 approver (provided by auto-approve bot)
53+
# - Code owner review is required
54+
# - last_push_approval disabled to allow auto-approve bot to work
55+
# - bypass_actors: [] prevents admin bypass
56+
- checks:
57+
- branch-protection
58+
reasons:
59+
- reason: not-applicable # Using Rulesets with auto-approve bot requiring last_push_approval disabled

0 commit comments

Comments
 (0)