mirror of
https://github.com/tj-actions/changed-files
synced 2025-01-29 03:34:50 +00:00
Update other_changed_files output to also use the separator (#186)
This commit is contained in:
parent
847613ee23
commit
9cc7563ef7
2 changed files with 12 additions and 7 deletions
2
.github/workflows/update-readme.yml
vendored
2
.github/workflows/update-readme.yml
vendored
|
@ -22,11 +22,13 @@ jobs:
|
|||
with:
|
||||
files: |
|
||||
README.md
|
||||
|
||||
- name: README.md changed
|
||||
if: steps.verify_changed_files.outputs.files_changed == 'true'
|
||||
run: |
|
||||
echo "README.md has uncommited changes"
|
||||
exit 1
|
||||
|
||||
- name: Create Pull Request
|
||||
if: failure()
|
||||
uses: peter-evans/create-pull-request@v3
|
||||
|
|
|
@ -86,6 +86,8 @@ else
|
|||
ALL_CHANGED_ARRAY=()
|
||||
ALL_MODIFIED_FILES_ARRAY=()
|
||||
|
||||
echo "Input files: ${INPUT_FILES[*]}"
|
||||
|
||||
for path in ${INPUT_FILES}
|
||||
do
|
||||
echo "Checking for file changes: \"${path}\"..."
|
||||
|
@ -124,20 +126,21 @@ else
|
|||
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")
|
||||
IFS=" " read -r -a UNIQUE_ALL_MODIFIED_FILES <<< "$(echo "${ALL_MODIFIED_FILES_ARRAY[*]}" | tr " " "\n" | sort -u | tr "\n" " ")"
|
||||
IFS=" " read -r -a OTHER_CHANGED_FILES <<< "$(echo "${ALL_OTHER_CHANGED_FILES[@]}" "${UNIQUE_ALL_MODIFIED_FILES[@]}" | tr " " "\n" | sort | uniq -u | tr "\n" " ")"
|
||||
IFS=" " read -r -a UNIQUE_ALL_MODIFIED_FILES_ARRAY <<< "$(echo "${ALL_MODIFIED_FILES_ARRAY[*]}" | tr " " "\n" | sort -u | tr "\n" " ")"
|
||||
IFS=" " read -r -a OTHER_CHANGED_FILES_ARRAY <<< "$(echo "${ALL_OTHER_CHANGED_FILES[@]}" "${UNIQUE_ALL_MODIFIED_FILES[@]}" | tr " " "\n" | sort | uniq -u | tr "\n" " ")"
|
||||
|
||||
echo "Input files: ${INPUT_FILES[*]}"
|
||||
echo "Matching modified files: ${UNIQUE_ALL_MODIFIED_FILES[*]}"
|
||||
OTHER_CHANGED_FILES=$(echo "${OTHER_CHANGED_FILES_ARRAY[*]}" | tr " " "\n" | sort -u | awk -v d="$INPUT_SEPARATOR" '{s=(NR==1?s:s d)$0}END{print s}')
|
||||
|
||||
if [[ -n "${UNIQUE_ALL_MODIFIED_FILES[*]}" ]]; then
|
||||
echo "Matching modified files: ${UNIQUE_ALL_MODIFIED_FILES_ARRAY[*]}"
|
||||
|
||||
if [[ -n "${UNIQUE_ALL_MODIFIED_FILES_ARRAY[*]}" ]]; then
|
||||
echo "::set-output name=any_changed::true"
|
||||
else
|
||||
echo "::set-output name=any_changed::false"
|
||||
fi
|
||||
|
||||
if [[ -n "${OTHER_CHANGED_FILES[*]}" ]]; then
|
||||
echo "Non Matching modified files: ${OTHER_CHANGED_FILES[*]}"
|
||||
if [[ -n "${OTHER_CHANGED_FILES_ARRAY[*]}" ]]; then
|
||||
echo "Non Matching modified files: ${OTHER_CHANGED_FILES_ARRAY[*]}"
|
||||
echo "::set-output name=only_changed::false"
|
||||
echo "::set-output name=other_changed_files::$OTHER_CHANGED_FILES"
|
||||
else
|
||||
|
|
Loading…
Reference in a new issue