Skip to content

Commit

Permalink
change directory to root of git project
Browse files Browse the repository at this point in the history
  • Loading branch information
pdabelf5 committed Mar 14, 2024
1 parent dc221fa commit 45999a3
Showing 1 changed file with 6 additions and 2 deletions.
8 changes: 6 additions & 2 deletions .github/scripts/variables.sh
Original file line number Diff line number Diff line change
Expand Up @@ -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 }')"
;;

*)
Expand Down

0 comments on commit 45999a3

Please sign in to comment.