From 20765a994f8928f0d25f1ea4694618062cc594aa Mon Sep 17 00:00:00 2001 From: Tonye Jack Date: Tue, 14 Dec 2021 00:21:49 -0500 Subject: [PATCH] Renamed all_modified_files to all_changed_files (#283) --- .github/workflows/test.yml | 20 ++++++++++---------- HISTORY.md | 8 ++++---- README.md | 10 +++++----- action.yml | 4 ++-- entrypoint.sh | 26 +++++++++++++------------- 5 files changed, 34 insertions(+), 34 deletions(-) diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index 748cd2b0..ad6777b4 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -228,7 +228,7 @@ jobs: shell: bash - name: Verify any_changed for specific files - if: "!contains(steps.changed-files-specific.outputs.all_modified_files, 'action.yml') && !contains(steps.changed-files-specific.outputs.all_modified_files, '.github/workflows/test.yml')" + if: "!contains(steps.changed-files-specific.outputs.all_changed_files, 'action.yml') && !contains(steps.changed-files-specific.outputs.all_changed_files, '.github/workflows/test.yml')" run: | if [[ "${{ steps.changed-files-specific.outputs.any_changed }}" != "false" ]]; then echo "Invalid output: Expected (false) got (${{ steps.changed-files-specific.outputs.any_changed }})" @@ -253,9 +253,9 @@ jobs: entrypoint.sh *.sh - name: Verify all_changed_and_modified_files files has no duplicates - if: contains(steps.changed-files-specific-duplicate-output.outputs.all_modified_files, 'entrypoint.sh') + if: contains(steps.changed-files-specific-duplicate-output.outputs.all_changed_files, 'entrypoint.sh') run: | - ALL_CHANGED_AND_MODIFIED_FILES=(${{ steps.changed-files-specific-duplicate-output.outputs.all_modified_files }}) + ALL_CHANGED_AND_MODIFIED_FILES=(${{ steps.changed-files-specific-duplicate-output.outputs.all_changed_files }}) UNIQUE_ALL_CHANGED_AND_MODIFIED_FILES=$(echo "$ALL_CHANGED_AND_MODIFIED_FILES" | tr ' ' '\n' | sort -u | xargs) if [[ "$ALL_CHANGED_AND_MODIFIED_FILES[@]" != "$UNIQUE_ALL_CHANGED_AND_MODIFIED_FILES[@]" ]]; then @@ -278,7 +278,7 @@ jobs: shell: bash - name: Verify any_changed files comma separator - if: "!contains(steps.changed-files-specific-comma.outputs.all_modified_files, 'action.yml') && !contains(steps.changed-files-specific-comma.outputs.all_modified_files, '.github/workflows/test.yml')" + if: "!contains(steps.changed-files-specific-comma.outputs.all_changed_files, 'action.yml') && !contains(steps.changed-files-specific-comma.outputs.all_changed_files, '.github/workflows/test.yml')" run: | if [[ "${{ steps.changed-files-specific-comma.outputs.any_changed }}" != "false" ]]; then echo "Invalid output: Expected (false) got (${{ steps.changed-files-specific-comma.outputs.any_changed }})" @@ -309,7 +309,7 @@ jobs: shell: bash - name: Verify any_changed files comma separator - if: "!contains(steps.changed-files-specific-pipe.outputs.all_modified_files, 'action.yml') && !contains(steps.changed-files-specific-pipe.outputs.all_modified_files, '.github/workflows/test.yml')" + if: "!contains(steps.changed-files-specific-pipe.outputs.all_changed_files, 'action.yml') && !contains(steps.changed-files-specific-pipe.outputs.all_changed_files, '.github/workflows/test.yml')" run: | if [[ "${{ steps.changed-files-specific-pipe.outputs.any_changed }}" != "false" ]]; then echo "Invalid output: Expected (false) got (${{ steps.changed-files-specific-pipe.outputs.any_changed }})" @@ -340,7 +340,7 @@ jobs: shell: bash - name: Verify any_changed files comma separator - if: "!contains(steps.changed-files-specific-forward-slash.outputs.all_modified_files, 'action.yml') && !contains(steps.changed-files-specific-forward-slash.outputs.all_modified_files, '.github/workflows/test.yml')" + if: "!contains(steps.changed-files-specific-forward-slash.outputs.all_changed_files, 'action.yml') && !contains(steps.changed-files-specific-forward-slash.outputs.all_changed_files, '.github/workflows/test.yml')" run: | if [[ "${{ steps.changed-files-specific.outputs.any_changed }}" != "false" ]]; then echo "Invalid output: Expected (false) got (${{ steps.changed-files-specific-forward-slash.outputs.any_changed }})" @@ -369,9 +369,9 @@ jobs: - name: Verify any_changed from source files if: | ( - !contains(steps.changed-files-specific-source-file.outputs.all_modified_files, 'action.yml') && - !contains(steps.changed-files-specific-source-file.outputs.all_modified_files, '.github/workflows/test.yml') && - !contains(steps.changed-files-specific-source-file.outputs.all_modified_files, '.github/workflows/rebase.yml') + !contains(steps.changed-files-specific-source-file.outputs.all_changed_files, 'action.yml') && + !contains(steps.changed-files-specific-source-file.outputs.all_changed_files, '.github/workflows/test.yml') && + !contains(steps.changed-files-specific-source-file.outputs.all_changed_files, '.github/workflows/rebase.yml') ) run: | if [[ "${{ steps.changed-files-specific-source-file.outputs.any_changed }}" != "false" ]]; then @@ -407,7 +407,7 @@ jobs: shell: bash - name: Verify any_changed files comma separator - if: "!contains(steps.changed-files-specific-comma-source-file.outputs.all_modified_files, 'action.yml') && !contains(steps.changed-files-specific-comma-source-file.outputs.all_modified_files, '.github/workflows/test.yml')" + if: "!contains(steps.changed-files-specific-comma-source-file.outputs.all_changed_files, 'action.yml') && !contains(steps.changed-files-specific-comma-source-file.outputs.all_changed_files, '.github/workflows/test.yml')" run: | if [[ "${{ steps.changed-files-specific-comma-source-file.outputs.any_changed }}" != "false" ]]; then echo "Invalid output: Expected (false) got (${{ steps.changed-files-specific-comma-source-file.outputs.any_changed }})" diff --git a/HISTORY.md b/HISTORY.md index 044a10c3..581b5ca4 100644 --- a/HISTORY.md +++ b/HISTORY.md @@ -103,7 +103,7 @@ **Merged pull requests:** -- Updated formatting of all modified debug message [\#247](https://github.com/tj-actions/changed-files/pull/247) ([jackton1](https://github.com/jackton1)) +- Updated formatting of all changed debug message [\#247](https://github.com/tj-actions/changed-files/pull/247) ([jackton1](https://github.com/jackton1)) - Update reviewdog/action-shellcheck action to v1.10 [\#246](https://github.com/tj-actions/changed-files/pull/246) ([renovate[bot]](https://github.com/apps/renovate)) - Update peter-evans/create-pull-request action to v3.11.0 [\#245](https://github.com/tj-actions/changed-files/pull/245) ([renovate[bot]](https://github.com/apps/renovate)) - Update actions/checkout action to v2.4.0 [\#243](https://github.com/tj-actions/changed-files/pull/243) ([renovate[bot]](https://github.com/apps/renovate)) @@ -350,12 +350,12 @@ **Fixed bugs:** -- \[BUG\] `all_modified_files` show deleted files [\#155](https://github.com/tj-actions/changed-files/issues/155) +- \[BUG\] `all_changed_files` show deleted files [\#155](https://github.com/tj-actions/changed-files/issues/155) - \[BUG\] Dedupe the output list of changed files [\#151](https://github.com/tj-actions/changed-files/issues/151) **Merged pull requests:** -- Remove deleted files from the all\_modified\_files output [\#156](https://github.com/tj-actions/changed-files/pull/156) ([jackton1](https://github.com/jackton1)) +- Remove deleted files from the all\_changed\_files output [\#156](https://github.com/tj-actions/changed-files/pull/156) ([jackton1](https://github.com/jackton1)) - Upgraded to v9.2 [\#154](https://github.com/tj-actions/changed-files/pull/154) ([jackton1](https://github.com/jackton1)) ## [v9.2](https://github.com/tj-actions/changed-files/tree/v9.2) (2021-08-06) @@ -734,7 +734,7 @@ **Merged pull requests:** -- Add support for all modified files [\#16](https://github.com/tj-actions/changed-files/pull/16) ([jackton1](https://github.com/jackton1)) +- Add support for all changed files [\#16](https://github.com/tj-actions/changed-files/pull/16) ([jackton1](https://github.com/jackton1)) - Update test.yml [\#14](https://github.com/tj-actions/changed-files/pull/14) ([jackton1](https://github.com/jackton1)) - Upgraded to v3.1 [\#13](https://github.com/tj-actions/changed-files/pull/13) ([jackton1](https://github.com/jackton1)) diff --git a/README.md b/README.md index 03d4a416..2350e717 100644 --- a/README.md +++ b/README.md @@ -19,7 +19,7 @@ Retrieve all changed files relative to the default branch (`pull_request*` based * Fast execution (0-2 seconds on average). * Easy to debug. -* Boolean output indicating that certain files have been modified. +* Boolean output indicating that certain files have been changed. * Multiple repositories. * Self hosted runners. * GitHub Enterprise Server. @@ -65,10 +65,10 @@ jobs: id: changed-files uses: tj-actions/changed-files@v11.9 - - name: List all modified files + - name: List all changed files run: | - for file in ${{ steps.changed-files.outputs.all_modified_files }}; do - echo "$file was modified" + for file in ${{ steps.changed-files.outputs.all_changed_files }}; do + echo "$file was changed" done ``` @@ -268,7 +268,7 @@ Support this project with a :star: - name: Pre-commit uses: pre-commit/action@v2.0.0 with: - extra_args: -v --hook-stage push --files ${{ steps.changed-files.outputs.all_modified_files }} + extra_args: -v --hook-stage push --files ${{ steps.changed-files.outputs.all_changed_files }} token: ${{ secrets.github_token }} ``` diff --git a/action.yml b/action.yml index 792b784b..95be0773 100644 --- a/action.yml +++ b/action.yml @@ -62,9 +62,9 @@ outputs: all_changed_and_modified_files: description: List of all changed files. value: ${{ steps.changed-files.outputs.all_changed_and_modified_files }} - all_modified_files: + all_changed_files: description: List of all copied modified and added files. - value: ${{ steps.changed-files.outputs.all_modified_files }} + value: ${{ steps.changed-files.outputs.all_changed_files }} any_changed: description: Return true only when any files provided using the files input have changed. value: ${{ steps.changed-files.outputs.any_changed }} diff --git a/entrypoint.sh b/entrypoint.sh index e82ba7bd..ac1f5b2c 100755 --- a/entrypoint.sh +++ b/entrypoint.sh @@ -103,7 +103,7 @@ if [[ -z "${INPUT_FILES[*]}" ]]; then UNMERGED=$(git diff --diff-filter=U --name-only "$PREVIOUS_SHA" "$CURRENT_SHA" | awk -v d="$INPUT_SEPARATOR" '{s=(NR==1?s:s d)$0}END{print s}') UNKNOWN=$(git diff --diff-filter=X --name-only "$PREVIOUS_SHA" "$CURRENT_SHA" | awk -v d="$INPUT_SEPARATOR" '{s=(NR==1?s:s d)$0}END{print s}') ALL_CHANGED_AND_MODIFIED=$(git diff --diff-filter="*ACDMRTUX" --name-only "$PREVIOUS_SHA" "$CURRENT_SHA" | awk -v d="$INPUT_SEPARATOR" '{s=(NR==1?s:s d)$0}END{print s}') - ALL_MODIFIED=$(git diff --diff-filter="ACMR" --name-only "$PREVIOUS_SHA" "$CURRENT_SHA" | awk -v d="$INPUT_SEPARATOR" '{s=(NR==1?s:s d)$0}END{print s}') + ALL_CHANGED=$(git diff --diff-filter="ACMR" --name-only "$PREVIOUS_SHA" "$CURRENT_SHA" | awk -v d="$INPUT_SEPARATOR" '{s=(NR==1?s:s d)$0}END{print s}') else echo "Input files: ${INPUT_FILES[*]}" @@ -119,23 +119,23 @@ else UNMERGED=$(git diff --diff-filter=U --name-only "$PREVIOUS_SHA" "$CURRENT_SHA" | grep -E "(${FILES})" | awk -v d="|" '{s=(NR==1?s:s d)$0}END{print s}') UNKNOWN=$(git diff --diff-filter=X --name-only "$PREVIOUS_SHA" "$CURRENT_SHA" | grep -E "(${FILES})" | awk -v d="|" '{s=(NR==1?s:s d)$0}END{print s}') ALL_CHANGED_AND_MODIFIED=$(git diff --diff-filter="*ACDMRTUX" --name-only "$PREVIOUS_SHA" "$CURRENT_SHA" | grep -E "(${FILES})" | awk -v d="|" '{s=(NR==1?s:s d)$0}END{print s}') - ALL_MODIFIED=$(git diff --diff-filter="ACMR" --name-only "$PREVIOUS_SHA" "$CURRENT_SHA" | grep -E "(${FILES})" | awk -v d="|" '{s=(NR==1?s:s d)$0}END{print s}') + ALL_CHANGED=$(git diff --diff-filter="ACMR" --name-only "$PREVIOUS_SHA" "$CURRENT_SHA" | grep -E "(${FILES})" | awk -v d="|" '{s=(NR==1?s:s d)$0}END{print s}') ALL_OTHER_MODIFIED=$(git diff --diff-filter="ACMR" --name-only "$PREVIOUS_SHA" "$CURRENT_SHA" | awk -v d="|" '{s=(NR==1?s:s d)$0}END{print s}') - UNIQUE_ALL_MODIFIED=$(echo "${ALL_MODIFIED}" | awk '{gsub(/\|/,"\n"); print $0;}' | sort -u | awk -v d="|" '{s=(NR==1?s:s d)$0}END{print s}') + UNIQUE_ALL_CHANGED=$(echo "${ALL_CHANGED}" | awk '{gsub(/\|/,"\n"); print $0;}' | sort -u | awk -v d="|" '{s=(NR==1?s:s d)$0}END{print s}') if [[ -n $ALL_OTHER_MODIFIED ]]; then - if [[ -n "$UNIQUE_ALL_MODIFIED" ]]; then - OTHER_MODIFIED=$(echo "${ALL_OTHER_MODIFIED}|${UNIQUE_ALL_MODIFIED}" | awk '{gsub(/\|/,"\n"); print $0;}' | sort | uniq -u | awk -v d="|" '{s=(NR==1?s:s d)$0}END{print s}') + if [[ -n "$UNIQUE_ALL_CHANGED" ]]; then + OTHER_MODIFIED=$(echo "${ALL_OTHER_MODIFIED}|${UNIQUE_ALL_CHANGED}" | awk '{gsub(/\|/,"\n"); print $0;}' | sort | uniq -u | awk -v d="|" '{s=(NR==1?s:s d)$0}END{print s}') else OTHER_MODIFIED=$ALL_OTHER_MODIFIED fi fi - UNIQUE_ALL_MODIFIED=$(echo "${UNIQUE_ALL_MODIFIED}" | awk '{gsub(/\|/,"\n"); print $0;}' | awk -v d="$INPUT_SEPARATOR" '{s=(NR==1?s:s d)$0}END{print s}') + UNIQUE_ALL_CHANGED=$(echo "${UNIQUE_ALL_CHANGED}" | awk '{gsub(/\|/,"\n"); print $0;}' | awk -v d="$INPUT_SEPARATOR" '{s=(NR==1?s:s d)$0}END{print s}') - if [[ -n "${UNIQUE_ALL_MODIFIED}" ]]; then - echo "Matching modified files: ${UNIQUE_ALL_MODIFIED}" + if [[ -n "${UNIQUE_ALL_CHANGED}" ]]; then + echo "Matching modified files: ${UNIQUE_ALL_CHANGED}" echo "::set-output name=any_changed::true" else echo "::set-output name=any_changed::false" @@ -147,7 +147,7 @@ else echo "Non Matching modified files: ${OTHER_MODIFIED}" echo "::set-output name=only_changed::false" echo "::set-output name=other_changed_files::$OTHER_MODIFIED" - elif [[ -n "${UNIQUE_ALL_MODIFIED}" ]]; then + elif [[ -n "${UNIQUE_ALL_CHANGED}" ]]; then echo "::set-output name=only_changed::true" fi @@ -189,7 +189,7 @@ else UNMERGED=$(echo "${UNMERGED}" | awk '{gsub(/\|/,"\n"); print $0;}' | awk -v d="$INPUT_SEPARATOR" '{s=(NR==1?s:s d)$0}END{print s}') UNKNOWN=$(echo "${UNKNOWN}" | awk '{gsub(/\|/,"\n"); print $0;}' | awk -v d="$INPUT_SEPARATOR" '{s=(NR==1?s:s d)$0}END{print s}') ALL_CHANGED_AND_MODIFIED=$(echo "${ALL_CHANGED_AND_MODIFIED}" | awk '{gsub(/\|/,"\n"); print $0;}' | awk -v d="$INPUT_SEPARATOR" '{s=(NR==1?s:s d)$0}END{print s}') - ALL_MODIFIED=$(echo "${ALL_MODIFIED}" | awk '{gsub(/\|/,"\n"); print $0;}' | awk -v d="$INPUT_SEPARATOR" '{s=(NR==1?s:s d)$0}END{print s}') + ALL_CHANGED=$(echo "${ALL_CHANGED}" | awk '{gsub(/\|/,"\n"); print $0;}' | awk -v d="$INPUT_SEPARATOR" '{s=(NR==1?s:s d)$0}END{print s}') fi echo "Added files: $ADDED" @@ -200,8 +200,8 @@ echo "Renamed files: $RENAMED" echo "Type Changed files: $TYPE_CHANGED" echo "Unmerged files: $UNMERGED" echo "Unknown files: $UNKNOWN" -echo "All changed files: $ALL_CHANGED_AND_MODIFIED" -echo "All modified files: $ALL_MODIFIED" +echo "All changed and modified files: $ALL_CHANGED_AND_MODIFIED" +echo "All changed files: $ALL_CHANGED" git remote remove temp_changed_files @@ -214,6 +214,6 @@ echo "::set-output name=type_changed_files::$TYPE_CHANGED" echo "::set-output name=unmerged_files::$UNMERGED" echo "::set-output name=unknown_files::$UNKNOWN" echo "::set-output name=all_changed_and_modified_files::$ALL_CHANGED_AND_MODIFIED" -echo "::set-output name=all_modified_files::$ALL_MODIFIED" +echo "::set-output name=all_changed_files::$ALL_CHANGED" echo "::endgroup::"