diff --git a/.github/workflows/claude-review.yml b/.github/workflows/claude-review.yml index 1f18a19..527c291 100644 --- a/.github/workflows/claude-review.yml +++ b/.github/workflows/claude-review.yml @@ -261,18 +261,37 @@ jobs: script: | const pr_number = context.payload.pull_request.number; - // Check if Claude review has been completed + // Check if Claude review has been completed by looking for: + // 1. Comments with automated checks from Claude review workflow + // 2. Actual PR reviews (APPROVED or COMMENT) const comments = await github.rest.issues.listComments({ owner: context.repo.owner, repo: context.repo.repo, issue_number: pr_number }); - const has_claude_review = comments.data.some(comment => - comment.body.includes('Claude AI Review') || - comment.body.includes('Claude review completed') + const reviews = await github.rest.pulls.listReviews({ + owner: context.repo.owner, + repo: context.repo.repo, + pull_number: pr_number + }); + + // Check for automated checks comment (posted by Claude Auto Review job) + const has_automated_checks = comments.data.some(comment => + comment.body.includes('🔍 Automated Checks') && + comment.body.includes('Claude is reviewing') ); + // Check for actual review with Claude AI approval/feedback + const has_review = reviews.data.some(review => + review.body && ( + review.body.includes('Claude AI approved') || + review.body.includes('Claude AI review') + ) + ); + + const has_claude_review = has_automated_checks && has_review; + if (!has_claude_review) { core.setFailed('⚠️ Claude review required for merging to main. Comment "/claude review" to trigger.'); } else { diff --git a/TEST_AUTO_APPROVE.md b/TEST_AUTO_APPROVE.md new file mode 100644 index 0000000..80c96aa --- /dev/null +++ b/TEST_AUTO_APPROVE.md @@ -0,0 +1,15 @@ +# Test Auto-Approve Workflow + +This is a test to verify the auto-approve workflow with the new ORG_GITHUB_TOKEN. + +## Expected Behavior: +1. ✅ Claude Auto Review should run automatically +2. ✅ PR should get auto-approved if checks pass +3. ✅ "Require Claude Review for Main" should pass (now checks for actual review text) +4. ✅ Auto-merge should be enabled + +## Token Setup: +- `ORG_GITHUB_TOKEN` is configured and working +- Token has `pull_requests: read and write` permission +- Token is scoped to this repository only +