Skip to content

Add Claude PR reviewer command and CI workflow#2379

Open
MarceloRGonc wants to merge 3 commits into
mainfrom
feature/claude-pr-reviewer
Open

Add Claude PR reviewer command and CI workflow#2379
MarceloRGonc wants to merge 3 commits into
mainfrom
feature/claude-pr-reviewer

Conversation

@MarceloRGonc

@MarceloRGonc MarceloRGonc commented Jun 24, 2026

Copy link
Copy Markdown
Contributor

Summary

Adds an automated PR review system using Claude Code Action:

  • .claude/commands/review-code.md — Multi-phase review command that:

    • Gathers PR context (diff, metadata, existing comments)
    • Analyzes through 14 OpenOps-specific lenses (design, workflow execution, security, migrations, etc.)
    • Validates findings with confidence scoring via subagents (drops false positives below 75%)
    • Previews findings before posting (interactive locally, auto-posts in CI)
    • Posts inline GitHub review comments + upsertable summary comment
  • .github/workflows/pr-reviewer.yml — CI workflow that:

    • Accepts PR number and optional model input
    • Uses GitHub App token for auth
    • Renders the review prompt and runs Claude Code Action
    • Posts a failure comment on the PR if the workflow errors

Testing

  • Verified workflow YAML syntax
  • Reviewed command structure against Claude Code Action docs
  • Confirmed lint-staged/prettier ran cleanly on commit

Part of CI-202

- 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>
Copilot AI review requested due to automatic review settings June 24, 2026 16:48
@linear

linear Bot commented Jun 24, 2026

Copy link
Copy Markdown

CI-202

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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.yml to accept a model input, obtain a GitHub App token, render the review prompt, run anthropics/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-token is configured with client-id instead of the repo’s established app-id input 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 + Write tools 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.

id: app_token
uses: actions/create-github-app-token@v3.2.0
with:
client-id: ${{ vars.AGENT_GITHUB_APP_ID }}
Comment thread .github/workflows/pr-reviewer.yml Outdated
Comment thread .github/workflows/pr-reviewer.yml
Comment on lines +72 to +74
claude_args: >-
--allowedTools "Bash,Read,Write,Agent,mcp__github__pull_request_read,mcp__github__pull_request_review_write,mcp__github__add_comment_to_pending_review,mcp__github__add_reply_to_pull_request_comment,mcp__github__add_issue_comment"
--model "${{ inputs.model }}"
@sonarqubecloud

Copy link
Copy Markdown

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants