Fix broken multiline strings from dee0c94 (#1390)

1. Escaping behavior changed as a result of set-output deprecation.
-  Otherwise you'll encounter breaking changes for example "appVersion: "1.0.0"%0Aapplica..."
   where %0A is escaped newline \n but shouldn't be escaped.

2. Delimeter is required for multiline strings.
-  See here: https://docs.github.com/en/actions/using-workflows/workflow-commands-for-github-actions#multiline-strings
-  Delimeter must be random. UUID is a solid choice.
   I verified that /proc/sys/kernel/random/uuid does indeed exist on the yq image.
This commit is contained in:
mattphelps-8451 2022-10-18 18:16:07 -05:00 committed by GitHub
parent 28a6c9c532
commit 8a45e02cbb
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -2,10 +2,11 @@
set -e set -e
echo "::debug::\$cmd: $1" echo "::debug::\$cmd: $1"
RESULT=$(eval "$1") RESULT=$(eval "$1")
RESULT="${RESULT//'%'/'%25'}"
RESULT="${RESULT//$'\n'/'%0A'}"
RESULT="${RESULT//$'\r'/'%0D'}"
echo "::debug::\$RESULT: $RESULT" echo "::debug::\$RESULT: $RESULT"
# updating from # updating from
# https://github.com/orgs/community/discussions/26288#discussioncomment-3876281
# https://docs.github.com/en/actions/using-workflows/workflow-commands-for-github-actions#setting-an-output-parameter # https://docs.github.com/en/actions/using-workflows/workflow-commands-for-github-actions#setting-an-output-parameter
echo "result=$RESULT" >> $GITHUB_OUTPUT delimiter=$(cat /proc/sys/kernel/random/uuid)
echo "result<<${delimiter}" >> "${GITHUB_OUTPUT}"
echo "${RESULT}" >> "${GITHUB_OUTPUT}"
echo "${delimiter}" >> "${GITHUB_OUTPUT}"