Skip to content

Commit 8142f4f

Browse files
vitoficoclaude
andcommitted
🐛 fix(ci): fetch tags so git-describe can find v* tags
actions/checkout@v4 with fetch-depth: 0 alone does not pull tags; needs fetch-tags: true. The previous shell-step `git fetch --tags` was apparently failing silently, so the build's gitDescribe() got just a SHA and Version.fromGitDescribe rejected it. Also fail-fast in the Compute version step if no v* tag is reachable, instead of letting Gradle hit the same error 30s later. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
1 parent 2eb85ca commit 8142f4f

1 file changed

Lines changed: 8 additions & 3 deletions

File tree

.github/workflows/android-ci.yaml

Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -43,6 +43,7 @@ jobs:
4343
- uses: actions/checkout@34e114876b0b11c390a56381ad16ebd13914f8d5 # v4
4444
with:
4545
fetch-depth: 0
46+
fetch-tags: true
4647
- uses: actions/setup-java@c1e323688fd81a25caa38c78aa6df2d33d3e20d9 # v4
4748
with:
4849
distribution: temurin
@@ -55,9 +56,12 @@ jobs:
5556
name: Compute version
5657
run: |
5758
# Match what app/build.gradle.kts derives from the same checkout.
58-
# Fetch tags first — actions/checkout@v4 with default fetch-depth
59-
# may not pull tags.
60-
git fetch --tags --depth=1 origin || true
59+
# Tags are pulled by checkout's fetch-tags: true; verify here.
60+
if ! git describe --tags --match 'v*' --abbrev=0 >/dev/null 2>&1; then
61+
echo "::error::No matching v* tag in history. Build will fail."
62+
git tag -l 'v*' | head
63+
exit 1
64+
fi
6165
VERSION=$(git describe --tags --match 'v*' --always | sed 's/^v//')
6266
echo "VERSION_NAME=$VERSION" >> "$GITHUB_ENV"
6367
echo "version=$VERSION" >> "$GITHUB_OUTPUT"
@@ -90,6 +94,7 @@ jobs:
9094
- uses: actions/checkout@34e114876b0b11c390a56381ad16ebd13914f8d5 # v4
9195
with:
9296
fetch-depth: 0
97+
fetch-tags: true
9398
- uses: actions/setup-java@c1e323688fd81a25caa38c78aa6df2d33d3e20d9 # v4
9499
with:
95100
distribution: temurin

0 commit comments

Comments
 (0)