mirror of
https://github.com/Sea-Haven-Industries/.github.git
synced 2026-09-30 07:03:11 +00:00
Add cross-repo dispatch to Claude Code Review (#26)
Use GitHub App token (CLAUDE_CI_APP_ID) for cross-repo access when dispatching reviews via workflow_dispatch. Remove issue_comment, pull_request_review_comment, and review_requested triggers since org-level workflows don't propagate those events to other repos.
This commit is contained in:
parent
5d0349dfa3
commit
6b896eb463
1 changed files with 22 additions and 16 deletions
38
.github/workflows/claude-code-review.yaml
vendored
38
.github/workflows/claude-code-review.yaml
vendored
|
|
@ -3,16 +3,14 @@ name: Claude Code Review
|
||||||
on:
|
on:
|
||||||
workflow_dispatch:
|
workflow_dispatch:
|
||||||
inputs:
|
inputs:
|
||||||
|
repository:
|
||||||
|
description: "Target repository (e.g., Sea-Haven-Industries/meal-order-manager)"
|
||||||
|
required: true
|
||||||
|
type: string
|
||||||
pr_number:
|
pr_number:
|
||||||
description: Pull request number to review
|
description: Pull request number to review
|
||||||
required: true
|
required: true
|
||||||
type: string
|
type: string
|
||||||
issue_comment:
|
|
||||||
types: [created]
|
|
||||||
pull_request_review_comment:
|
|
||||||
types: [created]
|
|
||||||
pull_request:
|
|
||||||
types: [review_requested]
|
|
||||||
workflow_call:
|
workflow_call:
|
||||||
inputs:
|
inputs:
|
||||||
direct_call:
|
direct_call:
|
||||||
|
|
@ -32,30 +30,35 @@ permissions:
|
||||||
jobs:
|
jobs:
|
||||||
claude-review:
|
claude-review:
|
||||||
if: >-
|
if: >-
|
||||||
(github.event_name == 'issue_comment' &&
|
|
||||||
contains(github.event.comment.body, '@claude') &&
|
|
||||||
github.event.issue.pull_request) ||
|
|
||||||
(github.event_name == 'pull_request_review_comment' &&
|
|
||||||
contains(github.event.comment.body, '@claude')) ||
|
|
||||||
(github.event_name == 'pull_request' &&
|
|
||||||
github.event.requested_team.slug == 'claude') ||
|
|
||||||
github.event_name == 'workflow_dispatch' ||
|
github.event_name == 'workflow_dispatch' ||
|
||||||
inputs.direct_call == true
|
inputs.direct_call == true
|
||||||
runs-on: ubuntu-latest
|
runs-on: ubuntu-latest
|
||||||
timeout-minutes: 10
|
timeout-minutes: 10
|
||||||
steps:
|
steps:
|
||||||
|
- name: Generate GitHub App token
|
||||||
|
if: github.event_name == 'workflow_dispatch'
|
||||||
|
id: app-token
|
||||||
|
uses: actions/create-github-app-token@v1
|
||||||
|
with:
|
||||||
|
app-id: ${{ secrets.CLAUDE_CI_APP_ID }}
|
||||||
|
private-key: ${{ secrets.CLAUDE_CI_APP_PRIVATE_KEY }}
|
||||||
|
owner: Sea-Haven-Industries
|
||||||
|
|
||||||
- uses: actions/checkout@v4
|
- uses: actions/checkout@v4
|
||||||
with:
|
with:
|
||||||
|
repository: ${{ inputs.repository || github.repository }}
|
||||||
|
token: ${{ steps.app-token.outputs.token || github.token }}
|
||||||
fetch-depth: 1
|
fetch-depth: 1
|
||||||
|
|
||||||
- uses: anthropics/claude-code-action@v1
|
- uses: anthropics/claude-code-action@v1
|
||||||
with:
|
with:
|
||||||
anthropic_api_key: ${{ secrets.anthropic_api_key || secrets.ANTHROPIC_API_KEY }}
|
anthropic_api_key: ${{ secrets.anthropic_api_key || secrets.ANTHROPIC_API_KEY }}
|
||||||
|
github_token: ${{ steps.app-token.outputs.token || github.token }}
|
||||||
allowed_bots: '*'
|
allowed_bots: '*'
|
||||||
trigger_phrase: '@claude'
|
trigger_phrase: '@claude'
|
||||||
prompt: |
|
prompt: |
|
||||||
REPO: ${{ github.repository }}
|
REPO: ${{ inputs.repository || github.repository }}
|
||||||
PR NUMBER: ${{ github.event.pull_request.number || github.event.issue.number || github.event.inputs.pr_number }}
|
PR NUMBER: ${{ inputs.pr_number || github.event.pull_request.number || github.event.issue.number }}
|
||||||
|
|
||||||
Review this pull request. Only comment on:
|
Review this pull request. Only comment on:
|
||||||
- Bugs or logic errors
|
- Bugs or logic errors
|
||||||
|
|
@ -76,4 +79,7 @@ jobs:
|
||||||
Only post GitHub comments — do not submit review text as messages.
|
Only post GitHub comments — do not submit review text as messages.
|
||||||
|
|
||||||
claude_args: |
|
claude_args: |
|
||||||
--allowedTools "mcp__github_inline_comment__create_inline_comment,Bash(gh pr comment:*),Bash(gh pr diff:*),Bash(gh pr view:*)"
|
--allowedTools "mcp__github_inline_comment__create_inline_comment,Bash(gh pr comment:*),Bash(gh pr diff:*),Bash(gh pr view:*)"
|
||||||
|
env:
|
||||||
|
GH_REPO: ${{ inputs.repository || github.repository }}
|
||||||
|
GH_TOKEN: ${{ steps.app-token.outputs.token || github.token }}
|
||||||
|
|
|
||||||
Loading…
Add table
Reference in a new issue