diff --git a/.github/workflows/pre-commit.yaml b/.github/workflows/pre-commit.yaml index c7e18ab5..b346aa25 100644 --- a/.github/workflows/pre-commit.yaml +++ b/.github/workflows/pre-commit.yaml @@ -40,6 +40,10 @@ jobs: - name: Checkout git repository uses: actions/checkout@9c091bb21b7c1c1d1991bb908d89e4e9dddfe3e0 # v7.0.0 with: + # For fork PRs the head branch only exists on the fork, so the + # repository must point at the fork or the checkout fails. Falls + # back to the base repo for non-pull_request events. + repository: ${{ github.event.pull_request.head.repo.full_name || github.repository }} ref: ${{ github.event.pull_request.head.ref || github.ref }} persist-credentials: false