Переглянути джерело

ci(managers): fix pershoot shallow clone (fetch-depth:0 + tags)

pershoot manager build.gradle.kts:78 does
  val num = parts[parts.size-2].toInt()
from git describe --tags --long + merge-base origin/dev
With --depth 1 and no tags the describe fallback is bypassed
and num becomes "" -> For input string: ""

Mirror upstream checkout@v7 fetch-depth:0: fetch branch +
tags so describe/rev-list --count work.
TheWildJames 1 тиждень тому
батько
коміт
76af852fef
1 змінених файлів з 14 додано та 3 видалено
  1. 14 3
      .github/workflows/managers.yml

+ 14 - 3
.github/workflows/managers.yml

@@ -489,14 +489,25 @@ jobs:
           flavor="${{ matrix.flavor }}"
           dir="/tmp/$flavor-src"
           rm -rf "$dir"
-          git clone --no-checkout "$repo" "$dir"
-          git -C "$dir" fetch --depth=1 origin "$sha"
+          # Mirror upstream checkout@v7 fetch-depth: 0 — pershoot manager build.gradle.kts
+          # does `git describe --tags --long` + `rev-list --count` so shallow breaks at :78 toInt("")
+          git clone --no-checkout --filter=blob:none "$repo" "$dir"
+          # fetch tags + full history for this branch so describe/count work
+          git -C "$dir" fetch --prune --tags --force origin "+refs/heads/${{ matrix.ref }}:refs/remotes/origin/${{ matrix.ref }}" 2>&1 | tail -5 || true
+          git -C "$dir" fetch --depth=1 origin "$sha" 2>&1 | tail -5 || true
+          # ensure tags are present even if shallow
+          git -C "$dir" fetch --tags --depth=50 origin 2>&1 | tail -5 || true
           git -C "$dir" checkout --detach "$sha"
+          # if still no tags, unshallow
+          if ! git -C "$dir" describe --tags --long HEAD >/dev/null 2>&1; then
+            echo "No tags after shallow fetch — unshallowing"
+            git -C "$dir" fetch --unshallow --tags 2>&1 | tail -10 || true
+          fi
           actual=$(git -C "$dir" rev-parse HEAD)
           if [[ "$actual" != "$sha" ]]; then
             echo "Commit mismatch: expected $sha got $actual" >&2; exit 1
           fi
-          echo "Cloned $flavor at $actual"
+          echo "Cloned $flavor at $actual (describe: $(git -C "$dir" describe --tags --long HEAD 2>&1 | head -1))"
           echo "SRC_DIR=$dir" >> "$GITHUB_ENV"
 
       # ── Stock build requirements per upstream — no edits except key ──