From 39ede77fec4504cb633907b8e7caf32b3f5f6cd3 Mon Sep 17 00:00:00 2001 From: Andrei Kvapil Date: Tue, 22 Apr 2025 17:56:55 +0200 Subject: [PATCH] [ci] Fix checkout and improve error output for gen_versions_map.sh Signed-off-by: Andrei Kvapil --- .github/workflows/pre-commit.yml | 3 +++ hack/gen_versions_map.sh | 4 ++-- 2 files changed, 5 insertions(+), 2 deletions(-) diff --git a/.github/workflows/pre-commit.yml b/.github/workflows/pre-commit.yml index 873bd9fc..a33c78e2 100644 --- a/.github/workflows/pre-commit.yml +++ b/.github/workflows/pre-commit.yml @@ -13,6 +13,9 @@ jobs: steps: - name: Checkout code uses: actions/checkout@v3 + with: + fetch-depth: 0 + fetch-tags: true - name: Set up Python uses: actions/setup-python@v4 diff --git a/hack/gen_versions_map.sh b/hack/gen_versions_map.sh index 27664229..5169bc2f 100755 --- a/hack/gen_versions_map.sh +++ b/hack/gen_versions_map.sh @@ -31,7 +31,7 @@ resolved_miss_map=$( # if commit is not HEAD, check if it's valid if [ "$commit" != "HEAD" ]; then - if [ "$(git show "${commit}:./${chart}/Chart.yaml" 2>/dev/null | awk '$1 == "version:" {print $2}')" != "${version}" ]; then + if [ "$(git show "${commit}:./${chart}/Chart.yaml" | awk '$1 == "version:" {print $2}')" != "${version}" ]; then echo "Commit $commit for $chart $version is not valid" >&2 exit 1 fi @@ -44,7 +44,7 @@ resolved_miss_map=$( # if commit is HEAD, but version is not found in HEAD, check all tags found_tag="" for tag in $search_commits; do - if [ "$(git show "${tag}:./${chart}/Chart.yaml" 2>/dev/null | awk '$1 == "version:" {print $2}')" = "${version}" ]; then + if [ "$(git show "${tag}:./${chart}/Chart.yaml" | awk '$1 == "version:" {print $2}')" = "${version}" ]; then found_tag=$(git rev-parse --short "${tag}") break fi