mirror of
https://github.com/tj-actions/changed-files
synced 2024-12-17 03:47:20 +00:00
Renamed output.
This commit is contained in:
parent
044773f27a
commit
b60efcf625
4 changed files with 18 additions and 18 deletions
20
.github/workflows/test.yml
vendored
20
.github/workflows/test.yml
vendored
|
@ -295,38 +295,38 @@ jobs:
|
||||||
shell:
|
shell:
|
||||||
bash
|
bash
|
||||||
- name: Run changed-files for old new filenames test rename 1
|
- 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: ./
|
uses: ./
|
||||||
with:
|
with:
|
||||||
base_sha: d1c0ee4
|
base_sha: d1c0ee4
|
||||||
sha: 4d04215
|
sha: 4d04215
|
||||||
- name: Show output
|
- name: Show output
|
||||||
run: |
|
run: |
|
||||||
echo '${{ toJSON(steps.changed-files-old-new-1.outputs) }}'
|
echo '${{ toJSON(steps.changed-files-all-old-new-renamed-files-1.outputs) }}'
|
||||||
shell:
|
shell:
|
||||||
bash
|
bash
|
||||||
- name: Check old_new_files output
|
- name: Check all_old_new_renamed_files output
|
||||||
if: "!contains(steps.changed-files-old-new-1.outputs.old_new_files, 'test/test rename 1.txt,test/test rename-1.txt')"
|
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: |
|
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
|
exit 1
|
||||||
shell:
|
shell:
|
||||||
bash
|
bash
|
||||||
- name: Run changed-files for old new filenames test rename 2
|
- 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: ./
|
uses: ./
|
||||||
with:
|
with:
|
||||||
base_sha: 4d04215
|
base_sha: 4d04215
|
||||||
sha: fe238e6
|
sha: fe238e6
|
||||||
- name: Show output
|
- name: Show output
|
||||||
run: |
|
run: |
|
||||||
echo '${{ toJSON(steps.changed-files-old-new-2.outputs) }}'
|
echo '${{ toJSON(steps.changed-files-all-old-new-renamed-files-2.outputs) }}'
|
||||||
shell:
|
shell:
|
||||||
bash
|
bash
|
||||||
- name: Check old_new_files output
|
- name: Check all_old_new_renamed_files output
|
||||||
if: "!contains(steps.changed-files-old-new-2.outputs.old_new_files, 'test/test rename 2.txt,test/test rename-2.txt')"
|
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: |
|
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
|
exit 1
|
||||||
shell:
|
shell:
|
||||||
bash
|
bash
|
||||||
|
|
|
@ -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) |
|
| 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) |
|
| 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) |
|
| 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) |
|
| 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) |
|
| 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) |
|
| unknown\_files | `string` | `'new.txt path/to/file.png ...'` | Select only files that are Unknown (X) |
|
||||||
|
|
|
@ -82,9 +82,9 @@ outputs:
|
||||||
renamed_files:
|
renamed_files:
|
||||||
description: List of renamed files.
|
description: List of renamed files.
|
||||||
value: ${{ steps.changed-files.outputs.renamed_files }}
|
value: ${{ steps.changed-files.outputs.renamed_files }}
|
||||||
old_new_files:
|
all_old_new_renamed_files:
|
||||||
description: List of old and new names of renamed files.
|
description: List of all old and new names of renamed files.
|
||||||
value: ${{ steps.changed-files.outputs.old_new_files }}
|
value: ${{ steps.changed-files.outputs.all_old_new_renamed_files }}
|
||||||
type_changed_files:
|
type_changed_files:
|
||||||
description: List of files that had type changes.
|
description: List of files that had type changes.
|
||||||
value: ${{ steps.changed-files.outputs.type_changed_files }}
|
value: ${{ steps.changed-files.outputs.type_changed_files }}
|
||||||
|
|
|
@ -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_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_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}')
|
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
|
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}')
|
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}')
|
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_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_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}')
|
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}')
|
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}')
|
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 "Deleted files: $DELETED"
|
||||||
echo "Modified files: $MODIFIED"
|
echo "Modified files: $MODIFIED"
|
||||||
echo "Renamed files: $RENAMED"
|
echo "Renamed files: $RENAMED"
|
||||||
echo "Old new files: $OLD_NEW"
|
|
||||||
echo "Type Changed files: $TYPE_CHANGED"
|
echo "Type Changed files: $TYPE_CHANGED"
|
||||||
echo "Unmerged files: $UNMERGED"
|
echo "Unmerged files: $UNMERGED"
|
||||||
echo "Unknown files: $UNKNOWN"
|
echo "Unknown files: $UNKNOWN"
|
||||||
echo "All changed and modified files: $ALL_CHANGED_AND_MODIFIED"
|
echo "All changed and modified files: $ALL_CHANGED_AND_MODIFIED"
|
||||||
echo "All changed files: $ALL_CHANGED"
|
echo "All changed files: $ALL_CHANGED"
|
||||||
echo "All modified files: $ALL_MODIFIED"
|
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=added_files::$ADDED"
|
||||||
echo "::set-output name=copied_files::$COPIED"
|
echo "::set-output name=copied_files::$COPIED"
|
||||||
echo "::set-output name=deleted_files::$DELETED"
|
echo "::set-output name=deleted_files::$DELETED"
|
||||||
echo "::set-output name=modified_files::$MODIFIED"
|
echo "::set-output name=modified_files::$MODIFIED"
|
||||||
echo "::set-output name=renamed_files::$RENAMED"
|
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=type_changed_files::$TYPE_CHANGED"
|
||||||
echo "::set-output name=unmerged_files::$UNMERGED"
|
echo "::set-output name=unmerged_files::$UNMERGED"
|
||||||
echo "::set-output name=unknown_files::$UNKNOWN"
|
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_and_modified_files::$ALL_CHANGED_AND_MODIFIED"
|
||||||
echo "::set-output name=all_changed_files::$ALL_CHANGED"
|
echo "::set-output name=all_changed_files::$ALL_CHANGED"
|
||||||
echo "::set-output name=all_modified_files::$ALL_MODIFIED"
|
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::"
|
echo "::endgroup::"
|
||||||
|
|
Loading…
Reference in a new issue