Compare commits

...

27 Commits
v4.3 ... v5

Author SHA1 Message Date
Tonye Jack
0e956bb09e Fixed bug with all_changed when array is empty (#46) 2021-05-01 16:35:48 -04:00
Tonye Jack
b25acb4ce7 Upgraded to v5.2 (#45)
Co-authored-by: jackton1 <jackton1@users.noreply.github.com>
2021-05-01 16:32:37 -04:00
Tonye Jack
0312146842 Upgraded to v5.1 (#44)
Co-authored-by: jackton1 <jackton1@users.noreply.github.com>
2021-05-01 16:29:02 -04:00
Tonye Jack
78879f7581 Fixed log message. 2021-05-01 16:28:18 -04:00
Tonye Jack
18496eb7e4 Added better logging. 2021-05-01 16:26:36 -04:00
Tonye Jack
b2c601819d Upgraded to v5 (#43)
Co-authored-by: jackton1 <jackton1@users.noreply.github.com>
2021-05-01 15:54:08 -04:00
Tonye Jack
78b9b2d0f1 Delete entrypoint.sh 2021-05-01 15:50:14 -04:00
Tonye Jack
f863cedeea Update test.yml 2021-05-01 15:49:50 -04:00
Tonye Jack
c92504a11b Update action.yml 2021-05-01 15:49:20 -04:00
Tonye Jack
6007361a95 Update README.md 2021-05-01 15:44:58 -04:00
Tonye Jack
bf8e076d73 Upgraded to v5 (#40)
Co-authored-by: jackton1 <jackton1@users.noreply.github.com>
2021-05-01 15:24:44 -04:00
Tonye Jack
6a4e739596 Switch to using a bash script. (#39) 2021-05-01 15:14:25 -04:00
Tonye Jack
1772038cde Update README.md 2021-05-01 14:39:03 -04:00
Tonye Jack
81657dc060 Upgraded to v4.4 (#38)
Co-authored-by: jackton1 <jackton1@users.noreply.github.com>
2021-05-01 14:13:29 -04:00
Tonye Jack
300e935beb Update .gitignore (#36) 2021-05-01 14:05:18 -04:00
Tonye Jack
d188a8e7a1 Update .gitignore (#34) 2021-05-01 14:03:43 -04:00
Tonye Jack
5653483733 Update action.yml 2021-05-01 14:00:06 -04:00
Tonye Jack
bdd3bf886a Add support for any changed file. (#35) 2021-05-01 13:40:36 -04:00
Tonye Jack
a0301e7e4d Update action.yml 2021-05-01 13:32:09 -04:00
Tonye Jack
23c8cafe35 Update README.md 2021-05-01 13:27:54 -04:00
Tonye Jack
8a7dfe02e7 Renamed has_changed to all_changed (#33) 2021-05-01 13:27:06 -04:00
Tonye Jack
c7eb6e4282 Update README.md 2021-05-01 13:15:09 -04:00
Tonye Jack
40dc6382c6 Update README.md 2021-05-01 13:03:29 -04:00
Tonye Jack
fd5dd8e5ad Merge pull request #32 from tj-actions/upgrade-to-v4.3
Upgraded to v4.3
2021-05-01 12:19:15 -04:00
Tonye Jack
d6f3673f2e Merge branch 'main' into upgrade-to-v4.3 2021-05-01 12:18:52 -04:00
Tonye Jack
9864173ab1 Update README.md 2021-05-01 12:17:17 -04:00
jackton1
2bcefe21d5 Upgraded from v4.2 -> v4.3 2021-05-01 16:13:47 +00:00
3 changed files with 199 additions and 104 deletions

View File

@@ -1,5 +1,69 @@
# Changelog # Changelog
## [Unreleased](https://github.com/tj-actions/changed-files/tree/HEAD)
[Full Changelog](https://github.com/tj-actions/changed-files/compare/v5.2...HEAD)
**Merged pull requests:**
- Upgraded to v5.1 [\#44](https://github.com/tj-actions/changed-files/pull/44) ([jackton1](https://github.com/jackton1))
## [v5.2](https://github.com/tj-actions/changed-files/tree/v5.2) (2021-05-01)
[Full Changelog](https://github.com/tj-actions/changed-files/compare/v5.1...v5.2)
## [v5.1](https://github.com/tj-actions/changed-files/tree/v5.1) (2021-05-01)
[Full Changelog](https://github.com/tj-actions/changed-files/compare/v5...v5.1)
**Merged pull requests:**
- Upgraded to v5 [\#43](https://github.com/tj-actions/changed-files/pull/43) ([jackton1](https://github.com/jackton1))
## [v5](https://github.com/tj-actions/changed-files/tree/v5) (2021-05-01)
[Full Changelog](https://github.com/tj-actions/changed-files/compare/v4.4...v5)
**Merged pull requests:**
- Upgraded to v5 [\#40](https://github.com/tj-actions/changed-files/pull/40) ([jackton1](https://github.com/jackton1))
- Switch to using a bash script. [\#39](https://github.com/tj-actions/changed-files/pull/39) ([jackton1](https://github.com/jackton1))
- Upgraded to v4.4 [\#38](https://github.com/tj-actions/changed-files/pull/38) ([jackton1](https://github.com/jackton1))
## [v4.4](https://github.com/tj-actions/changed-files/tree/v4.4) (2021-05-01)
[Full Changelog](https://github.com/tj-actions/changed-files/compare/v4.3...v4.4)
**Merged pull requests:**
- Update .gitignore [\#36](https://github.com/tj-actions/changed-files/pull/36) ([jackton1](https://github.com/jackton1))
- Add support for any changed file. [\#35](https://github.com/tj-actions/changed-files/pull/35) ([jackton1](https://github.com/jackton1))
- Update .gitignore [\#34](https://github.com/tj-actions/changed-files/pull/34) ([jackton1](https://github.com/jackton1))
- Renamed has\_changed to all\_changed [\#33](https://github.com/tj-actions/changed-files/pull/33) ([jackton1](https://github.com/jackton1))
- Upgraded to v4.3 [\#32](https://github.com/tj-actions/changed-files/pull/32) ([jackton1](https://github.com/jackton1))
## [v4.3](https://github.com/tj-actions/changed-files/tree/v4.3) (2021-05-01)
[Full Changelog](https://github.com/tj-actions/changed-files/compare/v4.2...v4.3)
**Fixed bugs:**
- fatal error when using @v4.2 [\#28](https://github.com/tj-actions/changed-files/issues/28)
**Closed issues:**
- Dependency Dashboard [\#27](https://github.com/tj-actions/changed-files/issues/27)
- Add support for watching a subset of files. [\#20](https://github.com/tj-actions/changed-files/issues/20)
**Merged pull requests:**
- Add support to filter only specific files [\#31](https://github.com/tj-actions/changed-files/pull/31) ([jackton1](https://github.com/jackton1))
- Bump tj-actions/sync-release-version from v8 to v8.5 [\#30](https://github.com/tj-actions/changed-files/pull/30) ([dependabot[bot]](https://github.com/apps/dependabot))
- Upgrade to GitHub-native Dependabot [\#29](https://github.com/tj-actions/changed-files/pull/29) ([dependabot-preview[bot]](https://github.com/apps/dependabot-preview))
- Update tj-actions/github-changelog-generator action to v1.6 [\#26](https://github.com/tj-actions/changed-files/pull/26) ([renovate[bot]](https://github.com/apps/renovate))
- Update README.md [\#25](https://github.com/tj-actions/changed-files/pull/25) ([jackton1](https://github.com/jackton1))
- Upgraded to v4.2 [\#24](https://github.com/tj-actions/changed-files/pull/24) ([jackton1](https://github.com/jackton1))
## [v4.2](https://github.com/tj-actions/changed-files/tree/v4.2) (2021-04-23) ## [v4.2](https://github.com/tj-actions/changed-files/tree/v4.2) (2021-04-23)
[Full Changelog](https://github.com/tj-actions/changed-files/compare/v4.1...v4.2) [Full Changelog](https://github.com/tj-actions/changed-files/compare/v4.1...v4.2)
@@ -67,12 +131,15 @@
- Configure Renovate [\#9](https://github.com/tj-actions/changed-files/pull/9) ([renovate[bot]](https://github.com/apps/renovate)) - Configure Renovate [\#9](https://github.com/tj-actions/changed-files/pull/9) ([renovate[bot]](https://github.com/apps/renovate))
- Update test.yml [\#8](https://github.com/tj-actions/changed-files/pull/8) ([jackton1](https://github.com/jackton1)) - Update test.yml [\#8](https://github.com/tj-actions/changed-files/pull/8) ([jackton1](https://github.com/jackton1))
- Upgraded to v2.1 [\#6](https://github.com/tj-actions/changed-files/pull/6) ([jackton1](https://github.com/jackton1)) - Upgraded to v2.1 [\#6](https://github.com/tj-actions/changed-files/pull/6) ([jackton1](https://github.com/jackton1))
- Upgraded to v2 [\#5](https://github.com/tj-actions/changed-files/pull/5) ([jackton1](https://github.com/jackton1))
## [v2.1](https://github.com/tj-actions/changed-files/tree/v2.1) (2021-03-18) ## [v2.1](https://github.com/tj-actions/changed-files/tree/v2.1) (2021-03-18)
[Full Changelog](https://github.com/tj-actions/changed-files/compare/v2...v2.1) [Full Changelog](https://github.com/tj-actions/changed-files/compare/v2...v2.1)
**Merged pull requests:**
- Upgraded to v2 [\#5](https://github.com/tj-actions/changed-files/pull/5) ([jackton1](https://github.com/jackton1))
## [v2](https://github.com/tj-actions/changed-files/tree/v2) (2021-03-14) ## [v2](https://github.com/tj-actions/changed-files/tree/v2) (2021-03-14)
[Full Changelog](https://github.com/tj-actions/changed-files/compare/v1...v2) [Full Changelog](https://github.com/tj-actions/changed-files/compare/v1...v2)

View File

@@ -3,7 +3,17 @@
changed-files changed-files
------------- -------------
Get all modified files relative to the default branch or preceding commit. Get all modified files relative to the default branch (`pull_request*` events) or last commit (`push` events).
## Features
- List all files that have changed
- Between the current pull request branch and the default branch
- Between the last commit and the current pushed change.
- List only a subset of files that can be used to detect changes.
- Report on a subset of files that have all change.
- Report on a subset of files that have at least one file change.
- Regex pattern matching on a subset of files.
## Outputs ## Outputs
@@ -25,7 +35,7 @@ Using the default separator.
| Output | type | example | description | | Output | type | example | description |
|:-------------------:|:------------:|:------------------------------:|:----------------------------------------:| |:-------------------:|:------------:|:------------------------------:|:----------------------------------------:|
| all_modified_files | `string` | 'new.txt other.png ...' | Select all modified files <br /> *i.e a combination of all added, <br />copied and modified files (ACM).* | | all_modified_files | `string` | 'new.txt other.png ...' | Select all modified files <br /> *i.e a combination of all added, <br />copied and modified files (ACM).* |
| has_changed | `string` | `true OR false` | Returns `true` only when the filenames provided using `files` input have all changed | | all_changed | `string` | `true OR false` | Returns `true` only when the filenames provided using `files` input have all changed |
| all_changed_files | `string` | 'new.txt other.png ...' | Select all paths (*) <br /> *i.e a combination of all options below.* | | all_changed_files | `string` | 'new.txt other.png ...' | Select all paths (*) <br /> *i.e a combination of all options below.* |
| added_files | `string` | 'new.txt other.png ...' | Select only files that are Added (A) | | added_files | `string` | 'new.txt other.png ...' | Select only files that are Added (A) |
| copied_files | `string` | 'new.txt other.png ...' | Select only files that are Copied (C) | | copied_files | `string` | 'new.txt other.png ...' | Select only files that are Copied (C) |
@@ -74,7 +84,7 @@ jobs:
- name: Get changed files - name: Get changed files
id: changed-files id: changed-files
uses: tj-actions/changed-files@v4.2 uses: tj-actions/changed-files@v5.2
- name: List all modified files - name: List all modified files
run: | run: |
@@ -92,30 +102,52 @@ jobs:
- uses: actions/checkout@v2 - uses: actions/checkout@v2
- name: Get changed files using defaults - name: Get changed files using defaults
id: changed-files id: changed-files
uses: tj-actions/changed-files@v4.2 uses: tj-actions/changed-files@v5.2
- name: Get changed files using a comma separator - name: Get changed files using a comma separator
id: changed-files-comma id: changed-files-comma
uses: tj-actions/changed-files@v4.2 uses: tj-actions/changed-files@v5.2
with: with:
separator: "," separator: ","
- name: List all added files - name: List all added files
run: | run: |
for file in "${{ steps.changed-files.outputs.added_files }}"; do for file in "${{ steps.changed-files.outputs.added_files }}"; do
echo "$file was added" echo "$file was added"
done done
- name: Run step when a file changes - name: Run step when a file changes
if: contains(steps.changed-files.outputs.modified_files, 'my-file.txt') if: contains(steps.changed-files.outputs.modified_files, 'my-file.txt')
run: | run: |
echo "Your file my-file.txt has been modified." echo "Your file my-file.txt has been modified."
- name: Run step when a file has been deleted - name: Run step when a file has been deleted
if: contains(steps.changed-files.outputs.deleted_files, 'test.txt') if: contains(steps.changed-files.outputs.deleted_files, 'test.txt')
run: | run: |
echo "Your test.txt has been deleted." echo "Your test.txt has been deleted."
- name: Get specific changed files
id: changed-files-specific
uses: tj-actions/changed-files@v5.2
with:
files: |
my-file.txt
test.txt
new.txt
test_directory
.(py|jpeg)$
.(sql)$
^(mynewfile|custom)
- name: Run step if all files listed above have changed
if: steps.changed-files-specific.outputs.all_changed == 'true'
run: |
echo "Both my-file.txt and test.txt have changed."
- name: Run step if any of the listed files above change
if: steps.changed-files-specific.outputs.any_changed == 'true'
run: |
echo "Either my-file.txt or test.txt have changed."
``` ```
@@ -130,7 +162,7 @@ jobs:
- name: Get changed files - name: Get changed files
id: changed-files id: changed-files
uses: tj-actions/changed-files@v4.2 uses: tj-actions/changed-files@v5.2
- name: Pre-commit - name: Pre-commit
uses: pre-commit/action@v2.0.0 uses: pre-commit/action@v2.0.0
@@ -151,19 +183,6 @@ jobs:
* Free software: [MIT license](LICENSE) * Free software: [MIT license](LICENSE)
Features
--------
- Added Files
- Copied Files
- Deleted Files
- Modified Files
- Renamed Files
- Changed Files
- Unmerged Files
- Unknown Files
- All Changed Files
Credits Credits
------- -------

View File

@@ -42,114 +42,123 @@ outputs:
all_modified_files: all_modified_files:
description: List of all copied modified and added files description: List of all copied modified and added files
value: ${{ steps.changed_files.outputs.all_modified_files }} value: ${{ steps.changed_files.outputs.all_modified_files }}
has_changed: all_changed:
description: Return true only when all files provided using the files input have all changed. description: Return true only when all files provided using the files input have all changed.
value: ${{ steps.changed_files.outputs.has_changed }} value: ${{ steps.changed_files.outputs.all_changed }}
any_changed:
description: Return true only when any files provided using the files input have changed.
value: ${{ steps.changed_files.outputs.any_changed }}
runs: runs:
using: 'composite' using: 'composite'
steps: steps:
- id: changed_files - id: changed_files
run: | run: |
export INPUT_FILES="${{ inputs.files }}"
export INPUT_SEPARATOR="${{ inputs.separator }}"
echo "Getting head sha..." echo "Getting head sha..."
if [[ -z $GITHUB_BASE_REF ]]; then if [[ -z $GITHUB_BASE_REF ]]; then
HEAD_SHA=$(git rev-parse HEAD^1 || true) HEAD_SHA=$(git rev-parse HEAD^1 || true)
else else
TARGET_BRANCH=${GITHUB_BASE_REF} TARGET_BRANCH=${GITHUB_BASE_REF}
git fetch --depth=1 origin ${TARGET_BRANCH}:${TARGET_BRANCH} git fetch --depth=1 origin "${TARGET_BRANCH}":"${TARGET_BRANCH}"
HEAD_SHA=$(git rev-parse ${TARGET_BRANCH} || true) HEAD_SHA=$(git rev-parse "${TARGET_BRANCH}" || true)
fi fi
INPUT_FILES="${{ inputs.files }}" echo "Using head sha: $HEAD_SHA..."
if [[ -z "$INPUT_FILES" ]]; then if [[ -z "$INPUT_FILES" ]]; then
echo "Getting diff..." echo "Getting diff..."
ADDED=$(git diff --diff-filter=A --name-only "$HEAD_SHA" | tr "\n" "$INPUT_SEPARATOR" | sed -E "s/($INPUT_SEPARATOR)$//")
COPIED=$(git diff --diff-filter=C --name-only "$HEAD_SHA" | tr "\n" "$INPUT_SEPARATOR" | sed -E "s/($INPUT_SEPARATOR)$//")
DELETED=$(git diff --diff-filter=D --name-only "$HEAD_SHA" | tr "\n" "$INPUT_SEPARATOR" | sed -E "s/($INPUT_SEPARATOR)$//")
MODIFIED=$(git diff --diff-filter=M --name-only "$HEAD_SHA" | tr "\n" "$INPUT_SEPARATOR" | sed -E "s/($INPUT_SEPARATOR)$//")
RENAMED=$(git diff --diff-filter=R --name-only "$HEAD_SHA" | tr "\n" "$INPUT_SEPARATOR" | sed -E "s/($INPUT_SEPARATOR)$//")
CHANGED=$(git diff --diff-filter=T --name-only "$HEAD_SHA" | tr "\n" "$INPUT_SEPARATOR" | sed -E "s/($INPUT_SEPARATOR)$//")
UNMERGED=$(git diff --diff-filter=U --name-only "$HEAD_SHA" | tr "\n" "$INPUT_SEPARATOR" | sed -E "s/($INPUT_SEPARATOR)$//")
UNKNOWN=$(git diff --diff-filter=X --name-only "$HEAD_SHA" | tr "\n" "$INPUT_SEPARATOR" | sed -E "s/($INPUT_SEPARATOR)$//")
ALL_CHANGED=$(git diff --diff-filter="*ACDMRTUX" --name-only "$HEAD_SHA" | tr "\n" "$INPUT_SEPARATOR" | sed -E "s/($INPUT_SEPARATOR)$//")
ALL_MODIFIED_FILES=$(git diff --diff-filter="ACM" --name-only "$HEAD_SHA" | tr "\n" "$INPUT_SEPARATOR" | sed -E "s/($INPUT_SEPARATOR)$//")
ADDED=$(git diff --diff-filter=A --name-only "$HEAD_SHA" | tr "\n" "${{ inputs.separator }}" | sed -E 's/(${{ inputs.separator }})$//') echo "All changed files: $ALL_CHANGED"
COPIED=$(git diff --diff-filter=C --name-only "$HEAD_SHA" | tr "\n" "${{ inputs.separator }}" | sed -E 's/(${{ inputs.separator }})$//') echo "All modified files: $ALL_MODIFIED_FILES"
DELETED=$(git diff --diff-filter=D --name-only "$HEAD_SHA" | tr "\n" "${{ inputs.separator }}" | sed -E 's/(${{ inputs.separator }})$//')
MODIFIED=$(git diff --diff-filter=M --name-only "$HEAD_SHA" | tr "\n" "${{ inputs.separator }}" | sed -E 's/(${{ inputs.separator }})$//')
RENAMED=$(git diff --diff-filter=R --name-only "$HEAD_SHA" | tr "\n" "${{ inputs.separator }}" | sed -E 's/(${{ inputs.separator }})$//')
CHANGED=$(git diff --diff-filter=T --name-only "$HEAD_SHA" | tr "\n" "${{ inputs.separator }}" | sed -E 's/(${{ inputs.separator }})$//')
UNMERGED=$(git diff --diff-filter=U --name-only "$HEAD_SHA" | tr "\n" "${{ inputs.separator }}" | sed -E 's/(${{ inputs.separator }})$//')
UNKNOWN=$(git diff --diff-filter=X --name-only "$HEAD_SHA" | tr "\n" "${{ inputs.separator }}" | sed -E 's/(${{ inputs.separator }})$//')
ALL_CHANGED=$(git diff --diff-filter='*ACDMRTUX' --name-only "$HEAD_SHA" | tr "\n" "${{ inputs.separator }}" | sed -E 's/(${{ inputs.separator }})$//')
ALL_MODIFIED_FILES=$(git diff --diff-filter='ACM' --name-only "$HEAD_SHA" | tr "\n" "${{ inputs.separator }}" | sed -E 's/(${{ inputs.separator }})$//')
echo "::set-output name=added_files::$ADDED"
echo "::set-output name=copied_files::$COPIED"
echo "::set-output name=deleted_files::$DELETED"
echo "::set-output name=modified_files::$MODIFIED"
echo "::set-output name=renamed_files::$RENAMED"
echo "::set-output name=changed_files::$CHANGED"
echo "::set-output name=unmerged_files::$UNMERGED"
echo "::set-output name=unknown_files::$UNKNOWN"
echo "::set-output name=all_changed_files::$ALL_CHANGED"
echo "::set-output name=all_modified_files::$ALL_MODIFIED_FILES"
else else
ADDED=() ADDED_ARRAY=()
COPIED=() COPIED_ARRAY=()
DELETED=() DELETED_ARRAY=()
MODIFIED=() MODIFIED_ARRAY=()
RENAMED=() RENAMED_ARRAY=()
CHANGED=() CHANGED_ARRAY=()
UNMERGED=() UNMERGED_ARRAY=()
UNKNOWN=() UNKNOWN_ARRAY=()
ALL_CHANGED=() ALL_CHANGED_ARRAY=()
ALL_MODIFIED_FILES=() ALL_MODIFIED_FILES_ARRAY=()
for path in ${INPUT_FILES} for path in ${INPUT_FILES}
do do
echo "Checking for file changes: \"${path}\"..." echo "Checking for file changes: \"${path}\"..."
ADDED+=$(git diff --diff-filter=A --name-only "$HEAD_SHA" | grep -E "(${path})" | xargs printf "%s${{ inputs.separator }}" || true) IFS=" " read -r -a ADDED_ARRAY <<< "$(git diff --diff-filter=A --name-only "$HEAD_SHA" | grep -E "(${path})" | xargs printf "%s$INPUT_SEPARATOR" || true)"
COPIED+=$(git diff --diff-filter=C --name-only "$HEAD_SHA" | grep -E "(${path})" | xargs printf "%s${{ inputs.separator }}" || true) IFS=" " read -r -a COPIED_ARRAY <<< "$(git diff --diff-filter=C --name-only "$HEAD_SHA" | grep -E "(${path})" | xargs printf "%s$INPUT_SEPARATOR" || true)"
DELETED+=$(git diff --diff-filter=D --name-only "$HEAD_SHA" | grep -E "(${path})" | xargs printf "%s${{ inputs.separator }}" || true) IFS=" " read -r -a DELETED_ARRAY <<< "$(git diff --diff-filter=D --name-only "$HEAD_SHA" | grep -E "(${path})" | xargs printf "%s$INPUT_SEPARATOR" || true)"
MODIFIED+=$(git diff --diff-filter=M --name-only "$HEAD_SHA" | grep -E "(${path})" | xargs printf "%s${{ inputs.separator }}" || true) IFS=" " read -r -a MODIFIED_ARRAY <<< "$(git diff --diff-filter=M --name-only "$HEAD_SHA" | grep -E "(${path})" | xargs printf "%s$INPUT_SEPARATOR" || true)"
RENAMED+=$(git diff --diff-filter=R --name-only "$HEAD_SHA" | grep -E "(${path})" | xargs printf "%s${{ inputs.separator }}" || true) IFS=" " read -r -a RENAMED_ARRAY <<< "$(git diff --diff-filter=R --name-only "$HEAD_SHA" | grep -E "(${path})" | xargs printf "%s$INPUT_SEPARATOR" || true)"
CHANGED+=$(git diff --diff-filter=T --name-only "$HEAD_SHA" | grep -E "(${path})" | xargs printf "%s${{ inputs.separator }}" || true) IFS=" " read -r -a CHANGED_ARRAY <<< "$(git diff --diff-filter=T --name-only "$HEAD_SHA" | grep -E "(${path})" | xargs printf "%s$INPUT_SEPARATOR" || true)"
UNMERGED+=$(git diff --diff-filter=U --name-only "$HEAD_SHA" | grep -E "(${path})" | xargs printf "%s${{ inputs.separator }}" || true) IFS=" " read -r -a UNMERGED_ARRAY <<< "$(git diff --diff-filter=U --name-only "$HEAD_SHA" | grep -E "(${path})" | xargs printf "%s$INPUT_SEPARATOR" || true)"
UNKNOWN+=$(git diff --diff-filter=X --name-only "$HEAD_SHA" | grep -E "(${path})" | xargs printf "%s${{ inputs.separator }}" || true) IFS=" " read -r -a UNKNOWN_ARRAY <<< "$(git diff --diff-filter=X --name-only "$HEAD_SHA" | grep -E "(${path})" | xargs printf "%s$INPUT_SEPARATOR" || true)"
ALL_CHANGED+=$(git diff --diff-filter='*ACDMRTUX' --name-only "$HEAD_SHA" | grep -E "(${path})" | xargs printf "%s${{ inputs.separator }}" || true) IFS=" " read -r -a ALL_CHANGED_ARRAY <<< "$(git diff --diff-filter="*ACDMRTUX" --name-only "$HEAD_SHA" | grep -E "(${path})" | xargs printf "%s$INPUT_SEPARATOR" || true)"
ALL_MODIFIED_FILES+=$(git diff --diff-filter='ACM' --name-only "$HEAD_SHA" | grep -E "(${path})" | xargs printf "%s${{ inputs.separator }}" || true) IFS=" " read -r -a ALL_MODIFIED_FILES_ARRAY <<< "$(git diff --diff-filter="ACM" --name-only "$HEAD_SHA" | grep -E "(${path})" | xargs printf "%s$INPUT_SEPARATOR" || true)"
done done
ADDED=$(echo "$ADDED" | sed -E 's/(${{ inputs.separator }})$//') ADDED=$(echo "${ADDED_ARRAY[@]}" | sed -E "s/($INPUT_SEPARATOR)$//")
COPIED=$(echo $COPIED | sed -E 's/(${{ inputs.separator }})$//') COPIED=$(echo "${COPIED_ARRAY[@]}" | sed -E "s/($INPUT_SEPARATOR)$//")
DELETED=$(echo "$DELETED" | sed -E 's/(${{ inputs.separator }})$//') DELETED=$(echo "${DELETED_ARRAY[@]}" | sed -E "s/($INPUT_SEPARATOR)$//")
MODIFIED=$(echo "$MODIFIED" | sed -E 's/(${{ inputs.separator }})$//') MODIFIED=$(echo "${MODIFIED_ARRAY[@]}" | sed -E "s/($INPUT_SEPARATOR)$//")
RENAMED=$(echo "$RENAMED" | sed -E 's/(${{ inputs.separator }})$//') RENAMED=$(echo "${RENAMED_ARRAY[@]}" | sed -E "s/($INPUT_SEPARATOR)$//")
CHANGED=$(echo "$CHANGED" | sed -E 's/(${{ inputs.separator }})$//') CHANGED=$(echo "${CHANGED_ARRAY[@]}" | sed -E "s/($INPUT_SEPARATOR)$//")
UNMERGED=$(echo "$UNMERGED" | sed -E 's/(${{ inputs.separator }})$//') UNMERGED=$(echo "${UNMERGED_ARRAY[@]}" | sed -E "s/($INPUT_SEPARATOR)$//")
UNKNOWN=$(echo "$UNKNOWN" | sed -E 's/(${{ inputs.separator }})$//') UNKNOWN=$(echo "${UNKNOWN_ARRAY[@]}" | sed -E "s/($INPUT_SEPARATOR)$//")
ALL_CHANGED=$(echo "$ALL_CHANGED" | sed -E 's/(${{ inputs.separator }})$//') ALL_CHANGED=$(echo "${ALL_CHANGED_ARRAY[@]}" | sed -E "s/($INPUT_SEPARATOR)$//")
ALL_MODIFIED_FILES=$(echo "$ALL_MODIFIED_FILES" | sed -E 's/(${{ inputs.separator }})$//') ALL_MODIFIED_FILES=$(echo "${ALL_MODIFIED_FILES_ARRAY[@]}" | sed -E "s/($INPUT_SEPARATOR)$//")
OUTPUT_ALL_MODIFIED_FILES=$(echo $ALL_MODIFIED_FILES | sed "s/${{ inputs.separator }}/ /g")
ALL_INPUT_FILES=$(echo $INPUT_FILES | sed "s/\n/ /g")
IFS=$'\n' SORTED_INPUT_FILES=($(sort <<<"${ALL_INPUT_FILES[*]}")) echo "All changed files: $ALL_CHANGED"
IFS=$'\n' SORTED_OUTPUT_ALL_MODIFIED_FILES=($(sort <<<"${OUTPUT_ALL_MODIFIED_FILES[*]}")) echo "All modified files: $ALL_MODIFIED_FILES"
if [[ "${SORTED_INPUT_FILES[*]}" == "${SORTED_OUTPUT_ALL_MODIFIED_FILES[*]}" ]]; then # shellcheck disable=SC2001
echo "::set-output name=has_changed::true" OUTPUT_ALL_MODIFIED_FILES=$(echo "$ALL_MODIFIED_FILES" | sed "s/$INPUT_SEPARATOR/ /g")
ALL_INPUT_FILES=${INPUT_FILES//\n/ }
SORTED_INPUT_FILES=()
SORTED_OUTPUT_ALL_MODIFIED_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[*]}")"
if [[ ${#SORTED_OUTPUT_ALL_MODIFIED_FILES[@]} -gt 0 ]]; then
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=has_changed::false" echo "::set-output name=any_changed::false"
fi fi
echo "::set-output name=added_files::$ADDED"
echo "::set-output name=copied_files::$COPIED"
echo "::set-output name=deleted_files::$DELETED"
echo "::set-output name=modified_files::$MODIFIED"
echo "::set-output name=renamed_files::$RENAMED"
echo "::set-output name=changed_files::$CHANGED"
echo "::set-output name=unmerged_files::$UNMERGED"
echo "::set-output name=unknown_files::$UNKNOWN"
echo "::set-output name=all_changed_files::$ALL_CHANGED"
echo "::set-output name=all_modified_files::$ALL_MODIFIED_FILES"
fi fi
echo "::set-output name=added_files::$ADDED"
echo "::set-output name=copied_files::$COPIED"
echo "::set-output name=deleted_files::$DELETED"
echo "::set-output name=modified_files::$MODIFIED"
echo "::set-output name=renamed_files::$RENAMED"
echo "::set-output name=changed_files::$CHANGED"
echo "::set-output name=unmerged_files::$UNMERGED"
echo "::set-output name=unknown_files::$UNKNOWN"
echo "::set-output name=all_changed_files::$ALL_CHANGED"
echo "::set-output name=all_modified_files::$ALL_MODIFIED_FILES"
unset INPUT_FILES
unset INPUT_SEPARATOR
shell: bash shell: bash
branding: branding: