From aeb8a3854a80a68f740e062882a99721544f5cb6 Mon Sep 17 00:00:00 2001 From: Christoph Knittel Date: Mon, 21 Sep 2026 19:56:06 +0200 Subject: [PATCH] Avoid full-history checkout in publish workflow Signed-off-by: Christoph Knittel --- .github/workflows/publish.yml | 16 ++++++++++------ 1 file changed, 10 insertions(+), 6 deletions(-) diff --git a/.github/workflows/publish.yml b/.github/workflows/publish.yml index bb5cb1f7bc..e494f8d7e9 100644 --- a/.github/workflows/publish.yml +++ b/.github/workflows/publish.yml @@ -22,8 +22,6 @@ jobs: steps: - name: Checkout uses: actions/checkout@v7 - with: - fetch-depth: 0 - name: Setup Node and dependencies uses: ./.github/actions/setup-node @@ -51,7 +49,11 @@ jobs: env: GIT_TAG: v${{ steps.plan.outputs.version }} run: | - existing_commit="$(git rev-list -n 1 "$GIT_TAG" 2>/dev/null || true)" + tag_ref="refs/tags/$GIT_TAG" + existing_commit="$(git ls-remote origin "$tag_ref^{}" | cut -f1)" + if [[ -z "$existing_commit" ]]; then + existing_commit="$(git ls-remote origin "$tag_ref" | cut -f1)" + fi if [[ -n "$existing_commit" && "$existing_commit" != "$GITHUB_SHA" ]]; then echo "$GIT_TAG already points to $existing_commit, not $GITHUB_SHA." >&2 exit 1 @@ -79,8 +81,6 @@ jobs: steps: - name: Checkout uses: actions/checkout@v7 - with: - fetch-depth: 0 - name: Create Git tag env: @@ -88,7 +88,11 @@ jobs: GIT_USER_EMAIL: ${{ github.actor_id }}+${{ github.actor }}@users.noreply.github.com GIT_USER_NAME: ${{ github.actor }} run: | - existing_commit="$(git rev-list -n 1 "$GIT_TAG" 2>/dev/null || true)" + tag_ref="refs/tags/$GIT_TAG" + existing_commit="$(git ls-remote origin "$tag_ref^{}" | cut -f1)" + if [[ -z "$existing_commit" ]]; then + existing_commit="$(git ls-remote origin "$tag_ref" | cut -f1)" + fi if [[ -z "$existing_commit" ]]; then git \ -c user.name="$GIT_USER_NAME" \