From 368be5bbf09bb67c19b8f76832b1248196a6484e Mon Sep 17 00:00:00 2001 From: Tonye Jack Date: Sat, 4 Sep 2021 09:42:11 -0400 Subject: [PATCH] Rename all_changed_files to all_changed_and_modified_files. (#187) --- .github/workflows/test.yml | 10 +++++----- README.md | 2 +- action.yml | 4 ++-- entrypoint.sh | 8 ++++---- 4 files changed, 12 insertions(+), 12 deletions(-) diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index 19f7c43f..5843ea9d 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -188,14 +188,14 @@ jobs: files: | entrypoint.sh *.sh - - name: Verify all_changed_files files has no duplicates + - name: Verify all_changed_and_modified_files files has no duplicates if: contains(steps.changed-files-specific-duplicate-output.outputs.all_modified_files, 'entrypoint.sh') run: | - ALL_CHANGED_FILES=(${{ steps.changed-files-specific-duplicate-output.outputs.all_modified_files }}) - UNIQUE_ALL_CHANGED_FILES=$(echo "$ALL_CHANGED_FILES" | tr ' ' '\n' | sort -u | xargs) + ALL_CHANGED_AND_MODIFIED_FILES=(${{ steps.changed-files-specific-duplicate-output.outputs.all_modified_files }}) + UNIQUE_ALL_CHANGED_AND_MODIFIED_FILES=$(echo "$ALL_CHANGED_AND_MODIFIED_FILES" | tr ' ' '\n' | sort -u | xargs) - if [[ "$ALL_CHANGED_FILES[@]" != "$UNIQUE_ALL_CHANGED_FILES[@]" ]]; then - echo "Duplicate output: Expected "$UNIQUE_ALL_CHANGED_FILES" got $ALL_CHANGED_FILES" + if [[ "$ALL_CHANGED_AND_MODIFIED_FILES[@]" != "$UNIQUE_ALL_CHANGED_AND_MODIFIED_FILES[@]" ]]; then + echo "Duplicate output: Expected "$UNIQUE_ALL_CHANGED_AND_MODIFIED_FILES" got $ALL_CHANGED_AND_MODIFIED_FILES" exit 1 fi shell: diff --git a/README.md b/README.md index 684dff3b..e91e7032 100644 --- a/README.md +++ b/README.md @@ -85,7 +85,7 @@ jobs: | 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 other changed files
not listed in the files input
i.e. *a combination of all added,
copied and modified files (ACMR).* | | 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 changed files (\*)
i.e. *a combination of (ACMRDTUX).* | +| all_changed_and_modified_files | `string` | `'new.txt path/to/file.png ...'` | Select all changed files (\*)
i.e. *a combination of (ACMRDTUX).* | | 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) | | deleted_files | `string` | `'new.txt path/to/file.png ...'` | Select only files that are Deleted (D) | diff --git a/action.yml b/action.yml index ec10159f..dcabfa3c 100644 --- a/action.yml +++ b/action.yml @@ -54,9 +54,9 @@ outputs: unknown_files: description: List of unknown files. value: ${{ steps.changed-files.outputs.unknown_files }} - all_changed_files: + all_changed_and_modified_files: description: List of all changed files. - value: ${{ steps.changed-files.outputs.all_changed_files }} + value: ${{ steps.changed-files.outputs.all_changed_and_modified_files }} all_modified_files: description: List of all copied modified and added files. value: ${{ steps.changed-files.outputs.all_modified_files }} diff --git a/entrypoint.sh b/entrypoint.sh index b8eb4325..afc73d2a 100755 --- a/entrypoint.sh +++ b/entrypoint.sh @@ -72,7 +72,7 @@ if [[ -z "${INPUT_FILES[*]}" ]]; then TYPE_CHANGED=$(git diff --diff-filter=T --name-only "$PREVIOUS_SHA" "$CURRENT_SHA" | awk -v d="$INPUT_SEPARATOR" '{s=(NR==1?s:s d)$0}END{print s}') UNMERGED=$(git diff --diff-filter=U --name-only "$PREVIOUS_SHA" "$CURRENT_SHA" | awk -v d="$INPUT_SEPARATOR" '{s=(NR==1?s:s d)$0}END{print s}') UNKNOWN=$(git diff --diff-filter=X --name-only "$PREVIOUS_SHA" "$CURRENT_SHA" | awk -v d="$INPUT_SEPARATOR" '{s=(NR==1?s:s d)$0}END{print s}') - ALL_CHANGED=$(git diff --diff-filter="*ACDMRTUX" --name-only "$PREVIOUS_SHA" "$CURRENT_SHA" | awk -v d="$INPUT_SEPARATOR" '{s=(NR==1?s:s d)$0}END{print s}') + ALL_CHANGED_AND_MODIFIED=$(git diff --diff-filter="*ACDMRTUX" --name-only "$PREVIOUS_SHA" "$CURRENT_SHA" | awk -v d="$INPUT_SEPARATOR" '{s=(NR==1?s:s d)$0}END{print s}') ALL_MODIFIED_FILES=$(git diff --diff-filter="ACMR" --name-only "$PREVIOUS_SHA" "$CURRENT_SHA" | awk -v d="$INPUT_SEPARATOR" '{s=(NR==1?s:s d)$0}END{print s}') else ADDED_ARRAY=() @@ -122,7 +122,7 @@ else TYPE_CHANGED=$(echo "${TYPE_CHANGED_ARRAY[*]}" | tr " " "\n" | sort -u | awk -v d="$INPUT_SEPARATOR" '{s=(NR==1?s:s d)$0}END{print s}') UNMERGED=$(echo "${UNMERGED_ARRAY[*]}" | tr " " "\n" | sort -u | awk -v d="$INPUT_SEPARATOR" '{s=(NR==1?s:s d)$0}END{print s}') UNKNOWN=$(echo "${UNKNOWN_ARRAY[*]}" | tr " " "\n" | sort -u | awk -v d="$INPUT_SEPARATOR" '{s=(NR==1?s:s d)$0}END{print s}') - ALL_CHANGED=$(echo "${ALL_CHANGED_ARRAY[*]}" | tr " " "\n" | sort -u | awk -v d="$INPUT_SEPARATOR" '{s=(NR==1?s:s d)$0}END{print s}') + ALL_CHANGED_AND_MODIFIED=$(echo "${ALL_CHANGED_ARRAY[*]}" | tr " " "\n" | sort -u | awk -v d="$INPUT_SEPARATOR" '{s=(NR==1?s:s d)$0}END{print s}') ALL_MODIFIED_FILES=$(echo "${ALL_MODIFIED_FILES_ARRAY[*]}" | tr " " "\n" | sort -u | awk -v d="$INPUT_SEPARATOR" '{s=(NR==1?s:s d)$0}END{print s}') ALL_OTHER_CHANGED_FILES=$(git diff --diff-filter="ACMR" --name-only "$PREVIOUS_SHA" "$CURRENT_SHA") @@ -156,7 +156,7 @@ echo "Renamed files: $RENAMED" echo "Type Changed files: $TYPE_CHANGED" echo "Unmerged files: $UNMERGED" echo "Unknown files: $UNKNOWN" -echo "All changed files: $ALL_CHANGED" +echo "All changed files: $ALL_CHANGED_AND_MODIFIED" echo "All modified files: $ALL_MODIFIED_FILES" git remote remove temp_changed_files @@ -169,7 +169,7 @@ echo "::set-output name=renamed_files::$RENAMED" echo "::set-output name=type_changed_files::$TYPE_CHANGED" echo "::set-output name=unmerged_files::$UNMERGED" echo "::set-output name=unknown_files::$UNKNOWN" -echo "::set-output name=all_changed_files::$ALL_CHANGED" +echo "::set-output name=all_changed_and_modified_files::$ALL_CHANGED_AND_MODIFIED" echo "::set-output name=all_modified_files::$ALL_MODIFIED_FILES" echo "::endgroup::"