3
0
Fork 0
mirror of https://github.com/tj-actions/changed-files synced 2024-12-17 13:47:20 +00:00
changed-files/sourcefiles.sh
Tonye Jack 4e8540cc23
Add support for using github's glob pattern syntax (#304)
* Add support for using github's glob pattern syntax

Fixes: #264 #265

* Update sourcefiles.sh

* Update sourcefiles.sh

* Update sourcefiles.sh

* Update sourcefiles.sh

* Update sourcefiles.sh

* Update sourcefiles.sh

* Update sourcefiles.sh

* Update sourcefiles.sh

Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>

* Update sourcefiles.sh

* Update sourcefiles.sh

* Update action.yml

* Update action.yml

* Update action.yml

* Update action.yml

* Update sourcefiles.sh

* Update sourcefiles.sh

* Update sourcefiles.sh

* Update sourcefiles.sh

* Update sourcefiles.sh

* Update sourcefiles.sh

* Update sourcefiles.sh

* Update sourcefiles.sh

* Update sourcefiles.sh

* Update sourcefiles.sh

* Update sourcefiles.sh

* Update sourcefiles.sh

* Update sourcefiles.sh

* Update sourcefiles.sh

* Update sourcefiles.sh

* Update sourcefiles.sh

* Update sourcefiles.sh

* Update sourcefiles.sh

* Update sourcefiles.sh

* Update sourcefiles.sh

* Update sourcefiles.sh

* Update sourcefiles.sh

* Update sourcefiles.sh

* Update sourcefiles.sh

* Update sourcefiles.sh

* Update sourcefiles.sh

* Update sourcefiles.sh

* Update sourcefiles.sh

* Update sourcefiles.sh

* Update sourcefiles.sh

* Update sourcefiles.sh

* Update sourcefiles.sh

* Update action.yml

* Update test.yml

* Update changed-files-list.txt

* Update changed-files-list.txt

* Update action.yml

* Update action.yml

* Update entrypoint.sh

* Update test.yml

* Update README.md

* Update test.yml

* Update entrypoint.sh

* Update test.yml

Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>
2022-01-04 21:38:03 -05:00

30 lines
922 B
Bash

#!/usr/bin/env bash
set -e
echo "::group::changed-files-from-source-file"
RAW_FILES=()
if [[ -n $INPUT_FILES_FROM_SOURCE_FILE ]]; then
for file in $INPUT_FILES_FROM_SOURCE_FILE
do
while read -r fileName; do
RAW_FILES+=("$fileName")
done <"$file"
done
fi
IFS=" " read -r -a CLEAN_FILES <<< "$(echo "${RAW_FILES[*]}" | tr "\r\n" "\n" | tr " " "\n" | sort -u | awk -v d=" " '{s=(NR==1?s:s d)$0}END{print s}')"
IFS=" " read -r -a CLEAN_INPUT_FILES <<< "$(echo "${INPUT_FILES}" | tr "\r\n" "\n" | tr " " "\n" | sort -u | awk -v d=" " '{s=(NR==1?s:s d)$0}END{print s}')"
FILES=("${CLEAN_FILES[@]}" "${CLEAN_INPUT_FILES[@]}")
IFS=" " read -r -a ALL_UNIQUE_FILES <<< "$(echo "${FILES[@]}" | tr "\r\n" "\n" | tr " " "\n" | sort -u | awk -v d=" " '{s=(NR==1?s:s d)$0}END{print s}')"
echo "Input files: ${ALL_UNIQUE_FILES[*]}"
echo "::set-output name=files::${ALL_UNIQUE_FILES[*]}"
echo "::endgroup::"