diff --git a/.github/workflows/claude.yml b/.github/workflows/claude.yml new file mode 100644 index 000000000..767bd561e --- /dev/null +++ b/.github/workflows/claude.yml @@ -0,0 +1,74 @@ +name: Claude Code + +on: + issue_comment: + types: [created] + pull_request_review_comment: + types: [created] + pull_request_review: + types: [submitted] + issues: + types: [opened, assigned] + pull_request: + types: [labeled] + +jobs: + claude: + if: | + (github.event_name == 'issue_comment' && contains(github.event.comment.body, '@claude')) || + (github.event_name == 'pull_request_review_comment' && contains(github.event.comment.body, '@claude')) || + (github.event_name == 'pull_request_review' && contains(github.event.review.body, '@claude')) || + (github.event_name == 'issues' && (contains(github.event.issue.body, '@claude') || contains(github.event.issue.title, '@claude'))) + runs-on: ubuntu-latest + permissions: + contents: write + pull-requests: write + issues: write + id-token: write + actions: read # lets Claude read CI results on PRs + steps: + - uses: actions/checkout@v7 + with: + fetch-depth: 1 + + - uses: anthropics/claude-code-action@v1 + with: + anthropic_api_key: ${{ secrets.ANTHROPIC_API_KEY }} + + review: + if: github.event_name == 'pull_request' && github.event.label.name == 'ready-for-review' + runs-on: ubuntu-latest + concurrency: + group: claude-review-${{ github.event.pull_request.number }} + cancel-in-progress: true + permissions: + contents: read + pull-requests: write + id-token: write + steps: + - uses: actions/checkout@v7 + with: + fetch-depth: 1 + + - uses: anthropics/claude-code-action@v1 + with: + anthropic_api_key: ${{ secrets.ANTHROPIC_API_KEY }} + track_progress: true + prompt: | + REPO: ${{ github.repository }} + PR NUMBER: ${{ github.event.pull_request.number }} + + Review this PR against the repository's own review checklist. + + 1. Read `.claude/commands/pr-review.md` and follow it from the "What to check" + section onward, together with "How to write the comments" and "Output format". + 2. Skip its "Gather the diff" section — that one assumes a local clone. Use + `gh pr diff` for the diff and `gh pr view` for the description and commits. + 3. Read the full files at non-trivial change sites before judging them, and + check `docs/wiki/INDEX.md` for the touched module before claiming that a + helper, service, or entity does not already exist. + + Post specific findings as inline comments citing path:line, and the summary as + a single top-level comment. Review only — do not modify files. + claude_args: | + --allowedTools "mcp__github_inline_comment__create_inline_comment,Bash(gh pr comment:*),Bash(gh pr diff:*),Bash(gh pr view:*)"