diff --git a/.github/workflows/claude-pr-review.yml b/.github/workflows/claude-pr-review.yml index 7eaa658a1..8d3e9da70 100644 --- a/.github/workflows/claude-pr-review.yml +++ b/.github/workflows/claude-pr-review.yml @@ -60,14 +60,12 @@ jobs: exit 0 fi - - name: Checkout repository - if: steps.check.outputs.is_member == 'true' - uses: actions/checkout@v4 - with: - repository: ${{ github.event.pull_request.head.repo.full_name }} - ref: ${{ github.event.pull_request.head.ref }} - fetch-depth: 0 - + # 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