diff --git a/.github/workflows/claude_pr_review.yml b/.github/workflows/claude_pr_review.yml new file mode 100644 index 00000000000000..a8cd89be1dfc20 --- /dev/null +++ b/.github/workflows/claude_pr_review.yml @@ -0,0 +1,56 @@ +name: Claude Auto Review + +on: + pull_request: + types: [opened, synchronize] + +jobs: + review: + runs-on: ubuntu-latest + timeout-minutes: 60 + permissions: + contents: read + pull-requests: write + id-token: write + steps: + - uses: actions/checkout@v5 + with: + fetch-depth: 1 + + - name: Setup Node.js + uses: actions/setup-node@v4 + with: + node-version: '24' + + - name: Install Claude Code + shell: bash + run: npm install -g @anthropic-ai/claude-code + + - name: Create prompt file + shell: bash + run: | + cat > /tmp/prompt.txt << 'EOF' + REPO: ${{ github.repository }} + PR NUMBER: ${{ github.event.pull_request.number }} + + Please review this pull request with a focus on: + - Code quality and best practices + - Potential bugs or issues + - Security implications + - Performance considerations + + Note: The PR branch is already checked out in the current working directory. + + Use `gh pr comment` for top-level feedback. + Use `mcp__github_inline_comment__create_inline_comment` to highlight specific code issues. + Only post GitHub comments - don't submit review text as messages. + EOF + + - name: Run Claude Code Review + shell: bash + env: + GITHUB_TOKEN: ${{ secrets.DENOBOT_PAT }} + ANTHROPIC_API_KEY: ${{ secrets.ANTHROPIC_API_KEY }} + run: | + claude --print "$(cat /tmp/prompt.txt)" \ + --allowedTools "mcp__github_inline_comment__create_inline_comment,Bash(gh pr comment:*),Bash(gh pr diff:*),Bash(gh pr view:*)"