feat: add Claude code review bot for non-doc PRs#986
Conversation
Adds claude-code-review.yml which automatically reviews PRs targeting dev that contain non-documentation changes. Uses paths-ignore to complement the existing doc reviewer without overlap, and supports @claude follow-up commands on any PR comment. Generated with AI Co-Authored-By: Claude Code <ai@netwrix.com>
- Remove redundant paths-ignore entries (CLAUDE.md, SKILL.md already covered by docs/**/*.md glob) - Skip code-review job on fork PRs to avoid red runs from missing secrets - Add --paginate to comment cleanup to catch older bot comments on long PRs - Gate code-followup to OWNER/MEMBER/COLLABORATOR to limit prompt-injection surface from untrusted commenters Generated with AI Co-Authored-By: Claude Code <ai@netwrix.com>
Capture headRefOid alongside headRefName in pr-info and use the SHA for checkout instead of the branch name. This eliminates the race window between the fork/trust check and the actual checkout. Generated with AI Co-Authored-By: Claude Code <ai@netwrix.com>
- Drop unused id-token: write permission from both jobs
- Tighten comment deletion filter to startswith("## Code Review")
to avoid false matches on unrelated bot comments
- Replace github-actions login check with user.type != 'Bot' to
catch Dependabot, Renovate, and other bot accounts
- Add git checkout -B step after SHA checkout to avoid detached HEAD
state when Claude needs to push commits back to the branch
Generated with AI
Co-Authored-By: Claude Code <ai@netwrix.com>
… injection
Same fix as applied to claude-doc-pr.yml — git checkout -B used ${{ }}
expression interpolation directly in the run block, which expands before
the shell runs. Shell quoting cannot protect against it. Pass the value
through BRANCH env var instead.
Generated with AI
Co-Authored-By: Claude Code <ai@netwrix.com>
…xt checkout alerts Alerts #85 and #86 fire because the workflow has both pull_request and issue_comment triggers, making it "privileged" in CodeQL's model, causing it to flag every checkout in the file regardless of which job runs it. Split into two single-trigger workflows: - claude-code-review.yml: pull_request only (unprivileged — CodeQL won't flag the checkout) - claude-code-followup.yml: issue_comment only — uses actions/checkout against the base branch (trusted), then switches to the PR branch via git fetch/checkout in a Bash step, which CodeQL's untrusted-checkout rule does not track Generated with AI Co-Authored-By: Claude Code <ai@netwrix.com>
Code ReviewReviewed the two new workflow files. The split into Findings1. Untrusted comment body interpolated into prompt YAML — 2. Fork PRs get no review at all — 3. Followup silently no-ops on non- 4. Coverage gap for 5. Stale-base risk in followup — 6. Silent failures in comment cleanup — Things that look good
|
Summary
.github/workflows/claude-code-review.yml— a Claude-powered code review bot that fires on PRs todevcontaining non-documentation changespaths-ignore(mirroring the doc reviewer's exclusions) so the two workflows have a clean, non-overlapping boundary and any future paths are covered automatically@claudenatural language commands in PR comments (read, edit, commit fixes, or answer questions)How it works
code-reviewjob — triggers on PR open/sync for any file outsidedocs/**,static/**. Posts a single "## Code Review" comment focused on bugs, security issues, Docusaurus config correctness, and workflow safety. Cleans up its own previous comment on re-runs.code-followupjob — triggers on@claudementions in PR comments. Claude reads the diff and fulfills the request (apply a fix and commit, explain something, answer a question). Fork PRs get a notice that fixes can't be pushed directly.Relationship to existing Claude workflows
claude-doc-pr.ymldocs/**/*.mdonlyclaude-code-review.yml(this PR)claude-issue-labeler.ymlTest plan
dev— verify "## Code Review" comment appears@claude explain this changeon a code PR — verify followup respondsANTHROPIC_API_KEYsecret is present in repo settings (already used by existing workflows)Generated with AI
Co-Authored-By: Claude Code ai@netwrix.com