Skip to content

Use shared claude-review reusable workflow - #120

Closed
leighmcculloch wants to merge 1 commit into
mainfrom
claude-review-reusable
Closed

Use shared claude-review reusable workflow#120
leighmcculloch wants to merge 1 commit into
mainfrom
claude-review-reusable

Conversation

@leighmcculloch

@leighmcculloch leighmcculloch commented May 14, 2026

Copy link
Copy Markdown
Member

What

Replace the inlined claude-review.yml workflow with a call to the shared reusable workflow at stellar/actions/.github/workflows/claude-review.yml@main. Keep the existing pull_request trigger (the safer default; fork PRs can't access secrets on this event so they cannot be reviewed) and narrow the trigger types to [ready_for_review, synchronize] so Claude only reviews PRs that are marked ready and re-reviews on new commits.

Why

The same claude-review workflow is maintained across four stellar repos. Moving to stellar/actions lets all repos share one implementation, so the security model and prompt updates live in one place. The reusable workflow also adopts the harder pull_request_target flow with an author-association gate, enabling reviews of fork PRs from org members while still keeping secrets out of attacker-controlled code paths.

Example

Before — fully inlined workflow with pull_request trigger and bespoke prompt.

After:

name: Claude Review

on:
  pull_request:
    types: [ready_for_review, synchronize]

concurrency:
  group: claude-review-${{ github.event.pull_request.number }}
  cancel-in-progress: true

permissions: {}

jobs:
  review:
    uses: stellar/actions/.github/workflows/claude-review.yml@main
    secrets:
      anthropic_api_key: ${{ secrets.ANTHROPIC_API_KEY }}

The default prompt in the reusable workflow matches the one used here previously, with an added note that the PR head is checked out into pr-head/.

Note

Requires the corresponding PR in stellar/actions to be merged first so that stellar/actions/.github/workflows/claude-review.yml@main resolves:

Copilot AI review requested due to automatic review settings May 14, 2026 13:42

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Pull request overview

This PR migrates the repository’s Claude PR review GitHub Action from an inlined workflow implementation to the shared reusable workflow in stellar/actions, and adjusts the pull_request trigger types to reduce when the workflow runs.

Changes:

  • Replace inlined claude-code-action job steps with a reusable workflow call to stellar/actions/.github/workflows/claude-review.yml@main.
  • Narrow pull_request trigger types to only ready_for_review and synchronize.
  • Keep existing concurrency grouping for per-PR cancellation.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment on lines 3 to +5
on:
pull_request:
types: [opened, synchronize, ready_for_review, reopened]
types: [ready_for_review, synchronize]
Comment on lines 9 to +17
cancel-in-progress: true

permissions: {}

jobs:
review:
if: github.event.pull_request.draft == false && github.event.pull_request.head.repo.fork == false
runs-on: ubuntu-latest
permissions:
contents: read
pull-requests: write
id-token: write
steps:
- uses: actions/checkout@v6
with:
fetch-depth: 1

- uses: anthropics/claude-code-action@v1
with:
anthropic_api_key: ${{ secrets.ANTHROPIC_API_KEY }}
track_progress: true
prompt: |
REPO: ${{ github.repository }}
PR NUMBER: ${{ github.event.pull_request.number }}

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.

When using GitHub CLI commands always include the PR number explicitly,
e.g. `gh pr diff ${{ github.event.pull_request.number }}`,
`gh pr view ${{ github.event.pull_request.number }}`,
`gh pr comment ${{ github.event.pull_request.number }} --body "..."`.
Do not rely on the current directory context to infer the PR number.

# --max-turns caps how many tool-use cycles Claude can run, which
# bounds token spend per invocation. The allowed `gh pr` commands are
# scoped to this PR's number so a misfire can't reach into another PR.
claude_args: |
--max-turns 30
--allowedTools "mcp__github_inline_comment__create_inline_comment,Bash(gh pr comment ${{ github.event.pull_request.number }}:*),Bash(gh pr diff ${{ github.event.pull_request.number }}:*),Bash(gh pr view ${{ github.event.pull_request.number }}:*)"
uses: stellar/actions/.github/workflows/claude-review.yml@main
secrets:
anthropic_api_key: ${{ secrets.ANTHROPIC_API_KEY }}

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

💡 Codex Review


P1 Badge Grant token permissions to the called workflow

Keeping permissions: {} at workflow scope while omitting jobs.review.permissions passes an unprivileged GITHUB_TOKEN into the reusable workflow call. Reusable workflows cannot elevate token scopes beyond what the caller grants, so the shared Claude review job cannot reliably read PR contents or write review comments, causing the automation to fail or produce no review output on every run.

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

on:
pull_request:
types: [opened, synchronize, ready_for_review, reopened]
types: [ready_for_review, synchronize]

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

P2 Badge Include PR open events for first-pass review

Restricting pull_request triggers to ready_for_review and synchronize removes coverage for PRs opened already out of draft and for reopened PRs. Those cases do not get an initial review unless another commit is pushed, which regresses expected automatic review behavior for many normal PR workflows.

Useful? React with 👍 / 👎.

@leighmcculloch

Copy link
Copy Markdown
Member Author

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