|
| 1 | +name: Claude Code Review |
| 2 | + |
| 3 | +on: |
| 4 | + pull_request: |
| 5 | + types: [opened, synchronize, ready_for_review, reopened] |
| 6 | + |
| 7 | +concurrency: |
| 8 | + group: ${{ github.workflow }}-${{ github.event.pull_request.number }} |
| 9 | + cancel-in-progress: true |
| 10 | + |
| 11 | +jobs: |
| 12 | + claude-review: |
| 13 | + runs-on: ubuntu-latest |
| 14 | + permissions: |
| 15 | + contents: read |
| 16 | + pull-requests: write |
| 17 | + issues: write |
| 18 | + id-token: write |
| 19 | + |
| 20 | + steps: |
| 21 | + - name: Checkout repository |
| 22 | + uses: actions/checkout@v4 |
| 23 | + with: |
| 24 | + fetch-depth: 1 |
| 25 | + |
| 26 | + - name: Minimize old Claude comments |
| 27 | + uses: actions/github-script@v7 |
| 28 | + with: |
| 29 | + script: | |
| 30 | + const { data: comments } = await github.rest.issues.listComments({ |
| 31 | + owner: context.repo.owner, |
| 32 | + repo: context.repo.repo, |
| 33 | + issue_number: context.payload.pull_request.number, |
| 34 | + per_page: 100, |
| 35 | + }); |
| 36 | + const claudeComments = comments.filter(c => |
| 37 | + c.user?.login === 'claude[bot]' || c.user?.login === 'github-actions[bot]' |
| 38 | + ); |
| 39 | + for (const comment of claudeComments) { |
| 40 | + await github.graphql(` |
| 41 | + mutation MinimizeComment($id: ID!) { |
| 42 | + minimizeComment(input: { subjectId: $id, classifier: OUTDATED }) { |
| 43 | + minimizedComment { isMinimized } |
| 44 | + } |
| 45 | + } |
| 46 | + `, { id: comment.node_id }); |
| 47 | + } |
| 48 | +
|
| 49 | + - name: Run Claude Code Review |
| 50 | + id: claude-review |
| 51 | + uses: anthropics/claude-code-action@v1 |
| 52 | + with: |
| 53 | + claude_code_oauth_token: ${{ secrets.CLAUDE_CODE_OAUTH_TOKEN }} |
| 54 | + plugin_marketplaces: 'https://github.com/anthropics/claude-code.git' |
| 55 | + plugins: 'code-review@claude-code-plugins' |
| 56 | + prompt: '/code-review:code-review ${{ github.repository }}/pull/${{ github.event.pull_request.number }}' |
| 57 | + allowed_bots: 'claude[bot]' |
| 58 | + claude_args: '--allowed-tools Bash(gh:*) WebFetch' |
0 commit comments