jobs:
  claude-review:
    permissions:
      contents: read
      id-token: write
      issues: read
      pull-requests: read
    runs-on: ubuntu-latest
    steps:
    - env:
        CLAUDE_CODE_OAUTH_TOKEN: ${{ secrets.CLAUDE_CODE_OAUTH_TOKEN }}
      name: Ensure CLAUDE_CODE_OAUTH_TOKEN secret is configured
      run: "if [ -z \"${CLAUDE_CODE_OAUTH_TOKEN}\" ]; then\n  echo \"::error::Secret\
        \ 'CLAUDE_CODE_OAUTH_TOKEN' is not set. Add it under Settings → Secrets and\
        \ variables → Actions (repo-level, or org-level with 'All repositories' visibility\
        \ to cover every repo).\"\n  exit 1\nfi\n"
    - name: Checkout repository
      uses: actions/checkout@v4
      with:
        fetch-depth: 1
    - id: claude-review
      name: Run Claude Code Review
      uses: anthropics/claude-code-action@v1
      with:
        claude_code_oauth_token: ${{ secrets.CLAUDE_CODE_OAUTH_TOKEN }}
        plugin_marketplaces: https://github.com/anthropics/claude-code.git
        plugins: code-review@claude-code-plugins
        prompt: '/code-review:code-review ${{ github.repository }}/pull/${{ github.event.pull_request.number
          }} --comment

          When no issues are found, instead of the boilerplate no-issues body, post
          a short summary: what was checked (areas of the diff, classes of issues
          looked for) and why the changes are acceptable.'
name: Claude Code Review
'on':
  pull_request:
    types:
    - opened
    - synchronize
    - ready_for_review
    - reopened
