From 35fdd91f0f41523a3480810e90f8e7a000f457fb Mon Sep 17 00:00:00 2001 From: awalsh128 Date: Thu, 21 Oct 2021 15:54:29 -0700 Subject: [PATCH] Add more messaging to scripts. --- create_cache_key.sh | 10 ++++++---- validate_pkgs.sh | 13 +++++-------- 2 files changed, 11 insertions(+), 12 deletions(-) diff --git a/create_cache_key.sh b/create_cache_key.sh index 9d5c98f..3fd0536 100755 --- a/create_cache_key.sh +++ b/create_cache_key.sh @@ -6,16 +6,18 @@ set -e version=$1 packages=${@:2} -echo "* Creating cache key..." +echo "::group::Create Cache Key" # Remove package delimiters, sort (requires newline) and then convert back to inline list. normalized_list=$(echo $packages | sed 's/[\s,]+/ /g' | tr ' ' '\n' | sort | tr '\n' ' ') -echo "* Normalized package list is '$normalized_list'." +echo "::debug::Normalized package list is '$normalized_list'." value=$(echo $normalized_list @ $version) -echo "* Value to hash is '$value'." +echo "::debug::Value to hash is '$value'." key=$(echo $value | md5sum | /bin/cut -f1 -d' ') -echo "* Value hashed as '$key'." +echo "::debug::Value hashed as '$key'." + +echo "::endgroup::" echo "CACHE_KEY=$key" >> $GITHUB_ENV \ No newline at end of file diff --git a/validate_pkgs.sh b/validate_pkgs.sh index e06e463..a8cad6e 100755 --- a/validate_pkgs.sh +++ b/validate_pkgs.sh @@ -3,28 +3,25 @@ version=$1 packages=${@:2} -echo -n "* Validating action arguments... "; +echo -n "::group::Validate Action Arguments"; echo $version | grep -o " " > /dev/null if [ $? -eq 0 ]; then - echo "aborted." - echo "* Version value '$version' cannot contain spaces." >&2 + echo "::error::Aborted. Version value '$version' cannot contain spaces." >&2 exit 1 fi if [ "$packages" == "" ]; then - echo "aborted." - echo "* Packages argument cannot be empty." >&2 + echo "::error::Aborted. Packages argument cannot be empty." >&2 exit 2 fi for package in $packages; do apt-cache search ^$package$ | grep $package > /dev/null if [ $? -ne 0 ]; then - echo "aborted." - echo "* Package '$package' not found." >&2 + echo "::error::Aborted. Package '$package' not found." >&2 exit 3 fi done -echo "done." +echo "::endgroup::"