From 45999a3c9cd2a431b54a46c25e1360a71ba88e05 Mon Sep 17 00:00:00 2001
From: Paul Abel
Date: Thu, 14 Mar 2024 12:17:41 +0000
Subject: [PATCH] change directory to root of git project
---
.github/scripts/variables.sh | 8 ++++++--
1 file changed, 6 insertions(+), 2 deletions(-)
diff --git a/.github/scripts/variables.sh b/.github/scripts/variables.sh
index 88cc3f4200..ba31016b2d 100755
--- a/.github/scripts/variables.sh
+++ b/.github/scripts/variables.sh
@@ -7,15 +7,19 @@ fi
INPUT=$1
ROOTDIR=$(git rev-parse --show-toplevel || echo ".")
+if [ "$PWD" != "$ROOTDIR" ]; then
+ # shellcheck disable=SC2164
+ cd "$ROOTDIR";
+fi
case $INPUT in
docker_md5)
- docker_md5=$(find "$ROOTDIR" -type f \( -name "Dockerfile" -o -name version.txt \) -not -path "./tests*" -exec md5sum {} + | LC_ALL=C sort | md5sum | awk '{ print $1 }')
+ docker_md5=$(find . -type f \( -name "Dockerfile" -o -name version.txt \) -not -path "./tests*" -exec md5sum {} + | LC_ALL=C sort | md5sum | awk '{ print $1 }')
echo "docker_md5=${docker_md5:0:8}"
;;
go_code_md5)
- echo "go_code_md5=$(find "$ROOTDIR" -type f \( -name "*.go" -o -name go.mod -o -name go.sum -o -name "*.tmpl" \) -not -path "./docs*" -exec md5sum {} + | LC_ALL=C sort | md5sum | awk '{ print $1 }')"
+ echo "go_code_md5=$(find . -type f \( -name "*.go" -o -name go.mod -o -name go.sum -o -name "*.tmpl" \) -not -path "./docs*" -exec md5sum {} + | LC_ALL=C sort | md5sum | awk '{ print $1 }')"
;;
*)