From 624b115d6bc74a92f2a4ec51a23302a5a80cb614 Mon Sep 17 00:00:00 2001 From: hudeng Date: Fri, 21 Aug 2026 17:43:08 +0800 Subject: [PATCH] fix: checkout merge commit for merged PRs in auto-tag workflow When a PR is merged from a fork and the fork branch is subsequently deleted, the auto-tag workflow fails at actions/checkout@v7 because it tries to fetch refs/heads/ from the fork repository which no longer exists. Fix by conditionally using merge_commit_sha from the base repo when the PR is merged, and falling back to the branch ref from the fork repository when the PR is still open. --- .github/workflows/auto-tag.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/auto-tag.yml b/.github/workflows/auto-tag.yml index a165682c8..387f71b81 100644 --- a/.github/workflows/auto-tag.yml +++ b/.github/workflows/auto-tag.yml @@ -18,8 +18,8 @@ jobs: steps: - uses: actions/checkout@v7 with: - ref: refs/heads/${{ github.event.pull_request.head.ref }} - repository: ${{ github.event.pull_request.head.repo.full_name }} + ref: ${{ github.event.pull_request.merged && github.event.pull_request.merge_commit_sha || format('refs/heads/{0}', github.event.pull_request.head.ref) }} + repository: ${{ github.event.pull_request.merged && github.event.repository.full_name || github.event.pull_request.head.repo.full_name }} allow-unsafe-pr-checkout: true persist-credentials: false - name: get changelog version