3
0
Fork 0
mirror of https://github.com/tj-actions/changed-files synced 2024-12-17 13:47:20 +00:00

Added better logging.

This commit is contained in:
Tonye Jack 2021-05-01 16:26:36 -04:00
parent b2c601819d
commit 18496eb7e4

View file

@ -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/ }