3
0
Fork 0
mirror of https://github.com/tj-actions/changed-files synced 2024-12-17 13:47:20 +00:00

Fixed bug with all_changed when array is empty (#46)

This commit is contained in:
Tonye Jack 2021-05-01 16:35:48 -04:00 committed by GitHub
parent b25acb4ce7
commit 0e956bb09e
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -134,14 +134,14 @@ runs:
IFS=" " read -r -a SORTED_INPUT_FILES <<< "$(sort <<<"${ALL_INPUT_FILES[*]}")" IFS=" " read -r -a SORTED_INPUT_FILES <<< "$(sort <<<"${ALL_INPUT_FILES[*]}")"
IFS=" " read -r -a SORTED_OUTPUT_ALL_MODIFIED_FILES <<< "$(sort <<<"${OUTPUT_ALL_MODIFIED_FILES[*]}")" IFS=" " read -r -a SORTED_OUTPUT_ALL_MODIFIED_FILES <<< "$(sort <<<"${OUTPUT_ALL_MODIFIED_FILES[*]}")"
if [[ "${SORTED_INPUT_FILES[*]}" == "${SORTED_OUTPUT_ALL_MODIFIED_FILES[*]}" ]]; then
echo "::set-output name=all_changed::true"
else
echo "::set-output name=all_changed::false"
fi
if [[ ${#SORTED_OUTPUT_ALL_MODIFIED_FILES[@]} -gt 0 ]]; then if [[ ${#SORTED_OUTPUT_ALL_MODIFIED_FILES[@]} -gt 0 ]]; then
echo "::set-output name=any_changed::true" echo "::set-output name=any_changed::true"
if [[ "${SORTED_INPUT_FILES[*]}" == "${SORTED_OUTPUT_ALL_MODIFIED_FILES[*]}" ]]; then
echo "::set-output name=all_changed::true"
else
echo "::set-output name=all_changed::false"
fi
else else
echo "::set-output name=any_changed::false" echo "::set-output name=any_changed::false"
fi fi