Skip to content

Commit fc8202d

Browse files
fix(ci): fix auto-approve workflow git repo error
- Remove unnecessary checkout step - Add -R flag to gh pr review command - Check for exact Claude message "No issues found. Checked for bugs and CLAUDE.md compliance" Signed-off-by: JasonXuDeveloper <jasonxudeveloper@gmail.com> Signed-off-by: JasonXuDeveloper - 傑 <jason@xgamedev.net>
1 parent 88a9971 commit fc8202d

1 file changed

Lines changed: 16 additions & 6 deletions

File tree

.github/workflows/auto-approve.yml

Lines changed: 16 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -50,9 +50,19 @@ 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
54-
CLAUDE_STATUS=$(gh api repos/${{ github.repository }}/commits/$HEAD_SHA/check-runs --jq '.check_runs[] | select(.name == "claude-review") | .conclusion' | head -1)
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)
5557
echo "Claude review status: $CLAUDE_STATUS"
58+
echo "Claude review output: $CLAUDE_OUTPUT"
59+
60+
# Check if Claude found no issues (exact message check)
61+
CLAUDE_APPROVED="false"
62+
if [ "$CLAUDE_STATUS" == "success" ] && echo "$CLAUDE_OUTPUT" | grep -q "No issues found. Checked for bugs and CLAUDE.md compliance"; then
63+
CLAUDE_APPROVED="true"
64+
fi
65+
echo "Claude approved: $CLAUDE_APPROVED"
5666
5767
# Check Unity Tests status (commit status, not check run)
5868
UNITY_STATUS=$(gh api repos/${{ github.repository }}/commits/$HEAD_SHA/status --jq '.statuses[] | select(.context == "Unity Tests") | .state' | head -1)
@@ -68,11 +78,11 @@ jobs:
6878
fi
6979
7080
# Determine if we should approve
71-
if [ "$CLAUDE_STATUS" == "success" ] && [ "$UNITY_STATUS" == "success" ]; then
72-
echo "All required checks passed!"
81+
if [ "$CLAUDE_APPROVED" == "true" ] && [ "$UNITY_STATUS" == "success" ]; then
82+
echo "All required checks passed and Claude found no issues!"
7383
echo "should_approve=true" >> $GITHUB_OUTPUT
7484
else
75-
echo "Required checks not yet passed"
85+
echo "Required checks not yet passed or Claude found issues"
7686
echo "should_approve=false" >> $GITHUB_OUTPUT
7787
fi
7888
@@ -102,6 +112,6 @@ jobs:
102112
run: |
103113
PR_NUMBER="${{ steps.pr.outputs.number }}"
104114
105-
gh pr review $PR_NUMBER --approve --body "Auto-approved: Claude review passed and Unity Tests passed (or were skipped for non-code changes)."
115+
gh pr review $PR_NUMBER -R ${{ github.repository }} --approve --body "Auto-approved: Claude review found no issues and Unity Tests passed (or were skipped for non-code changes)."
106116
107117
echo "PR #$PR_NUMBER approved!"

0 commit comments

Comments
 (0)