mirror of
https://github.com/tj-actions/changed-files
synced 2024-12-17 03:47:20 +00:00
Dedupe output file names. (#153)
This commit is contained in:
parent
dc688ad0b2
commit
75933dc40b
2 changed files with 29 additions and 10 deletions
19
.github/workflows/test.yml
vendored
19
.github/workflows/test.yml
vendored
|
@ -108,6 +108,25 @@ jobs:
|
|||
echo "${{ toJSON(steps.changed-files-specific.outputs) }}"
|
||||
shell:
|
||||
bash
|
||||
- name: Run changed-files with specific files comma check duplicates
|
||||
id: changed-files-specific-duplicate-output
|
||||
uses: ./
|
||||
with:
|
||||
files: |
|
||||
entrypoint.sh
|
||||
*.sh
|
||||
- name: Verify all_changed_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)
|
||||
|
||||
if [[ "$ALL_CHANGED_FILES[@]" != "$UNIQUE_ALL_CHANGED_FILES[@]" ]]; then
|
||||
echo "Duplicate output: Expected "$UNIQUE_ALL_CHANGED_FILES" got $ALL_CHANGED_FILES"
|
||||
exit 1
|
||||
fi
|
||||
shell:
|
||||
bash
|
||||
- name: Run changed-files with specific files comma separator
|
||||
id: changed-files-specific-comma
|
||||
uses: ./
|
||||
|
|
|
@ -104,25 +104,25 @@ else
|
|||
done
|
||||
|
||||
# shellcheck disable=SC2001
|
||||
ADDED=$(echo "${ADDED_ARRAY[*]}" | sed 's/ */'"$INPUT_SEPARATOR"'/g')
|
||||
ADDED=$(echo "${ADDED_ARRAY[*]}" | sed 's/ */'"$INPUT_SEPARATOR"'/g' | tr ' ' '\n' | sort -u | xargs)
|
||||
# shellcheck disable=SC2001
|
||||
COPIED=$(echo "${COPIED_ARRAY[*]}" | sed 's/ */'"$INPUT_SEPARATOR"'/g')
|
||||
COPIED=$(echo "${COPIED_ARRAY[*]}" | sed 's/ */'"$INPUT_SEPARATOR"'/g' | tr ' ' '\n' | sort -u | xargs)
|
||||
# shellcheck disable=SC2001
|
||||
DELETED=$(echo "${DELETED_ARRAY[*]}" | sed 's/ */'"$INPUT_SEPARATOR"'/g')
|
||||
DELETED=$(echo "${DELETED_ARRAY[*]}" | sed 's/ */'"$INPUT_SEPARATOR"'/g' | tr ' ' '\n' | sort -u | xargs)
|
||||
# shellcheck disable=SC2001
|
||||
MODIFIED=$(echo "${MODIFIED_ARRAY[*]}" | sed 's/ */'"$INPUT_SEPARATOR"'/g')
|
||||
MODIFIED=$(echo "${MODIFIED_ARRAY[*]}" | sed 's/ */'"$INPUT_SEPARATOR"'/g' | tr ' ' '\n' | sort -u | xargs)
|
||||
# shellcheck disable=SC2001
|
||||
RENAMED=$(echo "${RENAMED_ARRAY[*]}" | sed 's/ */'"$INPUT_SEPARATOR"'/g')
|
||||
RENAMED=$(echo "${RENAMED_ARRAY[*]}" | sed 's/ */'"$INPUT_SEPARATOR"'/g' | tr ' ' '\n' | sort -u | xargs)
|
||||
# shellcheck disable=SC2001
|
||||
TYPE_CHANGED=$(echo "${TYPE_CHANGED_ARRAY[*]}" | sed 's/ */'"$INPUT_SEPARATOR"'/g')
|
||||
TYPE_CHANGED=$(echo "${TYPE_CHANGED_ARRAY[*]}" | sed 's/ */'"$INPUT_SEPARATOR"'/g' | tr ' ' '\n' | sort -u | xargs)
|
||||
# shellcheck disable=SC2001
|
||||
UNMERGED=$(echo "${UNMERGED_ARRAY[*]}" | sed 's/ */'"$INPUT_SEPARATOR"'/g')
|
||||
UNMERGED=$(echo "${UNMERGED_ARRAY[*]}" | sed 's/ */'"$INPUT_SEPARATOR"'/g' | tr ' ' '\n' | sort -u | xargs)
|
||||
# shellcheck disable=SC2001
|
||||
UNKNOWN=$(echo "${UNKNOWN_ARRAY[*]}" | sed 's/ */'"$INPUT_SEPARATOR"'/g')
|
||||
UNKNOWN=$(echo "${UNKNOWN_ARRAY[*]}" | sed 's/ */'"$INPUT_SEPARATOR"'/g' | tr ' ' '\n' | sort -u | xargs)
|
||||
# shellcheck disable=SC2001
|
||||
ALL_CHANGED=$(echo "${ALL_CHANGED_ARRAY[*]}" | sed 's/ */'"$INPUT_SEPARATOR"'/g')
|
||||
ALL_CHANGED=$(echo "${ALL_CHANGED_ARRAY[*]}" | sed 's/ */'"$INPUT_SEPARATOR"'/g' | tr ' ' '\n' | sort -u | xargs)
|
||||
# shellcheck disable=SC2001
|
||||
ALL_MODIFIED_FILES=$(echo "${ALL_MODIFIED_FILES_ARRAY[*]}" | sed 's/ */'"$INPUT_SEPARATOR"'/g')
|
||||
ALL_MODIFIED_FILES=$(echo "${ALL_MODIFIED_FILES_ARRAY[*]}" | sed 's/ */'"$INPUT_SEPARATOR"'/g' | tr ' ' '\n' | sort -u | xargs)
|
||||
fi
|
||||
|
||||
echo "Added files: $ADDED"
|
||||
|
|
Loading…
Reference in a new issue