From feb88c8d012af397e8f00acc4b186d11e3ece993 Mon Sep 17 00:00:00 2001 From: awalsh128 Date: Thu, 21 Oct 2021 15:54:16 -0700 Subject: [PATCH 1/5] Fix output setter. --- action.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/action.yml b/action.yml index bf92510..f17fb02 100644 --- a/action.yml +++ b/action.yml @@ -64,5 +64,5 @@ runs: for package in ${{ inputs.packages }}; do output=$output,$package:$(dpkg -s xdot | grep Version | awk '{print $2}') done - ::set-output name=package_version_list::output + echo '::set-output name=package_version_list::output' shell: bash From 35fdd91f0f41523a3480810e90f8e7a000f457fb Mon Sep 17 00:00:00 2001 From: awalsh128 Date: Thu, 21 Oct 2021 15:54:29 -0700 Subject: [PATCH 2/5] 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::" From 17fec907ec9f8eb6ab0296ae339901aa4f052742 Mon Sep 17 00:00:00 2001 From: awalsh128 Date: Thu, 21 Oct 2021 15:58:33 -0700 Subject: [PATCH 3/5] Minor fix to echo. --- validate_pkgs.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/validate_pkgs.sh b/validate_pkgs.sh index a8cad6e..2f37de0 100755 --- a/validate_pkgs.sh +++ b/validate_pkgs.sh @@ -3,7 +3,7 @@ version=$1 packages=${@:2} -echo -n "::group::Validate Action Arguments"; +echo "::group::Validate Action Arguments"; echo $version | grep -o " " > /dev/null if [ $? -eq 0 ]; then From bd28d4bdd2854fbf59cbcee168d59d947fedc27f Mon Sep 17 00:00:00 2001 From: awalsh128 Date: Thu, 21 Oct 2021 16:00:06 -0700 Subject: [PATCH 4/5] Add diagnostic reporting for validation phase. --- validate_pkgs.sh | 2 ++ 1 file changed, 2 insertions(+) diff --git a/validate_pkgs.sh b/validate_pkgs.sh index 2f37de0..0b24b79 100755 --- a/validate_pkgs.sh +++ b/validate_pkgs.sh @@ -10,6 +10,7 @@ if [ $? -eq 0 ]; then echo "::error::Aborted. Version value '$version' cannot contain spaces." >&2 exit 1 fi +echo "::debug::Version '$version' is valid." if [ "$packages" == "" ]; then echo "::error::Aborted. Packages argument cannot be empty." >&2 @@ -23,5 +24,6 @@ for package in $packages; do exit 3 fi done +echo "::debug::Packages '$packages' are valid." echo "::endgroup::" From a191e661e6948a4cb584df207db0731430c755a9 Mon Sep 17 00:00:00 2001 From: awalsh128 Date: Thu, 21 Oct 2021 16:05:02 -0700 Subject: [PATCH 5/5] Fix version reporting. --- action.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/action.yml b/action.yml index f17fb02..999ccb7 100644 --- a/action.yml +++ b/action.yml @@ -62,7 +62,7 @@ runs: run: | output= for package in ${{ inputs.packages }}; do - output=$output,$package:$(dpkg -s xdot | grep Version | awk '{print $2}') + output=$output,$package:$(dpkg -s $package | grep Version | awk '{print $2}') done echo '::set-output name=package_version_list::output' shell: bash