From 398d405e3362e68f6e0211143f1c8c2073d46b55 Mon Sep 17 00:00:00 2001 From: Krzysztof Szyper <45788587+ChristophShyper@users.noreply.github.com> Date: Thu, 10 Nov 2022 13:37:43 +0100 Subject: [PATCH] Fix newline `\n` handling if using `commit_prefix` or `commit_message` `git commit` in Ubuntu is not handling `\n` stroke the same way as Alpine. Using `echo -e` will normalize this. This wasn't an issue on Alpine. Added also newline handling to `files_changed` just in case. --- entrypoint.sh | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/entrypoint.sh b/entrypoint.sh index 96aa1b5..88af7fb 100755 --- a/entrypoint.sh +++ b/entrypoint.sh @@ -69,7 +69,7 @@ if [[ -n ${FILES_CHANGED} ]]; then COMMIT_PARAMS+=("--no-edit") git commit "${COMMIT_PARAMS[@]}" elif [[ -n "${INPUT_COMMIT_MESSAGE}" || -n "${INPUT_COMMIT_PREFIX}" ]]; then - git commit "${COMMIT_PARAMS[@]}" -am "${INPUT_COMMIT_PREFIX}${INPUT_COMMIT_MESSAGE}" -m "Files changed:\n${FILES_CHANGED}" + git commit "${COMMIT_PARAMS[@]}" -am "${INPUT_COMMIT_PREFIX}${INPUT_COMMIT_MESSAGE}" -m "$(echo -e "Files changed:\n${FILES_CHANGED}")" else git commit "${COMMIT_PARAMS[@]}" -am "Files changed:" -m "${FILES_CHANGED}" fi @@ -87,10 +87,10 @@ fi # Finish { echo "files_changed<> "$GITHUB_OUTPUT" +} >> "${GITHUB_OUTPUT}" if [[ ${RET_CODE} != "0" ]]; then echo -e "\n[ERROR] Check log for errors." exit 1