diff --git a/.github/workflows/claude-pr-review.yml b/.github/workflows/claude-pr-review.yml index 05d39dd54..8d3e9da70 100644 --- a/.github/workflows/claude-pr-review.yml +++ b/.github/workflows/claude-pr-review.yml @@ -60,14 +60,12 @@ jobs: exit 0 fi - # Do NOT set repository/ref here. claude-code-action fetches the - # PR branch itself via `git fetch origin pull/N/head:...`. Overriding - # origin to a fork repo breaks that fetch since PR refs only exist on - # the base repo. - - name: Checkout repository - if: steps.check.outputs.is_member == 'true' - uses: actions/checkout@v4 - + # Generate the app token before checkout so it can be used for + # git operations. claude-code-action calls setupBranch() (which + # fetches PR refs via `git fetch origin pull/N/head:...`) before + # configureGitAuth(), so the token embedded in origin by + # actions/checkout must already have permission to fetch fork + # PR refs. - name: Generate GitHub App token if: steps.check.outputs.is_member == 'true' id: app-token @@ -76,6 +74,12 @@ jobs: app-id: ${{ vars.APP_ID }} private-key: ${{ secrets.APP_PRIVATE_KEY }} + - name: Checkout repository + if: steps.check.outputs.is_member == 'true' + uses: actions/checkout@v4 + with: + token: ${{ steps.app-token.outputs.token }} + - name: Configure AWS Credentials (OIDC) if: steps.check.outputs.is_member == 'true' uses: aws-actions/configure-aws-credentials@v4