From 1dbba32d085b8794bf55417086058bb26f81f0c8 Mon Sep 17 00:00:00 2001 From: Tomasz Stefaniak Date: Fri, 1 Aug 2025 13:40:47 -0700 Subject: [PATCH 01/16] Create cli-review.yaml --- .github/workflows/cli-review.yaml | 29 +++++++++++++++++++++++++++++ 1 file changed, 29 insertions(+) create mode 100644 .github/workflows/cli-review.yaml diff --git a/.github/workflows/cli-review.yaml b/.github/workflows/cli-review.yaml new file mode 100644 index 00000000000..c89de643b57 --- /dev/null +++ b/.github/workflows/cli-review.yaml @@ -0,0 +1,29 @@ +name: CLI Review + +on: + pull_request: + branches: + - main + + push: + branches: + - main + +jobs: + cli-review: + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v4 + + - name: Run Continue CLI Review + run: | + echo "Running Continue CLI with prompt:" + echo "==================================" + cat review_prompt.txt + echo "==================================" + echo "" + + # Run the CLI with the generated prompt and output text directly + cat review_prompt.txt | cn --config "${{ inputs.assistant }}" -p + env: + CONTINUE_API_KEY: ${{ secrets.CONTINUE_API_KEY }} \ No newline at end of file From 1bc77912c5f5750847409eced17ffd5f7ef3d166 Mon Sep 17 00:00:00 2001 From: Tomasz Stefaniak Date: Fri, 1 Aug 2025 13:46:32 -0700 Subject: [PATCH 02/16] Update cli-review.yaml --- .github/workflows/cli-review.yaml | 15 +++++++++++---- 1 file changed, 11 insertions(+), 4 deletions(-) diff --git a/.github/workflows/cli-review.yaml b/.github/workflows/cli-review.yaml index c89de643b57..8a6557be1e2 100644 --- a/.github/workflows/cli-review.yaml +++ b/.github/workflows/cli-review.yaml @@ -15,15 +15,22 @@ jobs: steps: - uses: actions/checkout@v4 + - uses: actions/setup-node@v4 + with: + node-version-file: ".nvmrc" + + - name: Install Continue CLI + run: npm install -g @continuedev/cli@1.4.21 + - name: Run Continue CLI Review run: | - echo "Running Continue CLI with prompt:" + echo "Running Continue CLI with hardcoded prompt:" echo "==================================" - cat review_prompt.txt + echo "Review this pull request and provide feedback on code quality" echo "==================================" echo "" - # Run the CLI with the generated prompt and output text directly - cat review_prompt.txt | cn --config "${{ inputs.assistant }}" -p + # Run the CLI with a hardcoded prompt and output text directly + echo "Review this pull request and provide feedback on code quality" | cn --config "${{ inputs.assistant }}" -p env: CONTINUE_API_KEY: ${{ secrets.CONTINUE_API_KEY }} \ No newline at end of file From 32a8eed9e1b9714b3d917baf1eb78f0a8cc6b5a0 Mon Sep 17 00:00:00 2001 From: Tomasz Stefaniak Date: Tue, 12 Aug 2025 07:50:53 -0700 Subject: [PATCH 03/16] Update cli-review.yaml --- .github/workflows/cli-review.yaml | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/.github/workflows/cli-review.yaml b/.github/workflows/cli-review.yaml index 8a6557be1e2..2deab2871bf 100644 --- a/.github/workflows/cli-review.yaml +++ b/.github/workflows/cli-review.yaml @@ -14,14 +14,14 @@ jobs: runs-on: ubuntu-latest steps: - uses: actions/checkout@v4 - + - uses: actions/setup-node@v4 with: node-version-file: ".nvmrc" - + - name: Install Continue CLI run: npm install -g @continuedev/cli@1.4.21 - + - name: Run Continue CLI Review run: | echo "Running Continue CLI with hardcoded prompt:" @@ -31,6 +31,6 @@ jobs: echo "" # Run the CLI with a hardcoded prompt and output text directly - echo "Review this pull request and provide feedback on code quality" | cn --config "${{ inputs.assistant }}" -p + echo "Review this pull request and provide feedback on code quality" | cn -p --org continuedev env: - CONTINUE_API_KEY: ${{ secrets.CONTINUE_API_KEY }} \ No newline at end of file + CONTINUE_API_KEY: ${{ secrets.CONTINUE_API_KEY }} From b04c6f62f37f0313499706be46e36065331c0801 Mon Sep 17 00:00:00 2001 From: Tomasz Stefaniak Date: Tue, 12 Aug 2025 07:57:40 -0700 Subject: [PATCH 04/16] Update cli-review.yaml --- .github/workflows/cli-review.yaml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/cli-review.yaml b/.github/workflows/cli-review.yaml index 2deab2871bf..9388bdeaf95 100644 --- a/.github/workflows/cli-review.yaml +++ b/.github/workflows/cli-review.yaml @@ -20,7 +20,7 @@ jobs: node-version-file: ".nvmrc" - name: Install Continue CLI - run: npm install -g @continuedev/cli@1.4.21 + run: npm install -g @continuedev/cli@1.4.25 - name: Run Continue CLI Review run: | From 3de7baa8ff3f3646d9b8eeaf9e2fbd74030d7d86 Mon Sep 17 00:00:00 2001 From: Tomasz Stefaniak Date: Tue, 12 Aug 2025 08:35:31 -0700 Subject: [PATCH 05/16] feat: add continue-review.yaml --- .github/workflows/continue-review.yaml | 253 +++++++++++++++++++++++++ 1 file changed, 253 insertions(+) create mode 100644 .github/workflows/continue-review.yaml diff --git a/.github/workflows/continue-review.yaml b/.github/workflows/continue-review.yaml new file mode 100644 index 00000000000..8bc8b1519de --- /dev/null +++ b/.github/workflows/continue-review.yaml @@ -0,0 +1,253 @@ +name: Continue CLI Code Review + +on: + workflow_call: + inputs: + assistant: + description: "Assistant configuration to use" + required: false + default: "nate/default-assistant" + type: string + prompt: + description: "Custom prompt to use instead of the default PR review" + required: false + type: string + secrets: + CONTINUE_API_KEY: + required: true + workflow_dispatch: + inputs: + assistant: + description: "Assistant configuration to use" + required: false + default: "nate/default-assistant" + type: string + prompt: + description: "Custom prompt to use instead of the default PR review" + required: false + type: string + +permissions: + contents: read + pull-requests: write + issues: write + +jobs: + code-review: + name: AI Code Review + runs-on: ubuntu-latest + + steps: + - name: Checkout Repository + uses: actions/checkout@v4 + with: + fetch-depth: 0 # Fetch full history for better context + + - name: Setup Node.js + uses: actions/setup-node@v4 + with: + node-version: 20 + + - name: Install Continue CLI + run: npm install -g @continuedev/cli@1.4.25 + + - name: Build PR diff prompt + if: github.event_name == 'pull_request' || (github.event_name == 'workflow_run' && github.event.workflow_run.event == 'pull_request') + run: | + # Get PR number - different methods depending on trigger + if [ "${{ github.event_name }}" = "pull_request" ]; then + PR_NUMBER="${{ github.event.number }}" + else + # For workflow_call triggered by PR, we need to get it from context + PR_NUMBER=$(jq -r '.pull_request.number' "$GITHUB_EVENT_PATH" 2>/dev/null || echo "") + fi + + if [ -n "$PR_NUMBER" ] && [ "$PR_NUMBER" != "null" ]; then + # Get PR diff using GitHub CLI + gh pr diff $PR_NUMBER > pr_diff.txt + + # Create comprehensive prompt + cat > review_prompt.txt << 'EOF' + You are conducting a code review for a pull request. Below is the git diff showing all the changes: + + EOF + + echo "--- PR DIFF START ---" >> review_prompt.txt + cat pr_diff.txt >> review_prompt.txt + echo "--- PR DIFF END ---" >> review_prompt.txt + + cat >> review_prompt.txt << 'EOF' + + Please analyze these changes and provide a comprehensive code review. Consider: + + 1. **Code Quality**: Are there any bugs, performance issues, or code smells? + 2. **Best Practices**: Does the code follow established patterns and conventions? + 3. **Security**: Are there any potential security vulnerabilities? + 4. **Testing**: Are appropriate tests included or updated? + 5. **Documentation**: Is documentation adequate for the changes? + 6. **Architecture**: Do the changes fit well with the existing codebase structure? + + You can use the available tools to explore the codebase and understand context better. + + Format your response as a markdown code review with the following structure: + + ## Code Review Summary + + ### ✅ Strengths + - [List positive aspects] + + ### ⚠️ Issues Found + - [List any problems with severity levels] + + ### 💡 Suggestions + - [List improvement recommendations] + + ### 🚀 Overall Assessment + [Provide overall recommendation: APPROVE, REQUEST_CHANGES, or COMMENT] + + Only call the 'exit' tool if you find critical security vulnerabilities or bugs that would break production. + EOF + else + echo "Could not determine PR number, using generic prompt" + cat > review_prompt.txt << 'EOF' + Please review the recent changes to this codebase and provide feedback on code quality, potential issues, and suggestions for improvement. + + Format your response as a markdown code review. + EOF + fi + env: + GH_TOKEN: ${{ github.token }} + + - name: Build custom prompt + if: inputs.prompt != '' + env: + GITHUB_TOKEN: ${{ github.token }} + run: | + # Get PR number for custom prompts too + if [ "${{ github.event_name }}" = "pull_request" ]; then + PR_NUMBER="${{ github.event.number }}" + else + # For workflow_call triggered by PR, we need to get it from context + PR_NUMBER=$(jq -r '.pull_request.number' "$GITHUB_EVENT_PATH" 2>/dev/null || echo "") + fi + + if [ -n "$PR_NUMBER" ] && [ "$PR_NUMBER" != "null" ]; then + # Get PR diff using GitHub CLI + gh pr diff $PR_NUMBER > pr_diff.txt + + # Create custom prompt with diff included + echo "${{ inputs.prompt }}" > review_prompt.txt + echo "" >> review_prompt.txt + echo "Below is the git diff showing all the changes:" >> review_prompt.txt + echo "" >> review_prompt.txt + echo "--- PR DIFF START ---" >> review_prompt.txt + cat pr_diff.txt >> review_prompt.txt + echo "--- PR DIFF END ---" >> review_prompt.txt + else + echo "${{ inputs.prompt }}" > review_prompt.txt + fi + + - name: Build default prompt for non-PR triggers + if: inputs.prompt == '' && github.event_name != 'pull_request' && (github.event_name != 'workflow_run' || github.event.workflow_run.event != 'pull_request') + run: | + cat > review_prompt.txt << 'EOF' + Please review the recent changes to this codebase and provide feedback on code quality, potential issues, and suggestions for improvement. You do not need to acknowledge what was done well. + + Format your response as a markdown code review with each comment having only a short description about the problem and suggested solution, each being separated by "\n\n---\n\n". + + EOF + + - name: Run Continue CLI Review + run: | + echo "Running Continue CLI with prompt:" + echo "==================================" + cat review_prompt.txt + echo "==================================" + echo "" + + # Run the CLI with the generated prompt and pipe output to code_review.md + cat review_prompt.txt | cn --auto --config "${{ inputs.assistant }}" -p > code_review.md + env: + CONTINUE_API_KEY: ${{ secrets.CONTINUE_API_KEY }} + + - name: Upload Review Results + uses: actions/upload-artifact@v4 + if: always() + with: + name: code-review-results + path: | + code_review.md + review_prompt.txt + pr_diff.txt + retention-days: 30 + + - name: Comment PR with Review + if: always() && (github.event_name == 'pull_request' || (github.event_name == 'workflow_run' && github.event.workflow_run.event == 'pull_request')) + uses: actions/github-script@v7 + with: + script: | + const fs = require('fs'); + + try { + let reviewContent = ''; + + if (fs.existsSync('code_review.md') && fs.statSync('code_review.md').size > 0) { + reviewContent = fs.readFileSync('code_review.md', 'utf8'); + } else { + reviewContent = '⚠️ AI review completed but no review output was generated. Check the action logs for details.'; + } + + // Get PR number + let prNumber; + if (context.payload.pull_request) { + prNumber = context.payload.pull_request.number; + } else if (context.payload.workflow_run && context.payload.workflow_run.pull_requests && context.payload.workflow_run.pull_requests.length > 0) { + prNumber = context.payload.workflow_run.pull_requests[0].number; + } + + if (!prNumber) { + console.log('Could not determine PR number for commenting'); + return; + } + + // Unique identifier for our bot comments + const botSignature = ''; + const newComment = `${botSignature}\n${reviewContent}`; + + // Get all comments on the PR + const { data: comments } = await github.rest.issues.listComments({ per_page: 100, + issue_number: prNumber, + owner: context.repo.owner, + repo: context.repo.repo, + }); + + // Find existing Continue CLI review comment + const existingComment = comments.find(comment => + comment.body.includes(botSignature) + ); + + if (existingComment) { + // Update existing comment + await github.rest.issues.updateComment({ + comment_id: existingComment.id, + owner: context.repo.owner, + repo: context.repo.repo, + body: newComment + }); + console.log(`Successfully updated existing comment #${existingComment.id} on PR #${prNumber}`); + } else { + // Create new comment + await github.rest.issues.createComment({ + issue_number: prNumber, + owner: context.repo.owner, + repo: context.repo.repo, + body: newComment + }); + console.log(`Successfully created new comment on PR #${prNumber}`); + } + } catch (error) { + console.log('Failed to post/update comment:', error.message); + console.log('Error details:', error); + } + env: + GITHUB_TOKEN: ${{ github.token }} From 2b384e7fb5f6b4bc695626bb06a1409505320dbd Mon Sep 17 00:00:00 2001 From: Tomasz Stefaniak Date: Tue, 12 Aug 2025 08:45:44 -0700 Subject: [PATCH 06/16] Update continue-review.yaml --- .github/workflows/continue-review.yaml | 132 ++++--------------------- 1 file changed, 21 insertions(+), 111 deletions(-) diff --git a/.github/workflows/continue-review.yaml b/.github/workflows/continue-review.yaml index 8bc8b1519de..c2d98917510 100644 --- a/.github/workflows/continue-review.yaml +++ b/.github/workflows/continue-review.yaml @@ -1,31 +1,8 @@ name: Continue CLI Code Review on: - workflow_call: - inputs: - assistant: - description: "Assistant configuration to use" - required: false - default: "nate/default-assistant" - type: string - prompt: - description: "Custom prompt to use instead of the default PR review" - required: false - type: string - secrets: - CONTINUE_API_KEY: - required: true - workflow_dispatch: - inputs: - assistant: - description: "Assistant configuration to use" - required: false - default: "nate/default-assistant" - type: string - prompt: - description: "Custom prompt to use instead of the default PR review" - required: false - type: string + pull_request: + types: [opened, synchronize, reopened] permissions: contents: read @@ -51,32 +28,22 @@ jobs: - name: Install Continue CLI run: npm install -g @continuedev/cli@1.4.25 - - name: Build PR diff prompt - if: github.event_name == 'pull_request' || (github.event_name == 'workflow_run' && github.event.workflow_run.event == 'pull_request') + - name: Build PR Review Prompt run: | - # Get PR number - different methods depending on trigger - if [ "${{ github.event_name }}" = "pull_request" ]; then - PR_NUMBER="${{ github.event.number }}" - else - # For workflow_call triggered by PR, we need to get it from context - PR_NUMBER=$(jq -r '.pull_request.number' "$GITHUB_EVENT_PATH" 2>/dev/null || echo "") - fi - - if [ -n "$PR_NUMBER" ] && [ "$PR_NUMBER" != "null" ]; then - # Get PR diff using GitHub CLI - gh pr diff $PR_NUMBER > pr_diff.txt - - # Create comprehensive prompt - cat > review_prompt.txt << 'EOF' + # Get PR diff + gh pr diff ${{ github.event.number }} > pr_diff.txt + + # Create review prompt + cat > review_prompt.txt << 'EOF' You are conducting a code review for a pull request. Below is the git diff showing all the changes: EOF - - echo "--- PR DIFF START ---" >> review_prompt.txt - cat pr_diff.txt >> review_prompt.txt - echo "--- PR DIFF END ---" >> review_prompt.txt - - cat >> review_prompt.txt << 'EOF' + + echo "--- PR DIFF START ---" >> review_prompt.txt + cat pr_diff.txt >> review_prompt.txt + echo "--- PR DIFF END ---" >> review_prompt.txt + + cat >> review_prompt.txt << 'EOF' Please analyze these changes and provide a comprehensive code review. Consider: @@ -107,56 +74,9 @@ jobs: Only call the 'exit' tool if you find critical security vulnerabilities or bugs that would break production. EOF - else - echo "Could not determine PR number, using generic prompt" - cat > review_prompt.txt << 'EOF' - Please review the recent changes to this codebase and provide feedback on code quality, potential issues, and suggestions for improvement. - - Format your response as a markdown code review. - EOF - fi env: GH_TOKEN: ${{ github.token }} - - name: Build custom prompt - if: inputs.prompt != '' - env: - GITHUB_TOKEN: ${{ github.token }} - run: | - # Get PR number for custom prompts too - if [ "${{ github.event_name }}" = "pull_request" ]; then - PR_NUMBER="${{ github.event.number }}" - else - # For workflow_call triggered by PR, we need to get it from context - PR_NUMBER=$(jq -r '.pull_request.number' "$GITHUB_EVENT_PATH" 2>/dev/null || echo "") - fi - - if [ -n "$PR_NUMBER" ] && [ "$PR_NUMBER" != "null" ]; then - # Get PR diff using GitHub CLI - gh pr diff $PR_NUMBER > pr_diff.txt - - # Create custom prompt with diff included - echo "${{ inputs.prompt }}" > review_prompt.txt - echo "" >> review_prompt.txt - echo "Below is the git diff showing all the changes:" >> review_prompt.txt - echo "" >> review_prompt.txt - echo "--- PR DIFF START ---" >> review_prompt.txt - cat pr_diff.txt >> review_prompt.txt - echo "--- PR DIFF END ---" >> review_prompt.txt - else - echo "${{ inputs.prompt }}" > review_prompt.txt - fi - - - name: Build default prompt for non-PR triggers - if: inputs.prompt == '' && github.event_name != 'pull_request' && (github.event_name != 'workflow_run' || github.event.workflow_run.event != 'pull_request') - run: | - cat > review_prompt.txt << 'EOF' - Please review the recent changes to this codebase and provide feedback on code quality, potential issues, and suggestions for improvement. You do not need to acknowledge what was done well. - - Format your response as a markdown code review with each comment having only a short description about the problem and suggested solution, each being separated by "\n\n---\n\n". - - EOF - - name: Run Continue CLI Review run: | echo "Running Continue CLI with prompt:" @@ -165,8 +85,8 @@ jobs: echo "==================================" echo "" - # Run the CLI with the generated prompt and pipe output to code_review.md - cat review_prompt.txt | cn --auto --config "${{ inputs.assistant }}" -p > code_review.md + # Run the CLI with hardcoded assistant and pipe output to code_review.md + cat review_prompt.txt | cn --auto --config "nate/default-assistant" -p > code_review.md env: CONTINUE_API_KEY: ${{ secrets.CONTINUE_API_KEY }} @@ -182,7 +102,7 @@ jobs: retention-days: 30 - name: Comment PR with Review - if: always() && (github.event_name == 'pull_request' || (github.event_name == 'workflow_run' && github.event.workflow_run.event == 'pull_request')) + if: always() uses: actions/github-script@v7 with: script: | @@ -197,25 +117,15 @@ jobs: reviewContent = '⚠️ AI review completed but no review output was generated. Check the action logs for details.'; } - // Get PR number - let prNumber; - if (context.payload.pull_request) { - prNumber = context.payload.pull_request.number; - } else if (context.payload.workflow_run && context.payload.workflow_run.pull_requests && context.payload.workflow_run.pull_requests.length > 0) { - prNumber = context.payload.workflow_run.pull_requests[0].number; - } - - if (!prNumber) { - console.log('Could not determine PR number for commenting'); - return; - } + const prNumber = context.payload.pull_request.number; // Unique identifier for our bot comments const botSignature = ''; const newComment = `${botSignature}\n${reviewContent}`; // Get all comments on the PR - const { data: comments } = await github.rest.issues.listComments({ per_page: 100, + const { data: comments } = await github.rest.issues.listComments({ + per_page: 100, issue_number: prNumber, owner: context.repo.owner, repo: context.repo.repo, @@ -250,4 +160,4 @@ jobs: console.log('Error details:', error); } env: - GITHUB_TOKEN: ${{ github.token }} + GITHUB_TOKEN: ${{ github.token }} \ No newline at end of file From 8b2686c903dd8cddee17cbdb9265548157116fb4 Mon Sep 17 00:00:00 2001 From: Tomasz Stefaniak Date: Tue, 12 Aug 2025 08:46:22 -0700 Subject: [PATCH 07/16] Update continue-review.yaml --- .github/workflows/continue-review.yaml | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/.github/workflows/continue-review.yaml b/.github/workflows/continue-review.yaml index c2d98917510..8e8e656c393 100644 --- a/.github/workflows/continue-review.yaml +++ b/.github/workflows/continue-review.yaml @@ -2,7 +2,7 @@ name: Continue CLI Code Review on: pull_request: - types: [opened, synchronize, reopened] + types: [opened, ready_for_review] permissions: contents: read @@ -29,6 +29,7 @@ jobs: run: npm install -g @continuedev/cli@1.4.25 - name: Build PR Review Prompt + if: github.event.pull_request.draft == false run: | # Get PR diff gh pr diff ${{ github.event.number }} > pr_diff.txt From ae028938a94cd3595df51022cd987cbeb0d9b514 Mon Sep 17 00:00:00 2001 From: Tomasz Stefaniak Date: Tue, 12 Aug 2025 09:01:35 -0700 Subject: [PATCH 08/16] improv: use org setup --- .github/workflows/continue-review.yaml | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/.github/workflows/continue-review.yaml b/.github/workflows/continue-review.yaml index 8e8e656c393..03f97b9904c 100644 --- a/.github/workflows/continue-review.yaml +++ b/.github/workflows/continue-review.yaml @@ -33,17 +33,17 @@ jobs: run: | # Get PR diff gh pr diff ${{ github.event.number }} > pr_diff.txt - + # Create review prompt cat > review_prompt.txt << 'EOF' You are conducting a code review for a pull request. Below is the git diff showing all the changes: EOF - + echo "--- PR DIFF START ---" >> review_prompt.txt cat pr_diff.txt >> review_prompt.txt echo "--- PR DIFF END ---" >> review_prompt.txt - + cat >> review_prompt.txt << 'EOF' Please analyze these changes and provide a comprehensive code review. Consider: @@ -87,7 +87,7 @@ jobs: echo "" # Run the CLI with hardcoded assistant and pipe output to code_review.md - cat review_prompt.txt | cn --auto --config "nate/default-assistant" -p > code_review.md + cat review_prompt.txt | cn --auto --org continuedev --config continuedev/review-bot -p > code_review.md env: CONTINUE_API_KEY: ${{ secrets.CONTINUE_API_KEY }} @@ -161,4 +161,4 @@ jobs: console.log('Error details:', error); } env: - GITHUB_TOKEN: ${{ github.token }} \ No newline at end of file + GITHUB_TOKEN: ${{ github.token }} From 7dec41f8af6916fed02d8de9a6f513d11f61ea70 Mon Sep 17 00:00:00 2001 From: Tomasz Stefaniak Date: Tue, 12 Aug 2025 09:16:33 -0700 Subject: [PATCH 09/16] Delete cli-review.yaml --- .github/workflows/cli-review.yaml | 36 ------------------------------- 1 file changed, 36 deletions(-) delete mode 100644 .github/workflows/cli-review.yaml diff --git a/.github/workflows/cli-review.yaml b/.github/workflows/cli-review.yaml deleted file mode 100644 index 9388bdeaf95..00000000000 --- a/.github/workflows/cli-review.yaml +++ /dev/null @@ -1,36 +0,0 @@ -name: CLI Review - -on: - pull_request: - branches: - - main - - push: - branches: - - main - -jobs: - cli-review: - runs-on: ubuntu-latest - steps: - - uses: actions/checkout@v4 - - - uses: actions/setup-node@v4 - with: - node-version-file: ".nvmrc" - - - name: Install Continue CLI - run: npm install -g @continuedev/cli@1.4.25 - - - name: Run Continue CLI Review - run: | - echo "Running Continue CLI with hardcoded prompt:" - echo "==================================" - echo "Review this pull request and provide feedback on code quality" - echo "==================================" - echo "" - - # Run the CLI with a hardcoded prompt and output text directly - echo "Review this pull request and provide feedback on code quality" | cn -p --org continuedev - env: - CONTINUE_API_KEY: ${{ secrets.CONTINUE_API_KEY }} From f15c140d934328b56e8373e77fb53afcae1797ad Mon Sep 17 00:00:00 2001 From: Tomasz Stefaniak Date: Tue, 12 Aug 2025 09:21:24 -0700 Subject: [PATCH 10/16] improv: always leave a new comment --- .github/workflows/continue-review.yaml | 38 ++++---------------------- 1 file changed, 5 insertions(+), 33 deletions(-) diff --git a/.github/workflows/continue-review.yaml b/.github/workflows/continue-review.yaml index 03f97b9904c..c269a3985d0 100644 --- a/.github/workflows/continue-review.yaml +++ b/.github/workflows/continue-review.yaml @@ -120,44 +120,16 @@ jobs: const prNumber = context.payload.pull_request.number; - // Unique identifier for our bot comments - const botSignature = ''; - const newComment = `${botSignature}\n${reviewContent}`; - - // Get all comments on the PR - const { data: comments } = await github.rest.issues.listComments({ - per_page: 100, + // Create new comment + await github.rest.issues.createComment({ issue_number: prNumber, owner: context.repo.owner, repo: context.repo.repo, + body: reviewContent }); - - // Find existing Continue CLI review comment - const existingComment = comments.find(comment => - comment.body.includes(botSignature) - ); - - if (existingComment) { - // Update existing comment - await github.rest.issues.updateComment({ - comment_id: existingComment.id, - owner: context.repo.owner, - repo: context.repo.repo, - body: newComment - }); - console.log(`Successfully updated existing comment #${existingComment.id} on PR #${prNumber}`); - } else { - // Create new comment - await github.rest.issues.createComment({ - issue_number: prNumber, - owner: context.repo.owner, - repo: context.repo.repo, - body: newComment - }); - console.log(`Successfully created new comment on PR #${prNumber}`); - } + console.log(`Successfully created new comment on PR #${prNumber}`); } catch (error) { - console.log('Failed to post/update comment:', error.message); + console.log('Failed to post comment:', error.message); console.log('Error details:', error); } env: From 7c2cb65ea1073b5965aa7ccaa4578671895f2ae9 Mon Sep 17 00:00:00 2001 From: Tomasz Stefaniak Date: Tue, 12 Aug 2025 09:25:17 -0700 Subject: [PATCH 11/16] Update continue-review.yaml --- .github/workflows/continue-review.yaml | 1 + 1 file changed, 1 insertion(+) diff --git a/.github/workflows/continue-review.yaml b/.github/workflows/continue-review.yaml index c269a3985d0..53a68fb2acd 100644 --- a/.github/workflows/continue-review.yaml +++ b/.github/workflows/continue-review.yaml @@ -13,6 +13,7 @@ jobs: code-review: name: AI Code Review runs-on: ubuntu-latest + timeout-minutes: 10 steps: - name: Checkout Repository From a7e2d6f520e386578c4e7e2b526e3c3fdb7bf510 Mon Sep 17 00:00:00 2001 From: Tomasz Stefaniak Date: Tue, 12 Aug 2025 10:11:37 -0700 Subject: [PATCH 12/16] feat: summon bot --- .github/workflows/continue-review.yaml | 35 +++++++++++++++++++++++--- 1 file changed, 31 insertions(+), 4 deletions(-) diff --git a/.github/workflows/continue-review.yaml b/.github/workflows/continue-review.yaml index 53a68fb2acd..225a3e35131 100644 --- a/.github/workflows/continue-review.yaml +++ b/.github/workflows/continue-review.yaml @@ -3,6 +3,8 @@ name: Continue CLI Code Review on: pull_request: types: [opened, ready_for_review] + issue_comment: + types: [created] permissions: contents: read @@ -14,6 +16,12 @@ jobs: name: AI Code Review runs-on: ubuntu-latest timeout-minutes: 10 + # Only run if it's a PR event OR if it's a comment with @continue-review on a PR + if: | + github.event_name == 'pull_request' || + (github.event_name == 'issue_comment' && + github.event.issue.pull_request && + contains(github.event.comment.body, '@continue-review')) steps: - name: Checkout Repository @@ -30,10 +38,17 @@ jobs: run: npm install -g @continuedev/cli@1.4.25 - name: Build PR Review Prompt - if: github.event.pull_request.draft == false run: | + # Get PR number based on event type + if [ "${{ github.event_name }}" = "pull_request" ]; then + PR_NUMBER="${{ github.event.number }}" + else + # For issue_comment event on a PR + PR_NUMBER="${{ github.event.issue.number }}" + fi + # Get PR diff - gh pr diff ${{ github.event.number }} > pr_diff.txt + gh pr diff $PR_NUMBER > pr_diff.txt # Create review prompt cat > review_prompt.txt << 'EOF' @@ -119,7 +134,19 @@ jobs: reviewContent = '⚠️ AI review completed but no review output was generated. Check the action logs for details.'; } - const prNumber = context.payload.pull_request.number; + // Get PR number based on event type + let prNumber; + if (context.eventName === 'pull_request') { + prNumber = context.payload.pull_request.number; + } else { + // For issue_comment event + prNumber = context.payload.issue.number; + } + + // Add a header if triggered by comment + if (context.eventName === 'issue_comment') { + reviewContent = `*Triggered by @${context.payload.comment.user.login}'s request*\n\n${reviewContent}`; + } // Create new comment await github.rest.issues.createComment({ @@ -134,4 +161,4 @@ jobs: console.log('Error details:', error); } env: - GITHUB_TOKEN: ${{ github.token }} + GITHUB_TOKEN: ${{ github.token }} \ No newline at end of file From e623242d3cf06dbe2fb547968d014b13e5443783 Mon Sep 17 00:00:00 2001 From: Tomasz Stefaniak Date: Tue, 12 Aug 2025 10:23:52 -0700 Subject: [PATCH 13/16] improv: add temporary permissions checks --- .github/workflows/continue-review.yaml | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/.github/workflows/continue-review.yaml b/.github/workflows/continue-review.yaml index 225a3e35131..f6f898bec13 100644 --- a/.github/workflows/continue-review.yaml +++ b/.github/workflows/continue-review.yaml @@ -16,9 +16,14 @@ jobs: name: AI Code Review runs-on: ubuntu-latest timeout-minutes: 10 - # Only run if it's a PR event OR if it's a comment with @continue-review on a PR + # Only run if: + # - It's a PR event from a team member (with write/admin permissions) + # - OR it's a comment with @continue-review on a PR (from anyone) if: | - github.event_name == 'pull_request' || + (github.event_name == 'pull_request' && + (github.event.pull_request.author_association == 'OWNER' || + github.event.pull_request.author_association == 'MEMBER' || + github.event.pull_request.author_association == 'COLLABORATOR')) || (github.event_name == 'issue_comment' && github.event.issue.pull_request && contains(github.event.comment.body, '@continue-review')) From 45c19fafdfd71a7b6950a951048b6a39b95653fa Mon Sep 17 00:00:00 2001 From: Tomasz Stefaniak Date: Tue, 12 Aug 2025 10:25:49 -0700 Subject: [PATCH 14/16] improv: add AI code reviews --- .github/pull_request_template.md | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/.github/pull_request_template.md b/.github/pull_request_template.md index 348566cd889..62ec1fb8974 100644 --- a/.github/pull_request_template.md +++ b/.github/pull_request_template.md @@ -2,6 +2,11 @@ [ What changed? Feel free to be brief. ] +## AI Code Review + +- **Team members**: AI review will run automatically when PR is opened or marked ready for review +- **Community contributors**: Request AI review by commenting `@continue-review` on your PR + ## Checklist - [] I've read the [contributing guide](https://github.com/continuedev/continue/blob/main/CONTRIBUTING.md) From fafea05500f447035901b4b6439f058545a9b9ca Mon Sep 17 00:00:00 2001 From: Tomasz Stefaniak Date: Tue, 12 Aug 2025 11:09:49 -0700 Subject: [PATCH 15/16] improv: make it readonly and allow to summon by comment from members only --- .github/pull_request_template.md | 4 ++-- .github/workflows/continue-review.yaml | 9 ++++++--- 2 files changed, 8 insertions(+), 5 deletions(-) diff --git a/.github/pull_request_template.md b/.github/pull_request_template.md index 62ec1fb8974..281f61c1f43 100644 --- a/.github/pull_request_template.md +++ b/.github/pull_request_template.md @@ -4,8 +4,8 @@ ## AI Code Review -- **Team members**: AI review will run automatically when PR is opened or marked ready for review -- **Community contributors**: Request AI review by commenting `@continue-review` on your PR +- **Team members only**: AI review runs automatically when PR is opened or marked ready for review +- Team members can also trigger a review by commenting `@continue-review` ## Checklist diff --git a/.github/workflows/continue-review.yaml b/.github/workflows/continue-review.yaml index f6f898bec13..6c282ae57e9 100644 --- a/.github/workflows/continue-review.yaml +++ b/.github/workflows/continue-review.yaml @@ -18,7 +18,7 @@ jobs: timeout-minutes: 10 # Only run if: # - It's a PR event from a team member (with write/admin permissions) - # - OR it's a comment with @continue-review on a PR (from anyone) + # - OR it's a comment with @continue-review on a PR from a team member if: | (github.event_name == 'pull_request' && (github.event.pull_request.author_association == 'OWNER' || @@ -26,7 +26,10 @@ jobs: github.event.pull_request.author_association == 'COLLABORATOR')) || (github.event_name == 'issue_comment' && github.event.issue.pull_request && - contains(github.event.comment.body, '@continue-review')) + contains(github.event.comment.body, '@continue-review') && + (github.event.comment.author_association == 'OWNER' || + github.event.comment.author_association == 'MEMBER' || + github.event.comment.author_association == 'COLLABORATOR')) steps: - name: Checkout Repository @@ -108,7 +111,7 @@ jobs: echo "" # Run the CLI with hardcoded assistant and pipe output to code_review.md - cat review_prompt.txt | cn --auto --org continuedev --config continuedev/review-bot -p > code_review.md + cat review_prompt.txt | cn --readonly --org continuedev --config continuedev/review-bot -p > code_review.md env: CONTINUE_API_KEY: ${{ secrets.CONTINUE_API_KEY }} From 9150b6f68028d02a62676448ef295b99f3cad33b Mon Sep 17 00:00:00 2001 From: Tomasz Stefaniak Date: Tue, 12 Aug 2025 11:30:02 -0700 Subject: [PATCH 16/16] improv: prompt --- .github/workflows/continue-review.yaml | 24 +++++++++++++++++++----- 1 file changed, 19 insertions(+), 5 deletions(-) diff --git a/.github/workflows/continue-review.yaml b/.github/workflows/continue-review.yaml index 6c282ae57e9..95a9c48ea9d 100644 --- a/.github/workflows/continue-review.yaml +++ b/.github/workflows/continue-review.yaml @@ -54,7 +54,7 @@ jobs: # For issue_comment event on a PR PR_NUMBER="${{ github.event.issue.number }}" fi - + # Get PR diff gh pr diff $PR_NUMBER > pr_diff.txt @@ -86,13 +86,27 @@ jobs: ## Code Review Summary ### ✅ Strengths - - [List positive aspects] + - **[Aspect]**: [Description of what was done well] ### ⚠️ Issues Found - - [List any problems with severity levels] + + Only include the severity subheaders below if you actually found issues at that level: + + #### Critical + - **[Issue Title]**: [Description of critical issues that must be fixed before merging] + + #### High + - **[Issue Title]**: [Description of high-priority issues that should be fixed] + + #### Medium + - **[Issue Title]**: [Description of issues that should be addressed] + + #### Low + - **[Issue Title]**: [Description of minor issues or nice-to-have improvements] + ### 💡 Suggestions - - [List improvement recommendations] + - **[Suggestion Title]**: [Description of improvement recommendations] ### 🚀 Overall Assessment [Provide overall recommendation: APPROVE, REQUEST_CHANGES, or COMMENT] @@ -169,4 +183,4 @@ jobs: console.log('Error details:', error); } env: - GITHUB_TOKEN: ${{ github.token }} \ No newline at end of file + GITHUB_TOKEN: ${{ github.token }}