Skip to content

gha: add claude-code-review.yml workflow#29488

Open
andrewhsu wants to merge 4 commits intodevfrom
DEVPROD-3766-claude-code-review
Open

gha: add claude-code-review.yml workflow#29488
andrewhsu wants to merge 4 commits intodevfrom
DEVPROD-3766-claude-code-review

Conversation

@andrewhsu
Copy link
Member

@andrewhsu andrewhsu commented Feb 2, 2026

jira: DEVPROD-3766

This PR adds a github workflow to run on PRs with github label claude-review. The workflow is triggered only when claude-review label is added (for cost control). So, to re-review updates to the PR you will need to remove the label and add the label again.

I've gone through several rounds of code review feedback with claude-review and i've resolved the older inline discussions and left the last review inline discussions open, starting from #29488 (review), to show how it reviews. For comparison, the copilot review: #29488 (review)

Notable behavior:

Reference:

Backports Required

  • none - not a bug fix
  • none - this is a backport
  • none - issue does not exist in previous branches
  • none - papercut/not impactful enough to backport
  • v25.3.x
  • v25.2.x
  • v25.1.x

Release Notes

  • none

@andrewhsu andrewhsu added the claude-review Adding this label to a PR will trigger a workflow to review the code using claude. label Feb 2, 2026
@andrewhsu andrewhsu force-pushed the DEVPROD-3766-claude-code-review branch from c6bf004 to 5a3de0e Compare February 2, 2026 20:03
@andrewhsu andrewhsu added claude-review Adding this label to a PR will trigger a workflow to review the code using claude. and removed claude-review Adding this label to a PR will trigger a workflow to review the code using claude. labels Feb 2, 2026
@andrewhsu andrewhsu force-pushed the DEVPROD-3766-claude-code-review branch 3 times, most recently from d0a651f to f23fb2e Compare February 2, 2026 23:20
@andrewhsu andrewhsu removed the claude-review Adding this label to a PR will trigger a workflow to review the code using claude. label Feb 3, 2026
@andrewhsu andrewhsu force-pushed the DEVPROD-3766-claude-code-review branch 2 times, most recently from 6e91451 to 60046cc Compare February 4, 2026 17:13
@andrewhsu andrewhsu added the claude-review Adding this label to a PR will trigger a workflow to review the code using claude. label Feb 4, 2026
@andrewhsu andrewhsu force-pushed the DEVPROD-3766-claude-code-review branch from 60046cc to cf9aee6 Compare February 4, 2026 17:21
@andrewhsu andrewhsu added claude-review Adding this label to a PR will trigger a workflow to review the code using claude. and removed claude-review Adding this label to a PR will trigger a workflow to review the code using claude. labels Feb 4, 2026
actions: read
claude_args: >
--model opus
--max-turns 30
Copy link
Member Author

Choose a reason for hiding this comment

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

for reference: this claude-code review took 17 turns

@andrewhsu andrewhsu removed the claude-review Adding this label to a PR will trigger a workflow to review the code using claude. label Feb 4, 2026
@andrewhsu andrewhsu added the claude-review Adding this label to a PR will trigger a workflow to review the code using claude. label Feb 4, 2026
@andrewhsu andrewhsu added claude-review Adding this label to a PR will trigger a workflow to review the code using claude. and removed claude-review Adding this label to a PR will trigger a workflow to review the code using claude. labels Feb 4, 2026
andrewhsu and others added 3 commits February 4, 2026 12:09
The job was always skipped because github.event.label is only
populated on 'labeled' events. Changed to check PR labels array
and added 'labeled' event type to trigger on label additions.

Co-Authored-By: Claude Opus 4.5 <[email protected]>
@andrewhsu andrewhsu added claude-review Adding this label to a PR will trigger a workflow to review the code using claude. and removed claude-review Adding this label to a PR will trigger a workflow to review the code using claude. labels Feb 4, 2026
Only run workflow when label is applied to reduce extra reviews on
intermediate changes.

Also need to disable `track_progress` because the feature only works on
events opened, synchronize, ready_for_review, reopened.

See: https://github.com/anthropics/claude-code-action/blob/v1.0.43/action.yml#L108-L111
@andrewhsu andrewhsu force-pushed the DEVPROD-3766-claude-code-review branch from 0a61c5d to 3f5db03 Compare February 4, 2026 20:11
@andrewhsu andrewhsu added claude-review Adding this label to a PR will trigger a workflow to review the code using claude. and removed claude-review Adding this label to a PR will trigger a workflow to review the code using claude. labels Feb 4, 2026
id-token: write
actions: read
steps:
- uses: actions/checkout@v6
Copy link

Choose a reason for hiding this comment

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

Consistency suggestion: Other workflows in this repository use actions/checkout@v4, but this workflow uses @v6. Consider using @v4 for consistency with other workflows, or update all workflows together if migrating to v6.

Suggested change
- uses: actions/checkout@v6
- uses: actions/checkout@v4

Copy link
Member Author

Choose a reason for hiding this comment

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

v6 is intentional to use latest supported version of that action and to get onto node24 before node20 eol

