|
31 | 31 | - comment: post as a PR comment |
32 | 32 | - auto: check if allowed, otherwise post as a comment |
33 | 33 | default: auto |
| 34 | + repository: |
| 35 | + type: string |
| 36 | + description: Name of the repository to review (without owner — must be in the same owner as the workflow). Defaults to the current repository. |
| 37 | + default: ${{ github.event.repository.name }} |
| 38 | + pull_request_number: |
| 39 | + type: string |
| 40 | + description: Pull request number to review. Defaults to the PR that triggered the workflow. |
| 41 | + default: ${{ github.event.pull_request.number }} |
34 | 42 | ACTIONS_APP_ID: |
35 | 43 | type: string |
36 | 44 | description: > |
|
68 | 76 | id-token: write # claude-code-action needs this to authenticate with GitHub |
69 | 77 |
|
70 | 78 | steps: |
| 79 | + - name: Get token for PR repository |
| 80 | + if: inputs.repository |
| 81 | + id: pr-token |
| 82 | + uses: actions/create-github-app-token@v3 |
| 83 | + with: |
| 84 | + app-id: ${{ inputs.ACTIONS_APP_ID }} |
| 85 | + private-key: ${{ secrets.ACTIONS_APP_PRIVATE_KEY }} |
| 86 | + owner: ${{ github.repository_owner }} |
| 87 | + repositories: ${{ inputs.repository }} |
| 88 | + |
| 89 | + - name: Compute PR branch |
| 90 | + if: inputs.repository || inputs.pull_request_number |
| 91 | + id: pr-branch |
| 92 | + env: |
| 93 | + GH_TOKEN: ${{ steps.pr-token.outputs.token || github.token }} |
| 94 | + REPOSITORY: ${{ github.repository_owner }}/${{ inputs.repository }} |
| 95 | + PR_NUMBER: ${{ inputs.pull_request_number }} |
| 96 | + run: | |
| 97 | + branch=$(gh pr view "$PR_NUMBER" --repo "$REPOSITORY" --json headRefName --jq .headRefName) |
| 98 | + echo "ref=$branch" >> "$GITHUB_OUTPUT" |
| 99 | +
|
71 | 100 | - uses: actions/checkout@v6 |
72 | 101 | with: |
| 102 | + repository: ${{ github.repository_owner }}/${{ inputs.repository }} |
| 103 | + ref: ${{ steps.pr-branch.outputs.ref || github.ref }} |
| 104 | + token: ${{ steps.pr-token.outputs.token || github.token }} |
73 | 105 | fetch-depth: 1 |
74 | 106 |
|
75 | 107 | - name: Identify marketplaces needing local checkout |
@@ -135,7 +167,8 @@ jobs: |
135 | 167 | uses: anthropics/claude-code-action@v1 |
136 | 168 | with: |
137 | 169 | use_vertex: "true" |
138 | | - prompt: "/review-pr REPO: ${{ github.repository }} PR_NUMBER: ${{ github.event.pull_request.number }}" |
| 170 | + github_token: ${{ steps.pr-token.outputs.token || github.token }} |
| 171 | + prompt: "/review-pr REPO: ${{ github.repository_owner }}/${{ inputs.repository }} PR_NUMBER: ${{ inputs.pull_request_number }}" |
139 | 172 | claude_args: | |
140 | 173 | --allowedTools "Read" "Bash(git diff *)" "Bash(git log *)" "Bash(git show *)" "Bash(gh repo view *)" "Bash(gh pr view *)" "Bash(gh pr diff *)" "Bash(gh pr checks *)" "Bash(gh pr comment *)" "Bash(gh api *repos/*/pulls/*/comments*)" "Bash(gh api *issues/*/comments*)" "Bash(gh api *repos/*/check-runs*)" |
141 | 174 | --model "${{ inputs.model }}" |
|
0 commit comments