diff --git a/.github/workflows/continue-detailed-review.yaml b/.github/workflows/continue-detailed-review.yaml index 3d314ff37..3f73a5d5b 100644 --- a/.github/workflows/continue-detailed-review.yaml +++ b/.github/workflows/continue-detailed-review.yaml @@ -18,7 +18,7 @@ jobs: timeout-minutes: 10 steps: - name: Run Detailed PR Review - uses: continuedev/continue/actions/detailed-review@23d9260536372acf4eb57a41e6ab62bc5869b070 + uses: continuedev/continue/actions/detailed-review@64bda6b2b3dac1037e9895dbee4ce1d35565e1fe with: continue-api-key: ${{ secrets.CONTINUE_API_KEY }} continue-org: continuedev diff --git a/.github/workflows/continue-general-review.yaml b/.github/workflows/continue-general-review.yaml index 3030c6fdf..3a37e3303 100644 --- a/.github/workflows/continue-general-review.yaml +++ b/.github/workflows/continue-general-review.yaml @@ -18,7 +18,7 @@ jobs: timeout-minutes: 10 steps: - name: Run Continue PR Review Action - uses: continuedev/continue/actions/general-review@23d9260536372acf4eb57a41e6ab62bc5869b070 + uses: continuedev/continue/actions/general-review@64bda6b2b3dac1037e9895dbee4ce1d35565e1fe with: continue-api-key: ${{ secrets.CONTINUE_API_KEY }} continue-org: "continuedev" diff --git a/actions/README.md b/actions/README.md index 464867658..6d3bbf377 100644 --- a/actions/README.md +++ b/actions/README.md @@ -219,7 +219,7 @@ We recommend using a specific commit SHA for stability and predictability: Example: ```yaml -uses: continuedev/continue/actions/general-review@17fe39cc4f1760838ce4428aad0a984af13f8266 +uses: continuedev/continue/actions/general-review@64bda6b2b3dac1037e9895dbee4ce1d35565e1fe ``` ## Troubleshooting diff --git a/actions/detailed-review/action.yml b/actions/detailed-review/action.yml index e0280fa28..97c47018f 100644 --- a/actions/detailed-review/action.yml +++ b/actions/detailed-review/action.yml @@ -29,12 +29,17 @@ runs: SHOULD_RUN="false" if [ "${{ github.event_name }}" = "pull_request" ]; then - # Check PR author association - AUTHOR_ASSOC="${{ github.event.pull_request.author_association }}" - if [ "$AUTHOR_ASSOC" = "OWNER" ] || [ "$AUTHOR_ASSOC" = "MEMBER" ] || [ "$AUTHOR_ASSOC" = "COLLABORATOR" ]; then - SHOULD_RUN="true" + # Check if PR is a draft + if [ "${{ github.event.pull_request.draft }}" = "true" ]; then + echo "::notice::Skipping review - PR is a draft" else - echo "::notice::Skipping review - PR author is not a team member (association: $AUTHOR_ASSOC)" + # Check PR author association + AUTHOR_ASSOC="${{ github.event.pull_request.author_association }}" + if [ "$AUTHOR_ASSOC" = "OWNER" ] || [ "$AUTHOR_ASSOC" = "MEMBER" ] || [ "$AUTHOR_ASSOC" = "COLLABORATOR" ]; then + SHOULD_RUN="true" + else + echo "::notice::Skipping review - PR author is not a team member (association: $AUTHOR_ASSOC)" + fi fi elif [ "${{ github.event_name }}" = "issue_comment" ]; then # Check if it's a PR comment with the trigger phrase @@ -268,7 +273,23 @@ runs: console.log('Invalid comments:', JSON.stringify(invalidComments, null, 2)); } - const comments = validComments.map(comment => ({ + // Deduplicate comments based on path + position + body + const uniqueComments = []; + const seen = new Set(); + + for (const comment of validComments) { + const key = `${comment.path}:${comment.position}:${comment.body}`; + if (!seen.has(key)) { + seen.add(key); + uniqueComments.push(comment); + } + } + + if (uniqueComments.length < validComments.length) { + console.log(`Filtered out ${validComments.length - uniqueComments.length} duplicate comments (same path + position + body)`); + } + + const comments = uniqueComments.map(comment => ({ path: comment.path, position: comment.position, body: comment.body @@ -283,12 +304,19 @@ runs: // Create the review if (comments.length > 0) { try { + let reviewBody = `${reviewData.review_summary || 'AI Code Review'}\n\n---\n*💡 To request a new detailed review, comment \`@continue-detailed-review\`*`; + + // Add triggered by note if from comment + if (context.eventName === 'issue_comment') { + reviewBody = `*Triggered by @${context.payload.comment.user.login}'s request*\n\n${reviewBody}`; + } + await github.rest.pulls.createReview({ owner: context.repo.owner, repo: context.repo.repo, pull_number: prNumber, commit_id: commitSha, - body: `${reviewData.review_summary || 'AI Code Review'}\n\n---\n*💡 To request a new detailed review, comment \`@continue-detailed-review\`*`, + body: reviewBody, event: 'COMMENT', comments: comments }); @@ -310,22 +338,19 @@ runs: } } else { // No inline comments, just post the summary + let summaryBody = `## AI Code Review\n\n${reviewData.review_summary}\n\n*No specific line comments generated.*\n\n` + + `---\n*💡 To request a new detailed review, comment \`@continue-detailed-review\`*`; + + // Add triggered by note if from comment + if (context.eventName === 'issue_comment') { + summaryBody = `*Triggered by @${context.payload.comment.user.login}'s request*\n\n${summaryBody}`; + } + await github.rest.issues.createComment({ issue_number: prNumber, owner: context.repo.owner, repo: context.repo.repo, - body: `## AI Code Review\n\n${reviewData.review_summary}\n\n*No specific line comments generated.*\n\n` + - `---\n*💡 To request a new detailed review, comment \`@continue-detailed-review\`*` - }); - } - - // Add triggered by note if from comment - if (context.eventName === 'issue_comment') { - await github.rest.issues.createComment({ - issue_number: prNumber, - owner: context.repo.owner, - repo: context.repo.repo, - body: `*Inline review triggered by @${context.payload.comment.user.login}*` + body: summaryBody }); } diff --git a/actions/general-review/action.yml b/actions/general-review/action.yml index 060494b94..bf5e221e1 100644 --- a/actions/general-review/action.yml +++ b/actions/general-review/action.yml @@ -29,12 +29,17 @@ runs: SHOULD_RUN="false" if [ "${{ github.event_name }}" = "pull_request" ]; then - # Check PR author association - AUTHOR_ASSOC="${{ github.event.pull_request.author_association }}" - if [ "$AUTHOR_ASSOC" = "OWNER" ] || [ "$AUTHOR_ASSOC" = "MEMBER" ] || [ "$AUTHOR_ASSOC" = "COLLABORATOR" ]; then - SHOULD_RUN="true" + # Check if PR is a draft + if [ "${{ github.event.pull_request.draft }}" = "true" ]; then + echo "::notice::Skipping review - PR is a draft" else - echo "::notice::Skipping review - PR author is not a team member (association: $AUTHOR_ASSOC)" + # Check PR author association + AUTHOR_ASSOC="${{ github.event.pull_request.author_association }}" + if [ "$AUTHOR_ASSOC" = "OWNER" ] || [ "$AUTHOR_ASSOC" = "MEMBER" ] || [ "$AUTHOR_ASSOC" = "COLLABORATOR" ]; then + SHOULD_RUN="true" + else + echo "::notice::Skipping review - PR author is not a team member (association: $AUTHOR_ASSOC)" + fi fi elif [ "${{ github.event_name }}" = "issue_comment" ]; then # Check if it's a PR comment with the trigger phrase