- run: gh auth setup-git
env:
GH_TOKEN: ${{ github.token }}
- uses: anthropics/claude-code-action@v1
Copy link

Choose a reason for hiding this comment

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

Version pinning suggestion: Using @v1 will automatically get new minor/patch versions, which could introduce unexpected behavior changes. Consider pinning to a specific version (e.g., @v1.0.43 as referenced in the PR description) for more predictable behavior, especially since this is a cost-sensitive workflow.

Suggested change
- uses: anthropics/claude-code-action@v1
- uses: anthropics/claude-code-action@v1.0.43

Copy link
Member Author

Choose a reason for hiding this comment

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

this action updates frequently with bug fixes and i trust anthropic's adherence to semver major version so intentionally used float version v1

jobs:
claude-review:
if: github.event.label.name == 'claude-review'
runs-on: ubuntu-24.04
Copy link

Choose a reason for hiding this comment

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

Best practice: Consider using ubuntu-latest instead of ubuntu-24.04 for better maintainability. This is consistent with other workflows in the repository (e.g., lint-python.yml, lint-cpp.yml) and avoids needing to update the workflow when newer runners become available.

Suggested change
runs-on: ubuntu-24.04
runs-on: ubuntu-latest

Copy link
Member Author

Choose a reason for hiding this comment

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

next ubuntu release may have breaking changes like ubuntu-24.04 did from prev release, so conservatively pegging to 24.04

permissions:
contents: read
pull-requests: write
id-token: write
Copy link

Choose a reason for hiding this comment

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

Security consideration: The id-token: write permission is typically used for OIDC token authentication (e.g., with cloud providers). If use_commit_signing doesn't require this permission, consider removing it to follow the principle of least privilege. If it is required for commit signing, this is fine.

Note: Please verify whether this permission is actually needed by the claude-code-action.

Comment on lines +20 to +22
- run: gh auth setup-git
env:
GH_TOKEN: ${{ github.token }}
Copy link

Choose a reason for hiding this comment

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

Potential cleanup: Since persist-credentials: false is set on checkout (line 19) and the claude-code-action likely handles its own git authentication, this gh auth setup-git step may be unnecessary. The action's documentation should clarify whether this step is required.

Consider testing without this step to simplify the workflow.

Comment on lines +39 to +47
--disallowed-tools "WebFetch,WebSearch"
--allowed-tools "
mcp__github_inline_comment__create_inline_comment,
mcp__github_ci__get_ci_status,
mcp__github_ci__get_workflow_run_details,
mcp__github_ci__download_job_log,
Bash(gh issue *),
Bash(gh pr *),
Bash(gh search *)"
Copy link

Choose a reason for hiding this comment

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

Security consideration: The allowed Bash commands (gh issue *, gh pr *, gh search *) are quite permissive. While these are read operations, some gh pr subcommands can be write operations (e.g., gh pr comment, gh pr edit, gh pr merge).

If the intent is read-only access, consider being more specific:

  • Bash(gh issue view *)
  • Bash(gh pr view *)
  • Bash(gh pr diff *)
  • Bash(gh search issues *)
  • Bash(gh search prs *)

However, if write access to PRs is intentional (e.g., for posting review comments via gh pr comment), this is acceptable. The PR description mentions Claude will "comment inline" which may utilize these permissions.

Copy link
Member Author

Choose a reason for hiding this comment

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

intentional to allow comment inline

Comment on lines +48 to +60
prompt: |
REPO: ${{ github.repository }}
PR NUMBER: ${{ github.event.pull_request.number }}
WORKFLOW RUN URL: ${{ github.server_url }}/${{ github.repository }}/actions/runs/${{ github.run_id }}

Please review this pull request with a focus on:
- Code quality and best practices
- Potential bugs or issues
- Security implications
- Performance considerations

Provide detailed feedback using inline comments for specific issues.
Include a link to workflow run URL in the final review comment.
Copy link

Choose a reason for hiding this comment

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

Enhancement suggestion: The prompt could be more specific to the Redpanda codebase by referencing the CLAUDE.md file guidelines. This would help ensure reviews align with project-specific standards (C++ coding guidelines, naming conventions, Seastar patterns, etc.).

For example, adding a line like:

Follow the coding guidelines documented in CLAUDE.md when reviewing.

This would make the AI reviewer more effective at catching project-specific issues like:

  • Missing ss:: namespace prefix for Seastar types
  • Use of std::vector where chunked_vector should be used
  • Missing format_to member functions instead of operator<< overloads

@andrewhsu andrewhsu marked this pull request as ready for review February 4, 2026 20:38
@andrewhsu
Copy link
Member Author

i've resolved discussion with #29488 (comment)

i also updated PR description to better describe behavior of the claude-code-review.yml workflow.

ready for human review.

@andrewhsu andrewhsu requested a review from rockwotj February 4, 2026 20:39
@andrewhsu andrewhsu enabled auto-merge February 4, 2026 20:39
@andrewhsu andrewhsu requested a review from wreet February 4, 2026 20:40
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

area/build claude-review Adding this label to a PR will trigger a workflow to review the code using claude.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants