diff --git a/action.yml b/action.yml index bf92510..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 - ::set-output name=package_version_list::output + echo '::set-output name=package_version_list::output' shell: bash 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..0b24b79 100755 --- a/validate_pkgs.sh +++ b/validate_pkgs.sh @@ -3,28 +3,27 @@ version=$1 packages=${@:2} -echo -n "* Validating action arguments... "; +echo "::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 +echo "::debug::Version '$version' is valid." 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 "::debug::Packages '$packages' are valid." -echo "done." +echo "::endgroup::"