From e07fc5496861abdbb2265664cb2909f81046a400 Mon Sep 17 00:00:00 2001 From: Alexander Gil Date: Mon, 18 May 2026 14:55:04 +0200 Subject: [PATCH] fix(ci): Handle shallow clones in release script Detects shallow clones and fetches full history + tags automatically. Prevents CHANGELOG generation failures in CI environments with fetch-depth: 1. --- .ci/release.sh | 15 ++++++++++++++- RELEASE.md | 7 +++++++ 2 files changed, 21 insertions(+), 1 deletion(-) diff --git a/.ci/release.sh b/.ci/release.sh index 0eefdab..8b54a3c 100755 --- a/.ci/release.sh +++ b/.ci/release.sh @@ -1,7 +1,20 @@ #!/bin/bash set -e -if ! [ "$(git rev-list --count origin/master..HEAD)" -eq 0 ]; then +ensure_full_history() { + if git rev-parse --is-shallow-repository 2>/dev/null | grep -q "true"; then + echo "Shallow clone detected. Fetching full history and tags..." + git fetch --unshallow --quiet + fi + if [ -z "$(git tag -l)" ]; then + echo "No tags found. Fetching tags..." + git fetch --tags --quiet + fi +} + +ensure_full_history + +if ! [ "$(git rev-list --count origin/master..HEAD 2>/dev/null || echo 1)" -eq 0 ]; then echo "There are commits in this branch. Please merge them first." echo "CHANGELOG template needs master commit ID." exit 1 diff --git a/RELEASE.md b/RELEASE.md index dde5909..69c3ddd 100644 --- a/RELEASE.md +++ b/RELEASE.md @@ -4,6 +4,13 @@ .ci/release.sh ``` +This script **automatically**: +1. Detects and fixes shallow clones (fetches full history + tags) +2. Bumps version in `Cargo.toml` +3. Updates the lock file +4. Runs `make update-changelog` +5. Creates a release commit + ## Upgrade dependencies Requirements: