mirror of
https://github.com/tj-actions/changed-files
synced 2025-01-30 09:35:15 +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:
|
with:
|
||||||
files: |
|
files: |
|
||||||
README.md
|
README.md
|
||||||
|
|
||||||
- name: README.md changed
|
- name: README.md changed
|
||||||
if: steps.verify_changed_files.outputs.files_changed == 'true'
|
if: steps.verify_changed_files.outputs.files_changed == 'true'
|
||||||
run: |
|
run: |
|
||||||
echo "README.md has uncommited changes"
|
echo "README.md has uncommited changes"
|
||||||
exit 1
|
exit 1
|
||||||
|
|
||||||
- name: Create Pull Request
|
- name: Create Pull Request
|
||||||
if: failure()
|
if: failure()
|
||||||
uses: peter-evans/create-pull-request@v3
|
uses: peter-evans/create-pull-request@v3
|
||||||
|
|
|
@ -86,6 +86,8 @@ else
|
||||||
ALL_CHANGED_ARRAY=()
|
ALL_CHANGED_ARRAY=()
|
||||||
ALL_MODIFIED_FILES_ARRAY=()
|
ALL_MODIFIED_FILES_ARRAY=()
|
||||||
|
|
||||||
|
echo "Input files: ${INPUT_FILES[*]}"
|
||||||
|
|
||||||
for path in ${INPUT_FILES}
|
for path in ${INPUT_FILES}
|
||||||
do
|
do
|
||||||
echo "Checking for file changes: \"${path}\"..."
|
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_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")
|
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 UNIQUE_ALL_MODIFIED_FILES_ARRAY <<< "$(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 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[*]}"
|
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}')
|
||||||
echo "Matching modified files: ${UNIQUE_ALL_MODIFIED_FILES[*]}"
|
|
||||||
|
|
||||||
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"
|
echo "::set-output name=any_changed::true"
|
||||||
else
|
else
|
||||||
echo "::set-output name=any_changed::false"
|
echo "::set-output name=any_changed::false"
|
||||||
fi
|
fi
|
||||||
|
|
||||||
if [[ -n "${OTHER_CHANGED_FILES[*]}" ]]; then
|
if [[ -n "${OTHER_CHANGED_FILES_ARRAY[*]}" ]]; then
|
||||||
echo "Non Matching modified files: ${OTHER_CHANGED_FILES[*]}"
|
echo "Non Matching modified files: ${OTHER_CHANGED_FILES_ARRAY[*]}"
|
||||||
echo "::set-output name=only_changed::false"
|
echo "::set-output name=only_changed::false"
|
||||||
echo "::set-output name=other_changed_files::$OTHER_CHANGED_FILES"
|
echo "::set-output name=other_changed_files::$OTHER_CHANGED_FILES"
|
||||||
else
|
else
|
||||||
|
|
Loading…
Reference in a new issue