From 18496eb7e4dc7bd068570b3faafbf822d976bbe2 Mon Sep 17 00:00:00 2001 From: Tonye Jack Date: Sat, 1 May 2021 16:26:36 -0400 Subject: [PATCH] Added better logging. --- action.yml | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/action.yml b/action.yml index 3bf4ff57..843856cc 100644 --- a/action.yml +++ b/action.yml @@ -57,6 +57,7 @@ runs: export INPUT_FILES="${{ inputs.files }}" export INPUT_SEPARATOR="${{ inputs.separator }}" echo "Getting head sha..." + if [[ -z $GITHUB_BASE_REF ]]; then HEAD_SHA=$(git rev-parse HEAD^1 || true) else @@ -65,6 +66,8 @@ runs: HEAD_SHA=$(git rev-parse "${TARGET_BRANCH}" || true) fi + echo "Using head sha: $HEAD_SHA..." + if [[ -z "$INPUT_FILES" ]]; then echo "Getting diff..." ADDED=$(git diff --diff-filter=A --name-only "$HEAD_SHA" | tr "\n" "$INPUT_SEPARATOR" | sed -E "s/($INPUT_SEPARATOR)$//") @@ -77,6 +80,9 @@ runs: UNKNOWN=$(git diff --diff-filter=X --name-only "$HEAD_SHA" | tr "\n" "$INPUT_SEPARATOR" | sed -E "s/($INPUT_SEPARATOR)$//") ALL_CHANGED=$(git diff --diff-filter="*ACDMRTUX" --name-only "$HEAD_SHA" | tr "\n" "$INPUT_SEPARATOR" | sed -E "s/($INPUT_SEPARATOR)$//") ALL_MODIFIED_FILES=$(git diff --diff-filter="ACM" --name-only "$HEAD_SHA" | tr "\n" "$INPUT_SEPARATOR" | sed -E "s/($INPUT_SEPARATOR)$//") + + echo "All changed files: $ALL_CHANGED" + echo "All modified files: ALL_MODIFIED_FILES" else ADDED_ARRAY=() COPIED_ARRAY=() @@ -115,6 +121,9 @@ runs: ALL_CHANGED=$(echo "${ALL_CHANGED_ARRAY[@]}" | sed -E "s/($INPUT_SEPARATOR)$//") ALL_MODIFIED_FILES=$(echo "${ALL_MODIFIED_FILES_ARRAY[@]}" | sed -E "s/($INPUT_SEPARATOR)$//") + echo "All changed files: $ALL_CHANGED" + echo "All modified files: ALL_MODIFIED_FILES" + # shellcheck disable=SC2001 OUTPUT_ALL_MODIFIED_FILES=$(echo "$ALL_MODIFIED_FILES" | sed "s/$INPUT_SEPARATOR/ /g") ALL_INPUT_FILES=${INPUT_FILES//\n/ }