Conversation
Adds a self-contained AI code review workflow using anthropics/claude-code-action@v1. Reviews PR changes and posts structured feedback. Self-contained because this repo is in a different org from the reusable workflow. Part of ATXP-1602. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
There was a problem hiding this comment.
AI Code Review
Recommendation: COMMENT
Summary
This PR adds a self-contained GitHub Actions workflow that automatically runs Claude Code to review pull requests and post structured feedback as sticky comments on open, sync, and ready_for_review events.
Actionable Feedback (2 items)
-
.github/workflows/ai-review.yml:20- Pinanthropics/claude-code-action@v1to a specific commit SHA rather than the mutablev1tag. Mutable tags are a supply-chain risk — a compromised or force-pushed tag could silently introduce malicious code that runs with write access to your PRs. See GitHub's action-pinning guidance in their security hardening docs. - General: Consider adding a
concurrencygroup to avoid overlapping runs when commits are pushed in quick succession:Without this, rapid pushes could queue multiple review jobs, wasting API credits and producing confusing interleaved comments.concurrency: group: ai-review-${{ github.event.pull_request.number }} cancel-in-progress: true
Detailed Review
Code Quality
The workflow is well-structured and readable. Permissions are correctly scoped to the minimum required (contents: read, pull-requests: write). The use_sticky_comment: "true" option is the right choice — it prevents a flood of new comments on every push. The claude_args allowlist is a good practice, constraining Claude to a narrow set of safe read-only tools plus the single gh pr review write command. The draft-filtering condition (if: github.event.pull_request.draft == false) correctly prevents unnecessary API usage on WIP PRs. fetch-depth: 0 is appropriate so git diff and gh pr diff have full history context.
Security
- Secrets handling:
ANTHROPIC_API_KEYandGITHUB_TOKENare referenced viasecrets— no hardcoded credentials. - Action pinning: As noted above,
@v1is mutable. Pinning to a full commit SHA is the recommended mitigation for supply-chain attacks. - Tool allowlist: Restricting Claude to specific
Bashsub-commands (gh pr diff,gh pr view,gh pr review,git diff,git log) is good defense-in-depth and limits blast radius if the action behaves unexpectedly. - The
github.event.pull_request.numberinterpolation in the prompt is safe — it will always be an integer and is not user-controlled text, so there is no injection risk.
Suggestions
- Add the
concurrencyblock as described above to prevent overlapping runs. - Optionally add
timeout-minutes: 10to the job so a hung Claude run does not consume runner minutes indefinitely.
Positive Notes
- Clean, minimal workflow with no unnecessary steps.
- Prompt structure is clear and consistently guides Claude to produce well-formatted reviews.
- Sticky comments keep PR threads tidy across multiple pushes.
- Draft PR filtering avoids wasteful API calls on WIP branches.
Summary
anthropics/claude-code-action@v1atxp-devorgPart of ATXP-1602
Test plan
🤖 Generated with Claude Code