From 7abdbc94e90b9a9b002ad86d8d2a5f9472c3c75c Mon Sep 17 00:00:00 2001 From: Tonye Jack Date: Sat, 24 Jul 2021 08:53:47 -0400 Subject: [PATCH] Update `any_changed` to include renamed files. (#145) --- README.md | 6 +++--- entrypoint.sh | 6 +++--- 2 files changed, 6 insertions(+), 6 deletions(-) diff --git a/README.md b/README.md index 6753ca02..cd5e6b0d 100644 --- a/README.md +++ b/README.md @@ -79,10 +79,10 @@ jobs: | Output | type | example | description | |:--------------------:|:------------:|:----------------------------------:|:----------------------------------------:| -| any_changed | `string` | `true` OR `false` | Returns `true` when any of the filenames provided using the `files` input has changed | -| only_changed | `string` | `true` OR `false` | Returns `true` when only files provided using the `files` input have changed. | +| any_changed | `string` | `true` OR `false` | Returns `true` when any
of the filenames provided using
the `files` input has changed (ACMR) | +| only_changed | `string` | `true` OR `false` | Returns `true` when only
files provided using
the `files` input have changed. | | other_changed_files | `string` | `'new.txt path/to/file.png ...'` | Select all modified files
not listed in the files input
i.e. *a combination of all added,
copied and modified files (ACM).* | -| all_modified_files | `string` | `'new.txt path/to/file.png ...'` | Select all modified files
i.e. *a combination of all added,
copied and modified files (ACM).* | +| all_modified_files | `string` | `'new.txt path/to/file.png ...'` | Select all modified files
i.e. *a combination of all added,
copied, modified and renamed files (ACMR).* | | all_changed_files | `string` | `'new.txt path/to/file.png ...'` | Select all paths (\*)
i.e. *a combination of all options below.* | | added_files | `string` | `'new.txt path/to/file.png ...'` | Select only files that are Added (A) | | copied_files | `string` | `'new.txt path/to/file.png ...'` | Select only files that are Copied (C) | diff --git a/entrypoint.sh b/entrypoint.sh index 8fca7be4..d3872302 100755 --- a/entrypoint.sh +++ b/entrypoint.sh @@ -64,7 +64,7 @@ if [[ -z "$UNIQUE_FILES" ]]; then UNMERGED=$(git diff --diff-filter=U --name-only "$PREVIOUS_SHA" "$CURRENT_SHA" | tr "\n" "$INPUT_SEPARATOR" | sed -E "s/($INPUT_SEPARATOR)$//") UNKNOWN=$(git diff --diff-filter=X --name-only "$PREVIOUS_SHA" "$CURRENT_SHA" | tr "\n" "$INPUT_SEPARATOR" | sed -E "s/($INPUT_SEPARATOR)$//") ALL_CHANGED=$(git diff --diff-filter="*ACDMRTUX" --name-only "$PREVIOUS_SHA" "$CURRENT_SHA" | tr "\n" "$INPUT_SEPARATOR" | sed -E "s/($INPUT_SEPARATOR)$//") - ALL_MODIFIED_FILES=$(git diff --diff-filter="ACM" --name-only "$PREVIOUS_SHA" "$CURRENT_SHA" | tr "\n" "$INPUT_SEPARATOR" | sed -E "s/($INPUT_SEPARATOR)$//") + ALL_MODIFIED_FILES=$(git diff --diff-filter="ACMR" --name-only "$PREVIOUS_SHA" "$CURRENT_SHA" | tr "\n" "$INPUT_SEPARATOR" | sed -E "s/($INPUT_SEPARATOR)$//") else ADDED_ARRAY=() COPIED_ARRAY=() @@ -100,7 +100,7 @@ else # shellcheck disable=SC2207 ALL_CHANGED_ARRAY+=($(git diff --diff-filter="*ACDMRTUX" --name-only "$PREVIOUS_SHA" "$CURRENT_SHA" | grep -E "(${path})" | xargs || true)) # shellcheck disable=SC2207 - ALL_MODIFIED_FILES_ARRAY+=($(git diff --diff-filter="ACM" --name-only "$PREVIOUS_SHA" "$CURRENT_SHA" | grep -E "(${path})" | xargs || true)) + ALL_MODIFIED_FILES_ARRAY+=($(git diff --diff-filter="ACMR" --name-only "$PREVIOUS_SHA" "$CURRENT_SHA" | grep -E "(${path})" | xargs || true)) done # shellcheck disable=SC2001 @@ -139,7 +139,7 @@ echo "All modified files: $ALL_MODIFIED_FILES" if [[ -n "$UNIQUE_FILES" ]]; then # shellcheck disable=SC2001 ALL_INPUT_FILES=$(echo "$UNIQUE_FILES" | tr "\n" " " | xargs) - ALL_OTHER_CHANGED_FILES=$(git diff --diff-filter="ACM" --name-only "$PREVIOUS_SHA" "$CURRENT_SHA") + ALL_OTHER_CHANGED_FILES=$(git diff --diff-filter="ACMR" --name-only "$PREVIOUS_SHA" "$CURRENT_SHA") OTHER_CHANGED_FILES=$(echo "${ALL_OTHER_CHANGED_FILES[@]}" "${ALL_MODIFIED_FILES[@]}" | tr ' ' '\n' | sort | uniq -u | tr "\n" " " | xargs)