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.' + })