From d12a3519bcde69e3a94f20f60e34de899df28461 Mon Sep 17 00:00:00 2001 From: Himanshu Kumar Date: Wed, 22 Jul 2026 18:42:09 +0530 Subject: [PATCH 1/2] fix: use OpenCode app token for fork PR reviews --- .github/workflows/pr-review.yml | 2 -- 1 file changed, 2 deletions(-) diff --git a/.github/workflows/pr-review.yml b/.github/workflows/pr-review.yml index 60142dd..00f5181 100644 --- a/.github/workflows/pr-review.yml +++ b/.github/workflows/pr-review.yml @@ -48,10 +48,8 @@ jobs: uses: anomalyco/opencode/github@latest env: OPENCODE_API_KEY: ${{ secrets.OPENCODE_API_KEY }} - GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} with: model: opencode/deepseek-v4-flash-free - use_github_token: true prompt: | Review this pull request thoroughly. Provide a structured code review covering: From 8fe173adf4b1a921d838f8b8578c2e6bedfb1616 Mon Sep 17 00:00:00 2001 From: Himanshu Kumar Date: Wed, 22 Jul 2026 18:50:35 +0530 Subject: [PATCH 2/2] fix: use OpenCode CLI directly to bypass permission check --- .github/workflows/pr-review.yml | 75 +++++++++++++++++---------------- 1 file changed, 38 insertions(+), 37 deletions(-) diff --git a/.github/workflows/pr-review.yml b/.github/workflows/pr-review.yml index 00f5181..5d8d157 100644 --- a/.github/workflows/pr-review.yml +++ b/.github/workflows/pr-review.yml @@ -39,44 +39,45 @@ jobs: ref: ${{ github.event.pull_request.head.sha }} persist-credentials: false - - name: Configure git identity - run: | - git config user.name "github-actions[bot]" - git config user.email "41898282+github-actions[bot]@users.noreply.github.com" + - name: Install OpenCode + run: curl -fsSL https://opencode.ai/install | bash - name: Run OpenCode PR Review - uses: anomalyco/opencode/github@latest env: OPENCODE_API_KEY: ${{ secrets.OPENCODE_API_KEY }} - with: - model: opencode/deepseek-v4-flash-free - prompt: | - Review this pull request thoroughly. Provide a structured code review covering: - - ## Summary - Brief summary of what this PR does. - - ## Issues Found - For each issue found, categorize it: - - [BUG] — Logic errors, race conditions, edge cases - - [SECURITY] — Vulnerabilities, injection, secrets exposure - - [PERFORMANCE] — Inefficiency, N+1 queries, memory issues - - [STYLE] — Readability, naming, code organization - - [TEST] — Missing tests, weak assertions, coverage gaps - - Each issue should include: - - File path and line number - - Severity: LOW / MEDIUM / HIGH - - Description of the problem - - Suggested fix - - ## Positive Notes - Highlight what was done well (good patterns, clean code, proper tests). - - ## Verdict - - APPROVE — No blocking issues - - COMMENT — Minor suggestions, no blockers - - REQUEST CHANGES — Blocking issues that must be fixed - - Be specific and actionable. Reference actual code from the diff. - If no issues are found, say "No issues found. Good job!" + GH_TOKEN: ${{ secrets.GITHUB_TOKEN }} + run: | + REVIEW=$(opencode run --model opencode/deepseek-v4-flash-free --prompt " + Review this pull request thoroughly. Provide a structured code review covering: + + ## Summary + Brief summary of what this PR does. + + ## Issues Found + For each issue found, categorize it: + - [BUG] — Logic errors, race conditions, edge cases + - [SECURITY] — Vulnerabilities, injection, secrets exposure + - [PERFORMANCE] — Inefficiency, N+1 queries, memory issues + - [STYLE] — Readability, naming, code organization + - [TEST] — Missing tests, weak assertions, coverage gaps + + Each issue should include: + - File path and line number + - Severity: LOW / MEDIUM / HIGH + - Description of the problem + - Suggested fix + + ## Positive Notes + Highlight what was done well (good patterns, clean code, proper tests). + + ## Verdict + - APPROVE — No blocking issues + - COMMENT — Minor suggestions, no blockers + - REQUEST CHANGES — Blocking issues that must be fixed + + Be specific and actionable. Reference actual code from the diff. + If no issues are found, say 'No issues found. Good job!' + ") + + # Post review as comment using GitHub CLI + gh pr comment ${{ github.event.pull_request.number }} --body "$REVIEW"