Version Packages #127
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| name: Claude Code Review | |
| on: | |
| pull_request: | |
| types: [opened, synchronize, reopened, ready_for_review] | |
| pull_request_review_comment: | |
| types: [created] | |
| issue_comment: | |
| types: [created] | |
| env: | |
| CLAUDE_OPUS_MODEL: claude-opus-4-6 | |
| CLAUDE_SONNET_MODEL: claude-sonnet-4-5 | |
| concurrency: | |
| group: claude-review-${{ github.event.pull_request.number || github.event.issue.number }} | |
| cancel-in-progress: false | |
| jobs: | |
| code-review: | |
| if: | | |
| ( | |
| github.event_name == 'issue_comment' && | |
| github.event.issue.pull_request && | |
| contains(github.event.comment.body, '@claude review') && | |
| ( | |
| github.event.comment.author_association == 'MEMBER' || | |
| github.event.comment.author_association == 'OWNER' || | |
| github.event.comment.author_association == 'COLLABORATOR' | |
| ) | |
| ) || | |
| ( | |
| github.event_name == 'pull_request' && | |
| contains(join(github.event.pull_request.labels.*.name, ','), 'claude-review') && | |
| github.event.pull_request.head.repo.full_name == github.repository | |
| ) | |
| runs-on: ubuntu-latest | |
| timeout-minutes: 15 | |
| permissions: | |
| contents: read | |
| pull-requests: write | |
| issues: write | |
| id-token: write | |
| steps: | |
| - name: Get PR SHA | |
| id: pr-sha | |
| uses: actions/github-script@v7 | |
| with: | |
| script: | | |
| if (context.eventName === 'issue_comment') { | |
| const { data: pr } = await github.rest.pulls.get({ | |
| owner: context.repo.owner, | |
| repo: context.repo.repo, | |
| pull_number: context.issue.number | |
| }); | |
| core.setOutput('head_sha', pr.head.sha); | |
| } else { | |
| core.setOutput('head_sha', context.payload.pull_request.head.sha); | |
| } | |
| - name: Checkout repository | |
| uses: actions/checkout@v6 | |
| with: | |
| ref: ${{ steps.pr-sha.outputs.head_sha }} | |
| fetch-depth: 0 | |
| - name: Run Claude Code Review | |
| uses: anthropics/claude-code-action@v1 | |
| with: | |
| anthropic_api_key: ${{ secrets.ANTHROPIC_API_KEY }} | |
| prompt: Run /claude-review | |
| track_progress: true | |
| use_sticky_comment: true | |
| claude_args: | | |
| --model ${{ env.CLAUDE_OPUS_MODEL }} | |
| --max-turns 30 | |
| interactive: | |
| if: | | |
| ( | |
| github.event_name == 'issue_comment' && | |
| github.event.issue.pull_request && | |
| contains(github.event.comment.body, '@claude') && | |
| !contains(github.event.comment.body, '@claude review') && | |
| ( | |
| github.event.comment.author_association == 'MEMBER' || | |
| github.event.comment.author_association == 'OWNER' || | |
| github.event.comment.author_association == 'COLLABORATOR' | |
| ) | |
| ) || | |
| ( | |
| github.event_name == 'pull_request_review_comment' && | |
| github.event.pull_request.head.repo.full_name == github.repository && | |
| contains(github.event.comment.body, '@claude') && | |
| ( | |
| github.event.comment.author_association == 'MEMBER' || | |
| github.event.comment.author_association == 'OWNER' || | |
| github.event.comment.author_association == 'COLLABORATOR' | |
| ) | |
| ) | |
| runs-on: ubuntu-latest | |
| timeout-minutes: 15 | |
| permissions: | |
| contents: read | |
| pull-requests: write | |
| issues: write | |
| id-token: write | |
| steps: | |
| - name: Get PR SHA | |
| id: pr-sha | |
| uses: actions/github-script@v7 | |
| with: | |
| script: | | |
| let prNumber; | |
| if (context.eventName === 'issue_comment') { | |
| prNumber = context.issue.number; | |
| } else if (context.eventName === 'pull_request_review_comment') { | |
| prNumber = context.payload.pull_request.number; | |
| } | |
| if (prNumber) { | |
| const { data: pr } = await github.rest.pulls.get({ | |
| owner: context.repo.owner, | |
| repo: context.repo.repo, | |
| pull_number: prNumber | |
| }); | |
| core.setOutput('head_sha', pr.head.sha); | |
| } | |
| - name: Checkout repository | |
| uses: actions/checkout@v6 | |
| with: | |
| ref: ${{ steps.pr-sha.outputs.head_sha || github.sha }} | |
| fetch-depth: 0 | |
| - name: Run Claude Code Assistant | |
| uses: anthropics/claude-code-action@v1 | |
| with: | |
| anthropic_api_key: ${{ secrets.ANTHROPIC_API_KEY }} | |
| track_progress: true | |
| use_sticky_comment: true | |
| claude_args: | | |
| --model ${{ env.CLAUDE_SONNET_MODEL }} | |
| --max-turns 20 |