From 33b71992e49c3f632adb1aad1eb2383ac44ea1b4 Mon Sep 17 00:00:00 2001 From: cliffhall Date: Tue, 6 Jan 2026 15:36:17 -0500 Subject: [PATCH] Allow Claude to safely do code review automatically and from forks. Doesn't change the existing Claude workflow. * Added claude_pr_review.yml --- .github/workflows/claude_pr_review.yml | 46 ++++++++++++++++++++++++++ 1 file changed, 46 insertions(+) create mode 100644 .github/workflows/claude_pr_review.yml diff --git a/.github/workflows/claude_pr_review.yml b/.github/workflows/claude_pr_review.yml new file mode 100644 index 00000000..a64276b8 --- /dev/null +++ b/.github/workflows/claude_pr_review.yml @@ -0,0 +1,46 @@ +name: Claude Code Review + +on: + pull_request: + types: [opened, synchronize, reopened] + +permissions: + contents: read + pull-requests: write + +jobs: + claude-review: + runs-on: ubuntu-latest + + steps: + - name: Checkout PR branch from fork + uses: actions/checkout@v4 + with: + ref: ${{ github.event.pull_request.head.ref }} + repository: ${{ github.event.pull_request.head.repo.full_name }} + fetch-depth: 0 + + - name: Run Claude Code Review + id: claude-review + uses: anthropics/claude-code-action@v1 + with: + anthropic_api_key: ${{ secrets.ANTHROPIC_API_KEY }} + github_token: ${{ secrets.GITHUB_TOKEN }} + instructions: | + Please review this PR focusing on: + - TypeScript type safety + - MCP protocol compliance + - Security vulnerabilities + - Performance implications + + - name: Comment on failure + if: failure() + uses: actions/github-script@v7 + with: + script: | + github.rest.issues.createComment({ + issue_number: context.issue.number, + owner: context.repo.owner, + repo: context.repo.repo, + body: '❌ Claude Code review failed. Please check the [action logs](${{ github.server_url }}/${{ github.repository }}/actions/runs/${{ github.run_id }}) for details.' + })