|
| 1 | +name: Claude Review |
| 2 | + |
| 3 | +# Genuine, advisory AI code review on every PR. Posts findings as PR |
| 4 | +# comments. NOT a required status check — it never blocks a merge. |
| 5 | +# Uses `pull_request` (not pull_request_target) so ANTHROPIC_API_KEY is |
| 6 | +# never exposed to fork PRs. |
| 7 | + |
| 8 | +on: |
| 9 | + pull_request: |
| 10 | + types: [opened, synchronize, reopened, ready_for_review] |
| 11 | + |
| 12 | +permissions: |
| 13 | + contents: read |
| 14 | + |
| 15 | +jobs: |
| 16 | + review: |
| 17 | + runs-on: ubuntu-latest |
| 18 | + timeout-minutes: 15 |
| 19 | + permissions: |
| 20 | + contents: read |
| 21 | + pull-requests: write # posts review comments via the default GITHUB_TOKEN |
| 22 | + steps: |
| 23 | + - name: Checkout |
| 24 | + uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2 |
| 25 | + with: |
| 26 | + fetch-depth: 1 |
| 27 | + |
| 28 | + - name: Claude review |
| 29 | + uses: anthropics/claude-code-action@806af32823ef69c8ef357086c573a902af641307 # v1 |
| 30 | + with: |
| 31 | + anthropic_api_key: ${{ secrets.ANTHROPIC_API_KEY }} |
| 32 | + # Post as the workflow's own GITHUB_TOKEN. Without this the action |
| 33 | + # falls back to minting a GitHub App token via OIDC, which requires |
| 34 | + # the Claude GitHub App installed on the repo and fails otherwise |
| 35 | + # ("Could not fetch an OIDC token"). |
| 36 | + github_token: ${{ secrets.GITHUB_TOKEN }} |
| 37 | + track_progress: true |
| 38 | + prompt: | |
| 39 | + REPO: ${{ github.repository }} |
| 40 | + PR NUMBER: ${{ github.event.pull_request.number }} |
| 41 | +
|
| 42 | + Review this pull request and post your findings as GitHub PR comments. |
| 43 | + Read the diff with `gh pr diff` and the description with `gh pr view`. |
| 44 | + This is an Nx monorepo of Angular/TypeScript libraries published as |
| 45 | + `@threadplane/*`, plus a Python middleware. Focus on: |
| 46 | + - Correctness bugs and broken behaviour |
| 47 | + - Security issues (injection, secrets, unsafe input handling, workflow |
| 48 | + script injection in .github/workflows) |
| 49 | + - TypeScript type-safety problems and unsafe casts |
| 50 | + - Angular/RxJS pitfalls (subscription leaks, change-detection misuse) |
| 51 | + - Public API / DX regressions on the published `@threadplane/*` surface |
| 52 | + - Missing or weak test coverage for the change |
| 53 | +
|
| 54 | + Post a concise top-level summary via `gh pr comment`. Post specific |
| 55 | + issues as inline comments. Be brief; skip nitpicks and style unless |
| 56 | + they affect correctness. If the PR looks good, say so briefly. |
| 57 | + claude_args: | |
| 58 | + --model claude-sonnet-4-6 |
| 59 | + --max-turns 15 |
| 60 | + --allowedTools "mcp__github_inline_comment__create_inline_comment,Bash(gh pr comment:*),Bash(gh pr diff:*),Bash(gh pr view:*)" |
0 commit comments