Add Claude PR reviewer command and CI workflow#2379
Merged
Conversation
- Add .claude/commands/review-code.md with multi-phase review process (gather context, analyze through OpenOps-specific lenses, validate with confidence scoring, preview, and post inline comments) - Update .github/workflows/pr-reviewer.yml to run Claude Code Action with the review prompt, GitHub App auth, and failure notifications Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Contributor
There was a problem hiding this comment.
Pull request overview
Adds a Claude Code–driven PR review command plus a manually triggered GitHub Actions workflow to run it and post results back to the PR.
Changes:
- Extends
.github/workflows/pr-reviewer.ymlto accept a model input, obtain a GitHub App token, render the review prompt, runanthropics/claude-code-action, and comment on failures. - Adds
.claude/commands/review-code.md, a multi-phase review procedure/prompt tailored to the OpenOps repo and review conventions.
Blocking
actions/create-github-app-tokenis configured withclient-idinstead of the repo’s establishedapp-idinput key, which will break token generation and the workflow run.- Prompt rendering only substitutes
$ARGUMENTS, leaving{PR_NUMBER}placeholders literal in CI (likely degrading or breaking the command instructions). - PR number validation claims “positive integer” but currently permits
0.
Non-blocking
- Security hardening: CI grants the agent
Bash+Writetools while secrets are present, increasing prompt-injection blast radius; consider tightening allowed tools and/or gating with an environment approval.
Merge recommendation
Do not merge
Reviewed changes
Copilot reviewed 2 out of 2 changed files in this pull request and generated 4 comments.
| File | Description |
|---|---|
.github/workflows/pr-reviewer.yml |
Implements the dispatchable CI workflow to run Claude Code Action against a PR and post results. |
.claude/commands/review-code.md |
Adds the structured multi-phase review “command” content used as the action prompt. |
The CI workflow could not produce a valid review as written: the shallow checkout left the merge base out of history (empty/wrong diffs) and the review step had no GH_TOKEN, so the gh-based checkout and summary upsert would fail auth silently. Add fetch-depth: 0 and GH_TOKEN, and expose Glob/Grep for cross-file validation in CI. Also harden the command: validation subagents now read referenced files instead of dropping cross-file findings, large diffs analyze per-file with an explicit coverage note, inline comments skip unaddable lines and fall back to the summary, lockfiles are excluded from the most-changed read, and the LOCAL merge base is resolved once against origin/main. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
Inline comments never posted in CI: the workflow_dispatch trigger gates out claude-code-action's inline-comment MCP server (context.isPR is false, upstream issue #635), so pull_request_review_write calls were denied and the buffer drained empty. Switch all posting — inline review, summary comment, and UPDATE-mode replies — to gh api over Bash, which is authenticated in both CI and local, needs no MCP server, and sidesteps the buffering and isPR gate entirely. Keep the 422-on-unaddable-line guard and summary fallback. Drop the now-unused github write tools from both tool lists; pull_request_read stays as the only GitHub MCP tool (PR data fetch). Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
Replace the Phase 2 pull_request_read MCP call with gh pr view (metadata), git diff against origin/<base> (the PR is already checked out), and gh api for existing comments/reviews. The command now uses no GitHub MCP tools at all, so PR mode works identically in CI and locally without an MCP server. Drop the last MCP entry from both tool lists. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
ravikiranvm
approved these changes
Jun 25, 2026
|
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.



Summary
Adds an automated PR review system using Claude Code Action:
.claude/commands/review-code.md— Multi-phase review command that:.github/workflows/pr-reviewer.yml— CI workflow that:Testing
Part of CI-202