name: Claude
on:
issue_comment:
types: [created]
jobs:
claude-review:
if: |
github.event.issue.pull_request &&
contains(github.event.comment.body, '/review')
runs-on: blacksmith-2vcpu-ubuntu-2404
permissions:
contents: read
pull-requests: read
issues: read
id-token: write
steps:
- name: Checkout repository
uses: actions/checkout@v6
with:
fetch-depth: 1
ref: refs/pull/${{ github.event.issue.number }}/head
- name: Run Claude Code Review
id: claude-review
uses: anthropics/claude-code-action@v1
with:
claude_code_oauth_token: ${{ secrets.CLAUDE_CODE_OAUTH_TOKEN }}
track_progress: true
prompt: |
REPO: ${{ github.repository }}
PR NUMBER: ${{ github.event.issue.number }}
USER QUERY: ${{ github.event.comment.body }}
Please review this pull request and provide feedback on:
- Code quality and best practices
- Potential bugs or issues
- Performance considerations
- Security concerns
- Test coverage
Use the repository's CLAUDE.md for guidance on style and conventions. Be constructive and helpful in your feedback.
Use `gh pr comment` with your Bash tool to leave your review as a comment on the PR.
claude_args: '--allowed-tools "Bash(gh issue view:*),Bash(gh search:*),Bash(gh issue list:*),Bash(gh pr comment:*),Bash(gh pr diff:*),Bash(gh pr view:*),Bash(gh pr list:*)"'
claude-code:
if: |
github.event.issue.pull_request &&
contains(github.event.comment.body, '@claude') &&
!contains(github.event.comment.body, '/review')
runs-on: blacksmith-2vcpu-ubuntu-2404
permissions:
contents: write
pull-requests: write
issues: write
id-token: write
actions: read
steps:
- name: Checkout repository
uses: actions/checkout@v6
with:
fetch-depth: 0
ref: refs/pull/${{ github.event.issue.number }}/head
- name: Run Claude Code
uses: anthropics/claude-code-action@v1
with:
claude_code_oauth_token: ${{ secrets.CLAUDE_CODE_OAUTH_TOKEN }}
track_progress: true
additional_permissions: |
actions: read
prompt: |
REPO: ${{ github.repository }}
PR NUMBER: ${{ github.event.issue.number }}
USER QUERY: ${{ github.event.comment.body }}
IMPORTANT: Before committing any code changes, you MUST run `cargo fmt` to format the code.
claude_args: '--allowedTools "Bash(git:*),Bash(cargo fmt:*),Bash(gh pr comment:*),Bash(gh pr diff:*),Bash(gh pr view:*)"'