From 8cdc780a5860e94695a6bb715f0b2d47933f6c10 Mon Sep 17 00:00:00 2001 From: Oliver Koenig Date: Tue, 3 Sep 2024 16:59:12 -0700 Subject: [PATCH] ADLR/megatron-lm!2032 - ci: Check git-version for autoformat.sh --- tools/autoformat.sh | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/tools/autoformat.sh b/tools/autoformat.sh index 522ba963b0..60aca74160 100755 --- a/tools/autoformat.sh +++ b/tools/autoformat.sh @@ -1,6 +1,15 @@ #!/bin/bash set -euox pipefail +GIT_VERSION=$(git version | awk '{print $3}') +GIT_MAJOR=$(echo $GIT_VERSION | awk -F. '{print $1}') +GIT_MINOR=$(echo $GIT_VERSION | awk -F. '{print $2}') + +if [[ $GIT_MAJOR -eq 2 && $GIT_MINOR -lt 31 ]]; then + echo "Git version must be at least 2.31.0. Found $GIT_VERSION" + exit 1 +fi + SCRIPT_DIR=$( cd -- "$( dirname -- "${BASH_SOURCE[0]}" )" &> /dev/null && pwd ) CHECK_ONLY=${CHECK_ONLY:-false} SKIP_DOCS=${SKIP_DOCS:-false}