From b60efcf625f7d808d6d95840a8f4fe3486fc8396 Mon Sep 17 00:00:00 2001 From: Tonye Jack Date: Sat, 14 May 2022 17:54:38 -0400 Subject: [PATCH] Renamed output. --- .github/workflows/test.yml | 20 ++++++++++---------- README.md | 2 +- action.yml | 6 +++--- entrypoint.sh | 8 ++++---- 4 files changed, 18 insertions(+), 18 deletions(-) diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index ebb0f074..f965221d 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -295,38 +295,38 @@ jobs: shell: bash - name: Run changed-files for old new filenames test rename 1 - id: changed-files-old-new-1 + id: changed-files-all-old-new-renamed-files-1 uses: ./ with: base_sha: d1c0ee4 sha: 4d04215 - name: Show output run: | - echo '${{ toJSON(steps.changed-files-old-new-1.outputs) }}' + echo '${{ toJSON(steps.changed-files-all-old-new-renamed-files-1.outputs) }}' shell: bash - - name: Check old_new_files output - if: "!contains(steps.changed-files-old-new-1.outputs.old_new_files, 'test/test rename 1.txt,test/test rename-1.txt')" + - name: Check all_old_new_renamed_files output + if: "!contains(steps.changed-files-all-old-new-renamed-files-1.outputs.old_new_files, 'test/test rename 1.txt,test/test rename-1.txt')" run: | - echo "Invalid output: Expected to include (test/test rename 1.txt,test/test rename-1.txt) got (${{ steps.changed-files-old-new-1.outputs.old_new_files }})" + echo "Invalid output: Expected to include (test/test rename 1.txt,test/test rename-1.txt) got (${{ steps.changed-files-all-old-new-renamed-files-1.outputs.old_new_files }})" exit 1 shell: bash - name: Run changed-files for old new filenames test rename 2 - id: changed-files-old-new-2 + id: changed-files-all-old-new-renamed-files-2 uses: ./ with: base_sha: 4d04215 sha: fe238e6 - name: Show output run: | - echo '${{ toJSON(steps.changed-files-old-new-2.outputs) }}' + echo '${{ toJSON(steps.changed-files-all-old-new-renamed-files-2.outputs) }}' shell: bash - - name: Check old_new_files output - if: "!contains(steps.changed-files-old-new-2.outputs.old_new_files, 'test/test rename 2.txt,test/test rename-2.txt')" + - name: Check all_old_new_renamed_files output + if: "!contains(steps.changed-files-all-old-new-renamed-files-2.outputs.old_new_files, 'test/test rename 2.txt,test/test rename-2.txt')" run: | - echo "Invalid output: Expected to include (test/test rename 2.txt test/test rename-2.txt) got (${{ steps.changed-files-old-new-2.outputs.old_new_files }})" + echo "Invalid output: Expected to include (test/test rename 2.txt test/test rename-2.txt) got (${{ steps.changed-files-all-old-new-renamed-files-2.outputs.old_new_files }})" exit 1 shell: bash diff --git a/README.md b/README.md index e5919072..1802ec44 100644 --- a/README.md +++ b/README.md @@ -119,7 +119,7 @@ Support this project with a :star: | deleted\_files | `string` | `'new.txt path/to/file.png ...'` | Select only files that are Deleted (D) | | modified\_files | `string` | `'new.txt path/to/file.png ...'` | Select only files that are Modified (M) | | renamed\_files | `string` | `'new.txt path/to/file.png ...'` | Select only files that are Renamed (R) | -| old\_new\_files | `string` | `'old name.txt,new name.txt old name 2.txt,new name 2.txt...'` | Select only files that are Renamed and list their old and new names (R) | +| all_old_new_renamed_files | `string` | `'old name.txt,new name.txt old name 2.txt,new name 2.txt...'` | Select only files that are Renamed and list their old and new names (R) | | type\_changed\_files | `string` | `'new.txt path/to/file.png ...'` | Select only files that have their file type changed (T) | | unmerged\_files | `string` | `'new.txt path/to/file.png ...'` | Select only files that are Unmerged (U) | | unknown\_files | `string` | `'new.txt path/to/file.png ...'` | Select only files that are Unknown (X) | diff --git a/action.yml b/action.yml index 911927b3..fd10f53a 100644 --- a/action.yml +++ b/action.yml @@ -82,9 +82,9 @@ outputs: renamed_files: description: List of renamed files. value: ${{ steps.changed-files.outputs.renamed_files }} - old_new_files: - description: List of old and new names of renamed files. - value: ${{ steps.changed-files.outputs.old_new_files }} + all_old_new_renamed_files: + description: List of all old and new names of renamed files. + value: ${{ steps.changed-files.outputs.all_old_new_renamed_files }} type_changed_files: description: List of files that had type changes. value: ${{ steps.changed-files.outputs.type_changed_files }} diff --git a/entrypoint.sh b/entrypoint.sh index bd172c27..b3ef8751 100755 --- a/entrypoint.sh +++ b/entrypoint.sh @@ -78,7 +78,7 @@ if [[ -z "$INPUT_FILES_PATTERN_FILE" ]]; then ALL_CHANGED_AND_MODIFIED=$(get_diff "$INPUT_PREVIOUS_SHA" "$INPUT_CURRENT_SHA" "*ACDMRTUX" | awk -v d="$INPUT_SEPARATOR" '{s=(NR==1?s:s d)$0}END{print s}') ALL_CHANGED=$(get_diff "$INPUT_PREVIOUS_SHA" "$INPUT_CURRENT_SHA" "ACMR" | awk -v d="$INPUT_SEPARATOR" '{s=(NR==1?s:s d)$0}END{print s}') ALL_MODIFIED=$(get_diff "$INPUT_PREVIOUS_SHA" "$INPUT_CURRENT_SHA" "ACMRD" | awk -v d="$INPUT_SEPARATOR" '{s=(NR==1?s:s d)$0}END{print s}') - OLD_NEW=$(get_renames "$INPUT_PREVIOUS_SHA" "$INPUT_CURRENT_SHA" | awk -v d="$INPUT_OLD_NEW_FILES_SEPARATOR" '{s=(NR==1?s:s d)$0}END{print s}') + ALL_OLD_NEW_RENAMED_FILES=$(get_renames "$INPUT_PREVIOUS_SHA" "$INPUT_CURRENT_SHA" | awk -v d="$INPUT_OLD_NEW_FILES_SEPARATOR" '{s=(NR==1?s:s d)$0}END{print s}') else ADDED=$(get_diff "$INPUT_PREVIOUS_SHA" "$INPUT_CURRENT_SHA" A | grep -x -E -f "$INPUT_FILES_PATTERN_FILE" | awk -v d="|" '{s=(NR==1?s:s d)$0}END{print s}') COPIED=$(get_diff "$INPUT_PREVIOUS_SHA" "$INPUT_CURRENT_SHA" C | grep -x -E -f "$INPUT_FILES_PATTERN_FILE" | awk -v d="|" '{s=(NR==1?s:s d)$0}END{print s}') @@ -91,7 +91,7 @@ else ALL_CHANGED_AND_MODIFIED=$(get_diff "$INPUT_PREVIOUS_SHA" "$INPUT_CURRENT_SHA" "*ACDMRTUX" | grep -x -E -f "$INPUT_FILES_PATTERN_FILE" | awk -v d="|" '{s=(NR==1?s:s d)$0}END{print s}') ALL_CHANGED=$(get_diff "$INPUT_PREVIOUS_SHA" "$INPUT_CURRENT_SHA" "ACMR" | grep -x -E -f "$INPUT_FILES_PATTERN_FILE" | awk -v d="|" '{s=(NR==1?s:s d)$0}END{print s}') ALL_MODIFIED=$(get_diff "$INPUT_PREVIOUS_SHA" "$INPUT_CURRENT_SHA" "ACMRD" | grep -x -E -f "$INPUT_FILES_PATTERN_FILE" | awk -v d="|" '{s=(NR==1?s:s d)$0}END{print s}') - OLD_NEW=$(get_renames "$INPUT_PREVIOUS_SHA" "$INPUT_CURRENT_SHA" | grep -x -E -f "$INPUT_FILES_PATTERN_FILE" | awk -v d="$INPUT_OLD_NEW_FILES_SEPARATOR" '{s=(NR==1?s:s d)$0}END{print s}') + ALL_OLD_NEW_RENAMED_FILES=$(get_renames "$INPUT_PREVIOUS_SHA" "$INPUT_CURRENT_SHA" | grep -x -E -f "$INPUT_FILES_PATTERN_FILE" | awk -v d="$INPUT_OLD_NEW_FILES_SEPARATOR" '{s=(NR==1?s:s d)$0}END{print s}') ALL_OTHER_CHANGED=$(get_diff "$INPUT_PREVIOUS_SHA" "$INPUT_CURRENT_SHA" "ACMR" | awk -v d="|" '{s=(NR==1?s:s d)$0}END{print s}') UNIQUE_ALL_CHANGED=$(echo "${ALL_CHANGED}" | awk '{gsub(/\|/,"\n"); print $0;}' | awk '!a[$0]++' | awk -v d="|" '{s=(NR==1?s:s d)$0}END{print s}') @@ -203,25 +203,25 @@ echo "Copied files: $COPIED" echo "Deleted files: $DELETED" echo "Modified files: $MODIFIED" echo "Renamed files: $RENAMED" -echo "Old new files: $OLD_NEW" echo "Type Changed files: $TYPE_CHANGED" echo "Unmerged files: $UNMERGED" echo "Unknown files: $UNKNOWN" echo "All changed and modified files: $ALL_CHANGED_AND_MODIFIED" echo "All changed files: $ALL_CHANGED" echo "All modified files: $ALL_MODIFIED" +echo "All old & new renamed files: $ALL_OLD_NEW_RENAMED_FILES" echo "::set-output name=added_files::$ADDED" echo "::set-output name=copied_files::$COPIED" echo "::set-output name=deleted_files::$DELETED" echo "::set-output name=modified_files::$MODIFIED" echo "::set-output name=renamed_files::$RENAMED" -echo "::set-output name=old_new_files::$OLD_NEW" 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_and_modified_files::$ALL_CHANGED_AND_MODIFIED" echo "::set-output name=all_changed_files::$ALL_CHANGED" echo "::set-output name=all_modified_files::$ALL_MODIFIED" +echo "::set-output name=all_old_new_renamed_files::$ALL_OLD_NEW_RENAMED_FILES" echo "::endgroup::"