diff --git a/.github/workflows/pre-commit.yaml b/.github/workflows/pre-commit.yaml index 6b4bf6a8..59ea9028 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@df4cb1c069e1874edd31b4311f1884172cec0e10 # v6.0.3 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