Compare commits
33 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
8e7cc77ab9 | ||
|
|
5a6b6bb1c3 | ||
|
|
1f37ab54c8 | ||
|
|
6757c5e650 | ||
|
|
be5c441f0d | ||
|
|
343bc3cc2f | ||
|
|
1a59b03b8b | ||
|
|
1ac83f052b | ||
|
|
3b5a8e6656 | ||
|
|
223c35895d | ||
|
|
13c082a4b3 | ||
|
|
966bf442ea | ||
|
|
32f883f2c8 | ||
|
|
61622b6c0a | ||
|
|
4ed079e554 | ||
|
|
d18cfbea8d | ||
|
|
81ad4b8744 | ||
|
|
cfcb385d2b | ||
|
|
5e2a2f1923 | ||
|
|
81037a4f7b | ||
|
|
3eeb3186dd | ||
|
|
6f8181a0ea | ||
|
|
368be5bbf0 | ||
|
|
9cc7563ef7 | ||
|
|
847613ee23 | ||
|
|
1af9ab3830 | ||
|
|
4c0811d6d3 | ||
|
|
bfe33aff05 | ||
|
|
55a857d66a | ||
|
|
684c3a8487 | ||
|
|
9d6b2c32e8 | ||
|
|
e6c1b2487a | ||
|
|
506cc732d4 |
2
.github/workflows/auto-merge.yml
vendored
2
.github/workflows/auto-merge.yml
vendored
@@ -17,7 +17,7 @@ jobs:
|
||||
github.actor == 'renovate'
|
||||
steps:
|
||||
- name: automerge
|
||||
uses: pascalgn/automerge-action@v0.14.2
|
||||
uses: pascalgn/automerge-action@v0.14.3
|
||||
env:
|
||||
GITHUB_TOKEN: ${{ secrets.PAT_TOKEN || github.token }}
|
||||
MERGE_METHOD: "rebase"
|
||||
|
||||
202
.github/workflows/test.yml
vendored
202
.github/workflows/test.yml
vendored
@@ -18,7 +18,7 @@ jobs:
|
||||
- name: Checkout to branch
|
||||
uses: actions/checkout@v2
|
||||
- name: shellcheck
|
||||
uses: reviewdog/action-shellcheck@v1.7
|
||||
uses: reviewdog/action-shellcheck@v1.9
|
||||
|
||||
test-multiple-repositories:
|
||||
name: Test with multiple repositories
|
||||
@@ -26,7 +26,7 @@ jobs:
|
||||
strategy:
|
||||
fail-fast: false
|
||||
matrix:
|
||||
platform: [ubuntu-latest, windows-latest, macos-latest]
|
||||
platform: [ubuntu-latest, windows-latest, macos-latest, macos-11, ubuntu-18.04, windows-2022, windows-2016]
|
||||
steps:
|
||||
- name: Checkout into dir1
|
||||
uses: actions/checkout@v2
|
||||
@@ -40,13 +40,13 @@ jobs:
|
||||
path: dir1
|
||||
- name: Show output
|
||||
run: |
|
||||
echo "${{ toJSON(steps.changed-files-dir1.outputs) }}"
|
||||
echo '${{ toJSON(steps.changed-files-dir1.outputs) }}'
|
||||
shell:
|
||||
bash
|
||||
- name: List all modified files
|
||||
run: |
|
||||
for file in "${{ steps.changed-files-dir1.outputs.modified_files }}"; do
|
||||
echo $file
|
||||
echo "$file"
|
||||
done
|
||||
shell:
|
||||
bash
|
||||
@@ -62,13 +62,13 @@ jobs:
|
||||
path: dir2
|
||||
- name: Show output
|
||||
run: |
|
||||
echo "${{ toJSON(steps.changed-files-dir2.outputs) }}"
|
||||
echo '${{ toJSON(steps.changed-files-dir2.outputs) }}'
|
||||
shell:
|
||||
bash
|
||||
- name: List all modified files
|
||||
run: |
|
||||
for file in "${{ steps.changed-files-dir2.outputs.modified_files }}"; do
|
||||
echo $file
|
||||
echo "$file"
|
||||
done
|
||||
shell:
|
||||
bash
|
||||
@@ -79,7 +79,7 @@ jobs:
|
||||
strategy:
|
||||
fail-fast: false
|
||||
matrix:
|
||||
platform: [ubuntu-latest, windows-latest, macos-latest]
|
||||
platform: [ubuntu-latest, windows-latest, macos-latest, macos-11, ubuntu-18.04, windows-2022, windows-2016]
|
||||
|
||||
steps:
|
||||
- name: Checkout to branch
|
||||
@@ -102,7 +102,7 @@ jobs:
|
||||
strategy:
|
||||
fail-fast: false
|
||||
matrix:
|
||||
platform: [ubuntu-latest, windows-latest, macos-latest]
|
||||
platform: [ubuntu-latest, windows-latest, macos-latest, macos-11, ubuntu-18.04, windows-2022, windows-2016]
|
||||
|
||||
steps:
|
||||
- name: Checkout
|
||||
@@ -114,7 +114,7 @@ jobs:
|
||||
uses: ./
|
||||
- name: Show output
|
||||
run: |
|
||||
echo "${{ toJSON(steps.changed-files.outputs) }}"
|
||||
echo '${{ toJSON(steps.changed-files.outputs) }}'
|
||||
shell:
|
||||
bash
|
||||
- name: List all modified files
|
||||
@@ -130,6 +130,26 @@ jobs:
|
||||
echo "Your README.md has been modified ${{ steps.changed-files.outputs.modified_files }}."
|
||||
shell:
|
||||
bash
|
||||
- name: Run changed-files with forward slash separator
|
||||
id: changed-files-forward-slash
|
||||
uses: ./
|
||||
with:
|
||||
separator: "/"
|
||||
- name: Show output
|
||||
run: |
|
||||
echo '${{ toJSON(steps.changed-files-forward-slash.outputs) }}'
|
||||
shell:
|
||||
bash
|
||||
- name: Run changed-files with pipe separator
|
||||
id: changed-files-pipe
|
||||
uses: ./
|
||||
with:
|
||||
separator: "|"
|
||||
- name: Show output
|
||||
run: |
|
||||
echo '${{ toJSON(steps.changed-files-pipe.outputs) }}'
|
||||
shell:
|
||||
bash
|
||||
- name: Run changed-files with comma separator
|
||||
id: changed-files-comma
|
||||
uses: ./
|
||||
@@ -137,7 +157,7 @@ jobs:
|
||||
separator: ","
|
||||
- name: Show output
|
||||
run: |
|
||||
echo "${{ toJSON(steps.changed-files-comma.outputs) }}"
|
||||
echo '${{ toJSON(steps.changed-files-comma.outputs) }}'
|
||||
shell:
|
||||
bash
|
||||
- name: Run changed-files with specific files
|
||||
@@ -147,7 +167,12 @@ jobs:
|
||||
files: |
|
||||
.github/workflows/test.yml
|
||||
action.yml
|
||||
- name: Verify any_changed files
|
||||
- name: Show output
|
||||
run: |
|
||||
echo '${{ toJSON(steps.changed-files-specific.outputs) }}'
|
||||
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')"
|
||||
run: |
|
||||
if [[ "${{ steps.changed-files-specific.outputs.any_changed }}" != "false" ]]; then
|
||||
@@ -156,9 +181,13 @@ jobs:
|
||||
fi
|
||||
shell:
|
||||
bash
|
||||
- name: Show output
|
||||
- name: Verify any_deleted for specific files
|
||||
if: "!contains(steps.changed-files-specific.outputs.deleted_files, 'action.yml') && !contains(steps.changed-files-specific.outputs.deleted_files, '.github/workflows/test.yml')"
|
||||
run: |
|
||||
echo "${{ toJSON(steps.changed-files-specific.outputs) }}"
|
||||
if [[ "${{ steps.changed-files-specific.outputs.any_deleted }}" != "false" ]]; then
|
||||
echo "Invalid output: Expected (false) got (${{ steps.changed-files-specific.outputs.any_deleted }})"
|
||||
exit 1
|
||||
fi
|
||||
shell:
|
||||
bash
|
||||
- name: Run changed-files with specific files comma check duplicates
|
||||
@@ -168,14 +197,14 @@ jobs:
|
||||
files: |
|
||||
entrypoint.sh
|
||||
*.sh
|
||||
- name: Verify all_changed_files files has no duplicates
|
||||
- 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')
|
||||
run: |
|
||||
ALL_CHANGED_FILES=(${{ steps.changed-files-specific-duplicate-output.outputs.all_modified_files }})
|
||||
UNIQUE_ALL_CHANGED_FILES=$(echo "$ALL_CHANGED_FILES" | tr ' ' '\n' | sort -u | xargs)
|
||||
ALL_CHANGED_AND_MODIFIED_FILES=(${{ steps.changed-files-specific-duplicate-output.outputs.all_modified_files }})
|
||||
UNIQUE_ALL_CHANGED_AND_MODIFIED_FILES=$(echo "$ALL_CHANGED_AND_MODIFIED_FILES" | tr ' ' '\n' | sort -u | xargs)
|
||||
|
||||
if [[ "$ALL_CHANGED_FILES[@]" != "$UNIQUE_ALL_CHANGED_FILES[@]" ]]; then
|
||||
echo "Duplicate output: Expected "$UNIQUE_ALL_CHANGED_FILES" got $ALL_CHANGED_FILES"
|
||||
if [[ "$ALL_CHANGED_AND_MODIFIED_FILES[@]" != "$UNIQUE_ALL_CHANGED_AND_MODIFIED_FILES[@]" ]]; then
|
||||
echo "Duplicate output: Expected "$UNIQUE_ALL_CHANGED_AND_MODIFIED_FILES" got $ALL_CHANGED_AND_MODIFIED_FILES"
|
||||
exit 1
|
||||
fi
|
||||
shell:
|
||||
@@ -188,11 +217,87 @@ jobs:
|
||||
.github/workflows/test.yml
|
||||
action.yml
|
||||
separator: ","
|
||||
- name: Show output
|
||||
run: |
|
||||
echo '${{ toJSON(steps.changed-files-specific-comma.outputs) }}'
|
||||
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')"
|
||||
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 }})"
|
||||
exit 1
|
||||
fi
|
||||
shell:
|
||||
bash
|
||||
- name: Verify any_deleted files comma separator
|
||||
if: "!contains(steps.changed-files-specific-comma.outputs.deleted_files, 'action.yml') && !contains(steps.changed-files-specific-comma.outputs.deleted_files, '.github/workflows/test.yml')"
|
||||
run: |
|
||||
if [[ "${{ steps.changed-files-specific-comma.outputs.any_deleted }}" != "false" ]]; then
|
||||
echo "Invalid output: Expected (false) got (${{ steps.changed-files-specific-comma.outputs.any_deleted }})"
|
||||
exit 1
|
||||
fi
|
||||
shell:
|
||||
bash
|
||||
- name: Run changed-files with specific files pipe separator
|
||||
id: changed-files-specific-pipe
|
||||
uses: ./
|
||||
with:
|
||||
files: |
|
||||
.github/workflows/test.yml
|
||||
action.yml
|
||||
separator: "|"
|
||||
- name: Show output
|
||||
run: |
|
||||
echo '${{ toJSON(steps.changed-files-specific-pipe.outputs) }}'
|
||||
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')"
|
||||
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 }})"
|
||||
exit 1
|
||||
fi
|
||||
shell:
|
||||
bash
|
||||
- name: Verify any_deleted files comma separator
|
||||
if: "!contains(steps.changed-files-specific-pipe.outputs.deleted_files, 'action.yml') && !contains(steps.changed-files-specific-pipe.outputs.deleted_files, '.github/workflows/test.yml')"
|
||||
run: |
|
||||
if [[ "${{ steps.changed-files-specific-pipe.outputs.any_deleted }}" != "false" ]]; then
|
||||
echo "Invalid output: Expected (false) got (${{ steps.changed-files-specific-pipe.outputs.any_deleted }})"
|
||||
exit 1
|
||||
fi
|
||||
shell:
|
||||
bash
|
||||
- name: Run changed-files with specific files forward slash separator
|
||||
id: changed-files-specific-forward-slash
|
||||
uses: ./
|
||||
with:
|
||||
files: |
|
||||
.github/workflows/test.yml
|
||||
action.yml
|
||||
separator: "/"
|
||||
- name: Show output
|
||||
run: |
|
||||
echo '${{ toJSON(steps.changed-files-specific-forward-slash.outputs) }}'
|
||||
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')"
|
||||
run: |
|
||||
if [[ "${{ steps.changed-files-specific.outputs.any_changed }}" != "false" ]]; then
|
||||
echo "Invalid output: Expected (false) got (${{ steps.changed-files-specific.outputs.any_changed }})"
|
||||
echo "Invalid output: Expected (false) got (${{ steps.changed-files-specific-forward-slash.outputs.any_changed }})"
|
||||
exit 1
|
||||
fi
|
||||
shell:
|
||||
bash
|
||||
- name: Verify any_deleted files comma separator
|
||||
if: "!contains(steps.changed-files-specific-forward-slash.outputs.deleted_files, 'action.yml') && !contains(steps.changed-files-specific-forward-slash.outputs.deleted_files, '.github/workflows/test.yml')"
|
||||
run: |
|
||||
if [[ "${{ steps.changed-files-specific.outputs.any_deleted }}" != "false" ]]; then
|
||||
echo "Invalid output: Expected (false) got (${{ steps.changed-files-specific-forward-slash.outputs.any_deleted }})"
|
||||
exit 1
|
||||
fi
|
||||
shell:
|
||||
@@ -206,18 +311,27 @@ jobs:
|
||||
test/changed-files-list.txt
|
||||
files: |
|
||||
.github/workflows/rebase.yml
|
||||
- name: Verify any_changed 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')"
|
||||
- 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')"
|
||||
run: |
|
||||
if [[ "${{ steps.changed-files-specific.outputs.any_changed }}" != "false" ]]; then
|
||||
echo "Invalid output: Expected (false) got (${{ steps.changed-files-specific.outputs.any_changed }})"
|
||||
if [[ "${{ steps.changed-files-specific-source-file.outputs.any_changed }}" != "false" ]]; then
|
||||
echo "Invalid output: Expected (false) got (${{ steps.changed-files-specific-source-file.outputs.any_changed }})"
|
||||
exit 1
|
||||
fi
|
||||
shell:
|
||||
bash
|
||||
- name: Verify any_deleted from source files
|
||||
if: "!contains(steps.changed-files-specific-source-file.outputs.deleted_files, 'action.yml') && !contains(steps.changed-files-specific-source-file.outputs.deleted_files, '.github/workflows/test.yml')"
|
||||
run: |
|
||||
if [[ "${{ steps.changed-files-specific-source-file.outputs.any_deleted }}" != "false" ]]; then
|
||||
echo "Invalid output: Expected (false) got (${{ steps.changed-files-specific-source-file.outputs.any_deleted }})"
|
||||
exit 1
|
||||
fi
|
||||
shell:
|
||||
bash
|
||||
- name: Show output
|
||||
run: |
|
||||
echo "${{ toJSON(steps.changed-files-specific.outputs) }}"
|
||||
echo '${{ toJSON(steps.changed-files-specific-source-file.outputs) }}'
|
||||
shell:
|
||||
bash
|
||||
- name: Run changed-files with specific files from a source file using a comma separator
|
||||
@@ -227,18 +341,27 @@ jobs:
|
||||
files_from_source_file: |
|
||||
test/changed-files-list.txt
|
||||
separator: ","
|
||||
- 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')"
|
||||
- name: Show output
|
||||
run: |
|
||||
if [[ "${{ steps.changed-files-specific.outputs.any_changed }}" != "false" ]]; then
|
||||
echo "Invalid output: Expected (false) got (${{ steps.changed-files-specific.outputs.any_changed }})"
|
||||
echo '${{ toJSON(steps.changed-files-specific-comma-source-file.outputs) }}'
|
||||
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')"
|
||||
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 }})"
|
||||
exit 1
|
||||
fi
|
||||
shell:
|
||||
bash
|
||||
- name: Show output
|
||||
- name: Verify any_deleted files with comma separator
|
||||
if: "!contains(steps.changed-files-specific-comma-source-file.outputs.deleted_files, 'action.yml') && !contains(steps.changed-files-specific-comma-source-file.outputs.deleted_files, '.github/workflows/test.yml')"
|
||||
run: |
|
||||
echo "${{ toJSON(steps.changed-files-specific-comma.outputs) }}"
|
||||
if [[ "${{ steps.changed-files-specific-comma-source-file.outputs.any_deleted }}" != "false" ]]; then
|
||||
echo "Invalid output: Expected (false) got (${{ steps.changed-files-specific-comma-source-file.outputs.any_deleted }})"
|
||||
exit 1
|
||||
fi
|
||||
shell:
|
||||
bash
|
||||
- name: Run changed-files with custom sha
|
||||
@@ -248,12 +371,12 @@ jobs:
|
||||
sha: ${{ github.event.pull_request.head.sha }}
|
||||
- name: Show output
|
||||
run: |
|
||||
echo "${{ toJSON(steps.changed-files-custom-sha.outputs) }}"
|
||||
echo '${{ toJSON(steps.changed-files-custom-sha.outputs) }}'
|
||||
shell:
|
||||
bash
|
||||
- name: Get branch name
|
||||
id: branch-name
|
||||
uses: tj-actions/branch-names@v4.9
|
||||
uses: tj-actions/branch-names@v5
|
||||
- uses: nrwl/last-successful-commit-action@v1
|
||||
id: last_successful_commit
|
||||
with:
|
||||
@@ -267,7 +390,7 @@ jobs:
|
||||
base_sha: ${{ steps.last_successful_commit.outputs.commit_hash }}
|
||||
- name: Show output
|
||||
run: |
|
||||
echo "${{ toJSON(steps.changed-files-custom-base-sha.outputs) }}"
|
||||
echo '${{ toJSON(steps.changed-files-custom-base-sha.outputs) }}'
|
||||
shell:
|
||||
bash
|
||||
- name: Run changed-files with specific files (only-changed)
|
||||
@@ -285,8 +408,17 @@ jobs:
|
||||
fi
|
||||
shell:
|
||||
bash
|
||||
- name: Show output
|
||||
- name: Verify only_deleted files
|
||||
if: steps.changed-files-specific-only-changed.outputs.other_deleted_files != ''
|
||||
run: |
|
||||
echo "${{ toJSON(steps.changed-files-specific-only-changed.outputs) }}"
|
||||
if [[ "${{ steps.changed-files-specific-only-changed.outputs.only_deleted }}" != "false" ]]; then
|
||||
echo "Invalid output: Expected (false) got (${{ steps.changed-files-specific-only-changed.outputs.only_deleted }})"
|
||||
exit 1
|
||||
fi
|
||||
shell:
|
||||
bash
|
||||
- name: Show output
|
||||
run: |
|
||||
echo '${{ toJSON(steps.changed-files-specific-only-changed.outputs) }}'
|
||||
shell:
|
||||
bash
|
||||
|
||||
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
|
||||
|
||||
85
HISTORY.md
85
HISTORY.md
@@ -1,5 +1,74 @@
|
||||
# Changelog
|
||||
|
||||
## [v1.1.2](https://github.com/tj-actions/changed-files/tree/v1.1.2) (2021-09-05)
|
||||
|
||||
[Full Changelog](https://github.com/tj-actions/changed-files/compare/v1.1.1...v1.1.2)
|
||||
|
||||
**Merged pull requests:**
|
||||
|
||||
- Upgraded to v1.1.1 [\#189](https://github.com/tj-actions/changed-files/pull/189) ([jackton1](https://github.com/jackton1))
|
||||
|
||||
## [v1.1.1](https://github.com/tj-actions/changed-files/tree/v1.1.1) (2021-09-05)
|
||||
|
||||
[Full Changelog](https://github.com/tj-actions/changed-files/compare/v1.1.0...v1.1.1)
|
||||
|
||||
**Implemented enhancements:**
|
||||
|
||||
- \[Feature\] Rename `all_changed_files` to `all_changed_and_modified_files` [\#179](https://github.com/tj-actions/changed-files/issues/179)
|
||||
- \[Feature\] Add support for `any_deleted` and `only_deleted` boolean output. [\#166](https://github.com/tj-actions/changed-files/issues/166)
|
||||
|
||||
**Merged pull requests:**
|
||||
|
||||
- Added support for detecting deleted files. [\#188](https://github.com/tj-actions/changed-files/pull/188) ([jackton1](https://github.com/jackton1))
|
||||
- Rename all\_changed\_files to all\_changed\_and\_modified\_files. [\#187](https://github.com/tj-actions/changed-files/pull/187) ([jackton1](https://github.com/jackton1))
|
||||
- Update other\_changed\_files output to also use the separator [\#186](https://github.com/tj-actions/changed-files/pull/186) ([jackton1](https://github.com/jackton1))
|
||||
- Upgraded to v1.1.0 [\#185](https://github.com/tj-actions/changed-files/pull/185) ([jackton1](https://github.com/jackton1))
|
||||
|
||||
## [v1.1.0](https://github.com/tj-actions/changed-files/tree/v1.1.0) (2021-09-04)
|
||||
|
||||
[Full Changelog](https://github.com/tj-actions/changed-files/compare/v1.0.3...v1.1.0)
|
||||
|
||||
**Implemented enhancements:**
|
||||
|
||||
- \[Feature\] Specify sed delimiter or escaping forward slashes used in separator [\#180](https://github.com/tj-actions/changed-files/issues/180)
|
||||
|
||||
**Closed issues:**
|
||||
|
||||
- Dependency Dashboard [\#27](https://github.com/tj-actions/changed-files/issues/27)
|
||||
|
||||
**Merged pull requests:**
|
||||
|
||||
- Update pascalgn/automerge-action action to v0.14.3 [\#184](https://github.com/tj-actions/changed-files/pull/184) ([renovate[bot]](https://github.com/apps/renovate))
|
||||
- Upgraded to v1.0.3 [\#183](https://github.com/tj-actions/changed-files/pull/183) ([jackton1](https://github.com/jackton1))
|
||||
- Update handling separator. [\#181](https://github.com/tj-actions/changed-files/pull/181) ([jackton1](https://github.com/jackton1))
|
||||
|
||||
## [v1.0.3](https://github.com/tj-actions/changed-files/tree/v1.0.3) (2021-09-03)
|
||||
|
||||
[Full Changelog](https://github.com/tj-actions/changed-files/compare/v1.0.2...v1.0.3)
|
||||
|
||||
**Implemented enhancements:**
|
||||
|
||||
- \[Feature\] Documentation for difference between all\_changed\_files and all\_modified\_files [\#177](https://github.com/tj-actions/changed-files/issues/177)
|
||||
|
||||
**Merged pull requests:**
|
||||
|
||||
- Update removing trailing separator [\#182](https://github.com/tj-actions/changed-files/pull/182) ([jackton1](https://github.com/jackton1))
|
||||
- Update README.md [\#178](https://github.com/tj-actions/changed-files/pull/178) ([jackton1](https://github.com/jackton1))
|
||||
- Upgraded to v1.0.2 [\#176](https://github.com/tj-actions/changed-files/pull/176) ([jackton1](https://github.com/jackton1))
|
||||
|
||||
## [v1.0.2](https://github.com/tj-actions/changed-files/tree/v1.0.2) (2021-08-28)
|
||||
|
||||
[Full Changelog](https://github.com/tj-actions/changed-files/compare/v1.0.1...v1.0.2)
|
||||
|
||||
**Fixed bugs:**
|
||||
|
||||
- \[BUG\] Error: xargs: unmatched single quote [\#169](https://github.com/tj-actions/changed-files/issues/169)
|
||||
|
||||
**Merged pull requests:**
|
||||
|
||||
- Fixed bug with parsing filenames that contain quotes [\#174](https://github.com/tj-actions/changed-files/pull/174) ([jackton1](https://github.com/jackton1))
|
||||
- Upgraded to v1.0.1 [\#173](https://github.com/tj-actions/changed-files/pull/173) ([jackton1](https://github.com/jackton1))
|
||||
|
||||
## [v1.0.1](https://github.com/tj-actions/changed-files/tree/v1.0.1) (2021-08-28)
|
||||
|
||||
[Full Changelog](https://github.com/tj-actions/changed-files/compare/v1.0.0...v1.0.1)
|
||||
@@ -13,10 +82,6 @@
|
||||
- \[BUG\] Deleted files not detected [\#165](https://github.com/tj-actions/changed-files/issues/165)
|
||||
- \[BUG\] changed-files unable to initialize git repository on custom container image [\#164](https://github.com/tj-actions/changed-files/issues/164)
|
||||
|
||||
**Closed issues:**
|
||||
|
||||
- Dependency Dashboard [\#27](https://github.com/tj-actions/changed-files/issues/27)
|
||||
|
||||
**Merged pull requests:**
|
||||
|
||||
- Updated README.md [\#172](https://github.com/tj-actions/changed-files/pull/172) ([jackton1](https://github.com/jackton1))
|
||||
@@ -225,7 +290,7 @@
|
||||
|
||||
## [v7](https://github.com/tj-actions/changed-files/tree/v7) (2021-06-09)
|
||||
|
||||
[Full Changelog](https://github.com/tj-actions/changed-files/compare/v6...v7)
|
||||
[Full Changelog](https://github.com/tj-actions/changed-files/compare/v6.3...v7)
|
||||
|
||||
**Closed issues:**
|
||||
|
||||
@@ -241,13 +306,13 @@
|
||||
- Update tj-actions/sync-release-version action to v8.7 [\#86](https://github.com/tj-actions/changed-files/pull/86) ([renovate[bot]](https://github.com/apps/renovate))
|
||||
- Upgraded to v6.3 [\#85](https://github.com/tj-actions/changed-files/pull/85) ([jackton1](https://github.com/jackton1))
|
||||
|
||||
## [v6](https://github.com/tj-actions/changed-files/tree/v6) (2021-05-26)
|
||||
|
||||
[Full Changelog](https://github.com/tj-actions/changed-files/compare/v6.3...v6)
|
||||
|
||||
## [v6.3](https://github.com/tj-actions/changed-files/tree/v6.3) (2021-05-26)
|
||||
|
||||
[Full Changelog](https://github.com/tj-actions/changed-files/compare/v6.2...v6.3)
|
||||
[Full Changelog](https://github.com/tj-actions/changed-files/compare/v6...v6.3)
|
||||
|
||||
## [v6](https://github.com/tj-actions/changed-files/tree/v6) (2021-05-26)
|
||||
|
||||
[Full Changelog](https://github.com/tj-actions/changed-files/compare/v6.2...v6)
|
||||
|
||||
**Merged pull requests:**
|
||||
|
||||
|
||||
95
README.md
95
README.md
@@ -1,8 +1,12 @@
|
||||
[](https://github.com/tj-actions/changed-files/actions/workflows/test.yml) [](https://github.com/tj-actions/changed-files/actions/workflows/sync-release-version.yml) [](https://www.codacy.com/gh/tj-actions/changed-files/dashboard?utm_source=github.com\&utm_medium=referral\&utm_content=tj-actions/changed-files\&utm_campaign=Badge_Grade) [](https://github.com/search?o=desc\&q=tj-actions+changed-files+language%3AYAML\&s=\&type=Code)
|
||||
[](https://github.com/tj-actions/changed-files/actions/workflows/test.yml) [](https://github.com/tj-actions/changed-files/actions/workflows/sync-release-version.yml) [](https://www.codacy.com/gh/tj-actions/changed-files/dashboard?utm\_source=github.com\&utm\_medium=referral\&utm\_content=tj-actions/changed-files\&utm\_campaign=Badge\_Grade) [](https://github.com/search?o=desc\&q=tj-actions+changed-files+language%3AYAML\&s=\&type=Code)
|
||||
|
||||
[](https://docs.github.com/en/actions/reference/workflow-syntax-for-github-actions#jobsjob\_idruns-on)
|
||||
[](https://docs.github.com/en/actions/reference/workflow-syntax-for-github-actions#jobsjob\_idruns-on)
|
||||
[](https://docs.github.com/en/actions/reference/workflow-syntax-for-github-actions#jobsjob\_idruns-on)
|
||||
|
||||
<!-- ALL-CONTRIBUTORS-BADGE:START - Do not remove or modify this section -->
|
||||
|
||||
[](#contributors-)
|
||||
[](#contributors-)
|
||||
|
||||
<!-- ALL-CONTRIBUTORS-BADGE:END -->
|
||||
|
||||
@@ -12,6 +16,7 @@ Retrieve all changed files relative to the default branch (`pull_request*` based
|
||||
|
||||
## Features
|
||||
|
||||
* Fast execution.
|
||||
* Easy to debug.
|
||||
* Boolean output indicating that certain files have been modified.
|
||||
* Multiple repository support.
|
||||
@@ -22,12 +27,6 @@ Retrieve all changed files relative to the default branch (`pull_request*` based
|
||||
* Report on files that have at least one change.
|
||||
* [Regex pattern](https://www.gnu.org/software/grep/manual/grep.html#Regular-Expressions) matching on a subset of files.
|
||||
|
||||
## Supported Platforms
|
||||
|
||||
* [`ubuntu-*`](https://docs.github.com/en/actions/reference/workflow-syntax-for-github-actions#jobsjob_idruns-on)
|
||||
* [`macos-*`](https://docs.github.com/en/actions/reference/workflow-syntax-for-github-actions#jobsjob_idruns-on)
|
||||
* [`windows-*`](https://docs.github.com/en/actions/reference/workflow-syntax-for-github-actions#jobsjob_idruns-on)
|
||||
|
||||
## Usage
|
||||
|
||||
> NOTE: :warning:
|
||||
@@ -57,7 +56,7 @@ jobs:
|
||||
|
||||
- name: Get changed files
|
||||
id: changed-files
|
||||
uses: tj-actions/changed-files@v1.0.1
|
||||
uses: tj-actions/changed-files@v1.1.2
|
||||
|
||||
- name: List all modified files
|
||||
run: |
|
||||
@@ -81,30 +80,33 @@ jobs:
|
||||
|
||||
| Output | type | example | description |
|
||||
|:--------------------:|:------------:|:----------------------------------:|:----------------------------------------:|
|
||||
| any_changed | `string` | `true` OR `false` | Returns `true` when any <br /> of the filenames provided using <br /> the `files` input has changed. <br /> i.e. *using a combination of all added, <br />copied, modified and renamed files (ACMR).* |
|
||||
| only_changed | `string` | `true` OR `false` | Returns `true` when only <br /> files provided using <br /> the `files` input have changed. |
|
||||
| other_changed_files | `string` | `'new.txt path/to/file.png ...'` | Select all modified files <br/> not listed in the files input <br /> i.e. *a combination of all added, <br /> copied and modified files (ACM).* |
|
||||
| all_modified_files | `string` | `'new.txt path/to/file.png ...'` | Select all modified files <br /> i.e. *a combination of all added, <br />copied, modified and renamed files (ACMR).* |
|
||||
| all_changed_files | `string` | `'new.txt path/to/file.png ...'` | Select all paths (\*) <br /> i.e. *a combination of all options below.* |
|
||||
| added_files | `string` | `'new.txt path/to/file.png ...'` | Select only files that are Added (A) |
|
||||
| copied_files | `string` | `'new.txt path/to/file.png ...'` | Select only files that are Copied (C) |
|
||||
| deleted_files | `string` | `'new.txt path/to/file.png ...'` | Select only files that are Deleted (D) |
|
||||
| modified_files | `string` | `'new.txt path/to/file.png ...'` | Select only files that are Modified (M) |
|
||||
| renamed_files | `string` | `'new.txt path/to/file.png ...'` | Select only files that are Renamed (R) |
|
||||
| type_changed_files | `string` | `'new.txt path/to/file.png ...'` | Select only files that have their file type changed (T) |
|
||||
| unmerged_files | `string` | `'new.txt path/to/file.png ...'` | Select only files that are Unmerged (U) |
|
||||
| unknown_files | `string` | `'new.txt path/to/file.png ...'` | Select only files that are Unknown (X) |
|
||||
| any\_changed | `string` | `true` OR `false` | Returns `true` when any <br /> of the filenames provided using <br /> the `files` input has changed. <br /> i.e. *using a combination of all added, <br />copied, modified and renamed files (ACMR).* |
|
||||
| only\_changed | `string` | `true` OR `false` | Returns `true` when only <br /> files provided using <br /> the `files` input have changed. (ACMR) |
|
||||
| other\_changed\_files | `string` | `'new.txt path/to/file.png ...'` | Select all other changed files <br/> not listed in the files input <br /> i.e. *a combination of all added, <br /> copied and modified files (ACMR).* |
|
||||
| any\_deleted | `string` | `true` OR `false` | Returns `true` when any <br /> of the filenames provided using <br /> the `files` input has been deleted. (D).\* |
|
||||
| only\_deleted | `string` | `true` OR `false` | Returns `true` when only <br /> files provided using <br /> the `files` input has been deleted. (D) |
|
||||
| other\_deleted\_files | `string` | `'new.txt path/to/file.png ...'` | Select all other deleted files <br/> not listed in the files input <br /> i.e. *a combination of all deleted files (D).* |
|
||||
| all\_modified\_files | `string` | `'new.txt path/to/file.png ...'` | Select all modified files <br /> i.e. a combination of all added, <br />copied, modified and renamed files (ACMR).\* |
|
||||
| all\_changed\_and\_modified\_files | `string` | `'new.txt path/to/file.png ...'` | Select all changed <br /> and modified files <br /> i.e. *a combination of (ACMRDTUX).* |
|
||||
| added\_files | `string` | `'new.txt path/to/file.png ...'` | Select only files that are Added (A) |
|
||||
| copied\_files | `string` | `'new.txt path/to/file.png ...'` | Select only files that are Copied (C) |
|
||||
| deleted\_files | `string` | `'new.txt path/to/file.png ...'` | Select only files that are Deleted (D) |
|
||||
| modified\_files | `string` | `'new.txt path/to/file.png ...'` | Select only files that are Modified (M) |
|
||||
| renamed\_files | `string` | `'new.txt path/to/file.png ...'` | Select only files that are Renamed (R) |
|
||||
| type\_changed\_files | `string` | `'new.txt path/to/file.png ...'` | Select only files that have their file type changed (T) |
|
||||
| unmerged\_files | `string` | `'new.txt path/to/file.png ...'` | Select only files that are Unmerged (U) |
|
||||
| unknown\_files | `string` | `'new.txt path/to/file.png ...'` | Select only files that are Unknown (X) |
|
||||
|
||||
## Inputs
|
||||
|
||||
| Input | type | required | default | description |
|
||||
|:-------------:|:-----------:|:-------------:|:-----------------------------:|:-------------:|
|
||||
| token | `string` | `false` | `${{ github.token }}` | [GITHUB_TOKEN](https://docs.github.com/en/free-pro-team@latest/actions/reference/authentication-in-a-workflow#using-the-github_token-in-a-workflow) <br /> or a repo scoped <br /> [Personal Access Token](https://docs.github.com/en/free-pro-team@latest/github/authenticating-to-github/creating-a-personal-access-token) |
|
||||
| token | `string` | `false` | `${{ github.token }}` | [GITHUB\_TOKEN](https://docs.github.com/en/free-pro-team@latest/actions/reference/authentication-in-a-workflow#using-the-github\_token-in-a-workflow) <br /> or a repo scoped <br /> [Personal Access Token](https://docs.github.com/en/free-pro-team@latest/github/authenticating-to-github/creating-a-personal-access-token) |
|
||||
| separator | `string` | `true` | `' '` | Output string separator |
|
||||
| files | `string` OR `string[]` | `false` | | Check for changes <br> using only these <br> list of file(s) <br> (Defaults to the <br> entire repo) |
|
||||
| base_sha | `string` | `false` | | Specify a different <br> base commit SHA <br> used for <br> comparing changes |
|
||||
| base\_sha | `string` | `false` | | Specify a different <br> base commit SHA <br> used for <br> comparing changes |
|
||||
| sha | `string` | `true` | `${{ github.sha }}` | Specify a different <br> commit SHA <br> used for <br> comparing changes |
|
||||
| files_from_source_file | `string` | `false` | | Source file <br> used to populate <br> the files input |
|
||||
| files\_from\_source\_file | `string` | `false` | | Source file <br> used to populate <br> the files input |
|
||||
| path | `string` | `false` | | Relative path under <br> `GITHUB_WORKSPACE` <br> to the repository |
|
||||
|
||||
## Example
|
||||
@@ -116,11 +118,11 @@ jobs:
|
||||
|
||||
- name: Get changed files using defaults
|
||||
id: changed-files
|
||||
uses: tj-actions/changed-files@v1.0.1
|
||||
uses: tj-actions/changed-files@v1.1.2
|
||||
|
||||
- name: Get changed files using a comma separator
|
||||
id: changed-files-comma
|
||||
uses: tj-actions/changed-files@v1.0.1
|
||||
uses: tj-actions/changed-files@v1.1.2
|
||||
with:
|
||||
separator: ","
|
||||
|
||||
@@ -142,7 +144,7 @@ jobs:
|
||||
|
||||
- name: Get specific changed files
|
||||
id: changed-files-specific
|
||||
uses: tj-actions/changed-files@v1.0.1
|
||||
uses: tj-actions/changed-files@v1.1.2
|
||||
with:
|
||||
files: |
|
||||
my-file.txt
|
||||
@@ -164,16 +166,30 @@ jobs:
|
||||
run: |
|
||||
echo "Only files listed above have changed."
|
||||
|
||||
- name: Run step if any of the listed files above is deleted
|
||||
if: steps.changed-files.outputs.any_deleted == "true"
|
||||
run: |
|
||||
for file in "${{ steps.changed-files.outputs.deleted_files }}"; do
|
||||
echo "$file was deleted"
|
||||
done
|
||||
|
||||
- name: Run step if all listed files above have been deleted
|
||||
if: steps.changed-files.outputs.only_deleted == "true"
|
||||
run: |
|
||||
for file in "${{ steps.changed-files.outputs.deleted_files }}"; do
|
||||
echo "$file was deleted"
|
||||
done
|
||||
|
||||
- name: Use a source file or list of file(s) to populate to files input.
|
||||
id: changed-files-specific-source-file
|
||||
uses: tj-actions/changed-files@v1.0.1
|
||||
uses: tj-actions/changed-files@v1.1.2
|
||||
with:
|
||||
files_from_source_file: |
|
||||
test/changed-files-list.txt
|
||||
|
||||
- name: Use a source file or list of file(s) to populate to files input and optionally specify more files.
|
||||
id: changed-files-specific-source-file-and-specify-files
|
||||
uses: tj-actions/changed-files@v1.0.1
|
||||
uses: tj-actions/changed-files@v1.1.2
|
||||
with:
|
||||
files_from_source_file: |
|
||||
test/changed-files-list.txt
|
||||
@@ -182,13 +198,13 @@ jobs:
|
||||
|
||||
- name: Use a different commit SHA
|
||||
id: changed-files-custom-sha
|
||||
uses: tj-actions/changed-files@v1.0.1
|
||||
uses: tj-actions/changed-files@v1.1.2
|
||||
with:
|
||||
sha: ${{ github.event.pull_request.head.sha }}
|
||||
|
||||
- name: Use a different base SHA
|
||||
id: changed-files-custom-base-sha
|
||||
uses: tj-actions/changed-files@v1.0.1
|
||||
uses: tj-actions/changed-files@v1.1.2
|
||||
with:
|
||||
base_sha: "2096ed0"
|
||||
|
||||
@@ -196,14 +212,19 @@ jobs:
|
||||
uses: actions/checkout@v2
|
||||
with:
|
||||
fetch-depth: 0
|
||||
path: subfolder
|
||||
path: dir1
|
||||
|
||||
- name: Run changed-files with defaults on the dir1
|
||||
id: changed-files-for-subfolder
|
||||
uses: tj-actions/changed-files@v1.0.1
|
||||
id: changed-files-for-dir1
|
||||
uses: tj-actions/changed-files@v1.1.2
|
||||
with:
|
||||
path: subfolder
|
||||
path: dir1
|
||||
|
||||
- name: List all added files in dir1
|
||||
run: |
|
||||
for file in "${{ steps.changed-files-for-dir1.outputs.added_files }}"; do
|
||||
echo "$file was added"
|
||||
done
|
||||
```
|
||||
|
||||
### Running [pre-commit](https://pre-commit.com/) on all modified files
|
||||
@@ -217,7 +238,7 @@ jobs:
|
||||
|
||||
- name: Get changed files
|
||||
id: changed-files
|
||||
uses: tj-actions/changed-files@v1.0.1
|
||||
uses: tj-actions/changed-files@v1.1.2
|
||||
|
||||
- name: Pre-commit
|
||||
uses: pre-commit/action@v2.0.0
|
||||
|
||||
31
action.yml
31
action.yml
@@ -54,9 +54,9 @@ outputs:
|
||||
unknown_files:
|
||||
description: List of unknown files.
|
||||
value: ${{ steps.changed-files.outputs.unknown_files }}
|
||||
all_changed_files:
|
||||
all_changed_and_modified_files:
|
||||
description: List of all changed files.
|
||||
value: ${{ steps.changed-files.outputs.all_changed_files }}
|
||||
value: ${{ steps.changed-files.outputs.all_changed_and_modified_files }}
|
||||
all_modified_files:
|
||||
description: List of all copied modified and added files.
|
||||
value: ${{ steps.changed-files.outputs.all_modified_files }}
|
||||
@@ -64,26 +64,26 @@ outputs:
|
||||
description: Return true only when any files provided using the files input have changed.
|
||||
value: ${{ steps.changed-files.outputs.any_changed }}
|
||||
only_changed:
|
||||
description: Return true only when only files provided using the files input have changed.
|
||||
description: Return true when all files provided using the files input have changed.
|
||||
value: ${{ steps.changed-files.outputs.only_changed }}
|
||||
other_changed_files:
|
||||
description: Return list of changed files not listed in the files input.
|
||||
value: ${{ steps.changed-files.outputs.other_changed_files }}
|
||||
any_deleted:
|
||||
description: Return true only when any files provided using the files input have been deleted.
|
||||
value: ${{ steps.changed-files.outputs.any_deleted }}
|
||||
only_deleted:
|
||||
description: Return true when all files provided using the files input have been deleted.
|
||||
value: ${{ steps.changed-files.outputs.only_deleted }}
|
||||
other_deleted_files:
|
||||
description: Return list of deleted files not listed in the files input.
|
||||
value: ${{ steps.changed-files.outputs.other_deleted_files }}
|
||||
|
||||
runs:
|
||||
using: 'composite'
|
||||
steps:
|
||||
- run: |
|
||||
FILES=()
|
||||
|
||||
if [[ -n $INPUT_FILES_FROM_SOURCE_FILE ]]; then
|
||||
for file in $INPUT_FILES_FROM_SOURCE_FILE
|
||||
do
|
||||
FILES+=$(cat $file | sort -u | tr "\n" " " )
|
||||
done
|
||||
fi
|
||||
|
||||
echo "::set-output name=files::$FILES"
|
||||
bash $GITHUB_ACTION_PATH/sourcefiles.sh
|
||||
id: source-input-files
|
||||
shell: bash
|
||||
env:
|
||||
@@ -94,14 +94,15 @@ runs:
|
||||
id: changed-files
|
||||
shell: bash
|
||||
env:
|
||||
GITHUB_BASE_REF: ${{ github.base_ref }}
|
||||
GITHUB_SERVER_URL: ${{ github.server_url }}
|
||||
GITHUB_REPOSITORY: ${{ github.repository }}
|
||||
GITHUB_BASE_REF: ${{ github.base_ref }}
|
||||
# INPUT_<VARIABLE_NAME> is not available in Composite run steps
|
||||
# https://github.community/t/input-variable-name-is-not-available-in-composite-run-steps/127611
|
||||
INPUT_SHA: ${{ inputs.sha }}
|
||||
INPUT_BASE_SHA: ${{ inputs.base_sha }}
|
||||
INPUT_TOKEN: ${{ inputs.token }}
|
||||
INPUT_FILES: ${{ join(format('{0} {1}', inputs.files, steps.source-input-files.outputs.files), ' ') }}
|
||||
INPUT_FILES: ${{ steps.source-input-files.outputs.files }}
|
||||
INPUT_SEPARATOR: ${{ inputs.separator }}
|
||||
INPUT_PATH: ${{ inputs.path }}
|
||||
|
||||
|
||||
138
entrypoint.sh
138
entrypoint.sh
@@ -15,7 +15,9 @@ if [[ -n $INPUT_PATH ]]; then
|
||||
cd "$REPO_DIR"
|
||||
fi
|
||||
|
||||
git remote add temp_changed_files "https://${INPUT_TOKEN}@github.com/${GITHUB_REPOSITORY}"
|
||||
SERVER_URL=$(echo "$GITHUB_SERVER_URL" | awk -F/ '{print $3}')
|
||||
|
||||
git remote add temp_changed_files "https://${INPUT_TOKEN}@${SERVER_URL}/${GITHUB_REPOSITORY}"
|
||||
|
||||
echo "Getting HEAD info..."
|
||||
|
||||
@@ -62,20 +64,18 @@ fi
|
||||
|
||||
echo "Retrieving changes between $PREVIOUS_SHA ($TARGET_BRANCH) → $CURRENT_SHA ($CURRENT_BRANCH)"
|
||||
|
||||
UNIQUE_FILES=$(echo "$INPUT_FILES" | tr " " "\n" | sort -u | xargs -0)
|
||||
|
||||
if [[ -z "$UNIQUE_FILES" ]]; then
|
||||
if [[ -z "${INPUT_FILES[*]}" ]]; then
|
||||
echo "Getting diff..."
|
||||
ADDED=$(git diff --diff-filter=A --name-only "$PREVIOUS_SHA" "$CURRENT_SHA" | tr "\n" "$INPUT_SEPARATOR" | sed -E "s/($INPUT_SEPARATOR)$//")
|
||||
COPIED=$(git diff --diff-filter=C --name-only "$PREVIOUS_SHA" "$CURRENT_SHA" | tr "\n" "$INPUT_SEPARATOR" | sed -E "s/($INPUT_SEPARATOR)$//")
|
||||
DELETED=$(git diff --diff-filter=D --name-only "$PREVIOUS_SHA" "$CURRENT_SHA" | tr "\n" "$INPUT_SEPARATOR" | sed -E "s/($INPUT_SEPARATOR)$//")
|
||||
MODIFIED=$(git diff --diff-filter=M --name-only "$PREVIOUS_SHA" "$CURRENT_SHA" | tr "\n" "$INPUT_SEPARATOR" | sed -E "s/($INPUT_SEPARATOR)$//")
|
||||
RENAMED=$(git diff --diff-filter=R --name-only "$PREVIOUS_SHA" "$CURRENT_SHA" | tr "\n" "$INPUT_SEPARATOR" | sed -E "s/($INPUT_SEPARATOR)$//")
|
||||
TYPE_CHANGED=$(git diff --diff-filter=T --name-only "$PREVIOUS_SHA" "$CURRENT_SHA" | tr "\n" "$INPUT_SEPARATOR" | sed -E "s/($INPUT_SEPARATOR)$//")
|
||||
UNMERGED=$(git diff --diff-filter=U --name-only "$PREVIOUS_SHA" "$CURRENT_SHA" | tr "\n" "$INPUT_SEPARATOR" | sed -E "s/($INPUT_SEPARATOR)$//")
|
||||
UNKNOWN=$(git diff --diff-filter=X --name-only "$PREVIOUS_SHA" "$CURRENT_SHA" | tr "\n" "$INPUT_SEPARATOR" | sed -E "s/($INPUT_SEPARATOR)$//")
|
||||
ALL_CHANGED=$(git diff --diff-filter="*ACDMRTUX" --name-only "$PREVIOUS_SHA" "$CURRENT_SHA" | tr "\n" "$INPUT_SEPARATOR" | sed -E "s/($INPUT_SEPARATOR)$//")
|
||||
ALL_MODIFIED_FILES=$(git diff --diff-filter="ACMR" --name-only "$PREVIOUS_SHA" "$CURRENT_SHA" | tr "\n" "$INPUT_SEPARATOR" | sed -E "s/($INPUT_SEPARATOR)$//")
|
||||
ADDED=$(git diff --diff-filter=A --name-only "$PREVIOUS_SHA" "$CURRENT_SHA" | awk -v d="$INPUT_SEPARATOR" '{s=(NR==1?s:s d)$0}END{print s}')
|
||||
COPIED=$(git diff --diff-filter=C --name-only "$PREVIOUS_SHA" "$CURRENT_SHA" | awk -v d="$INPUT_SEPARATOR" '{s=(NR==1?s:s d)$0}END{print s}')
|
||||
DELETED=$(git diff --diff-filter=D --name-only "$PREVIOUS_SHA" "$CURRENT_SHA" | awk -v d="$INPUT_SEPARATOR" '{s=(NR==1?s:s d)$0}END{print s}')
|
||||
MODIFIED=$(git diff --diff-filter=M --name-only "$PREVIOUS_SHA" "$CURRENT_SHA" | awk -v d="$INPUT_SEPARATOR" '{s=(NR==1?s:s d)$0}END{print s}')
|
||||
RENAMED=$(git diff --diff-filter=R --name-only "$PREVIOUS_SHA" "$CURRENT_SHA" | awk -v d="$INPUT_SEPARATOR" '{s=(NR==1?s:s d)$0}END{print s}')
|
||||
TYPE_CHANGED=$(git diff --diff-filter=T --name-only "$PREVIOUS_SHA" "$CURRENT_SHA" | awk -v d="$INPUT_SEPARATOR" '{s=(NR==1?s:s d)$0}END{print s}')
|
||||
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_FILES=$(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
|
||||
ADDED_ARRAY=()
|
||||
COPIED_ARRAY=()
|
||||
@@ -88,7 +88,9 @@ else
|
||||
ALL_CHANGED_ARRAY=()
|
||||
ALL_MODIFIED_FILES_ARRAY=()
|
||||
|
||||
for path in ${UNIQUE_FILES}
|
||||
echo "Input files: ${INPUT_FILES[*]}"
|
||||
|
||||
for path in ${INPUT_FILES}
|
||||
do
|
||||
echo "Checking for file changes: \"${path}\"..."
|
||||
IFS=" "
|
||||
@@ -114,26 +116,62 @@ else
|
||||
ALL_MODIFIED_FILES_ARRAY+=($(git diff --diff-filter="ACMR" --name-only "$PREVIOUS_SHA" "$CURRENT_SHA" | grep -E "(${path})" | xargs -0 || true))
|
||||
done
|
||||
|
||||
# shellcheck disable=SC2001
|
||||
ADDED=$(echo "${ADDED_ARRAY[*]}" | sed 's/ */'"$INPUT_SEPARATOR"'/g' | tr " " "\n" | sort -u | xargs -0)
|
||||
# shellcheck disable=SC2001
|
||||
COPIED=$(echo "${COPIED_ARRAY[*]}" | sed 's/ */'"$INPUT_SEPARATOR"'/g' | tr " " "\n" | sort -u | xargs -0)
|
||||
# shellcheck disable=SC2001
|
||||
DELETED=$(echo "${DELETED_ARRAY[*]}" | sed 's/ */'"$INPUT_SEPARATOR"'/g' | tr " " "\n" | sort -u | xargs -0)
|
||||
# shellcheck disable=SC2001
|
||||
MODIFIED=$(echo "${MODIFIED_ARRAY[*]}" | sed 's/ */'"$INPUT_SEPARATOR"'/g' | tr " " "\n" | sort -u | xargs -0)
|
||||
# shellcheck disable=SC2001
|
||||
RENAMED=$(echo "${RENAMED_ARRAY[*]}" | sed 's/ */'"$INPUT_SEPARATOR"'/g' | tr " " "\n" | sort -u | xargs -0)
|
||||
# shellcheck disable=SC2001
|
||||
TYPE_CHANGED=$(echo "${TYPE_CHANGED_ARRAY[*]}" | sed 's/ */'"$INPUT_SEPARATOR"'/g' | tr " " "\n" | sort -u | xargs -0)
|
||||
# shellcheck disable=SC2001
|
||||
UNMERGED=$(echo "${UNMERGED_ARRAY[*]}" | sed 's/ */'"$INPUT_SEPARATOR"'/g' | tr " " "\n" | sort -u | xargs -0)
|
||||
# shellcheck disable=SC2001
|
||||
UNKNOWN=$(echo "${UNKNOWN_ARRAY[*]}" | sed 's/ */'"$INPUT_SEPARATOR"'/g' | tr " " "\n" | sort -u | xargs -0)
|
||||
# shellcheck disable=SC2001
|
||||
ALL_CHANGED=$(echo "${ALL_CHANGED_ARRAY[*]}" | sed 's/ */'"$INPUT_SEPARATOR"'/g' | tr " " "\n" | sort -u | xargs -0)
|
||||
# shellcheck disable=SC2001
|
||||
ALL_MODIFIED_FILES=$(echo "${ALL_MODIFIED_FILES_ARRAY[*]}" | sed 's/ */'"$INPUT_SEPARATOR"'/g' | tr " " "\n" | sort -u | xargs -0)
|
||||
ADDED=$(echo "${ADDED_ARRAY[*]}" | tr " " "\n" | sort -u | awk -v d="$INPUT_SEPARATOR" '{s=(NR==1?s:s d)$0}END{print s}')
|
||||
COPIED=$(echo "${COPIED_ARRAY[*]}" | tr " " "\n" | sort -u | awk -v d="$INPUT_SEPARATOR" '{s=(NR==1?s:s d)$0}END{print s}')
|
||||
DELETED=$(echo "${DELETED_ARRAY[*]}" | tr " " "\n" | sort -u | awk -v d="$INPUT_SEPARATOR" '{s=(NR==1?s:s d)$0}END{print s}')
|
||||
MODIFIED=$(echo "${MODIFIED_ARRAY[*]}" | tr " " "\n" | sort -u | awk -v d="$INPUT_SEPARATOR" '{s=(NR==1?s:s d)$0}END{print s}')
|
||||
RENAMED=$(echo "${RENAMED_ARRAY[*]}" | tr " " "\n" | sort -u | awk -v d="$INPUT_SEPARATOR" '{s=(NR==1?s:s d)$0}END{print s}')
|
||||
TYPE_CHANGED=$(echo "${TYPE_CHANGED_ARRAY[*]}" | tr " " "\n" | sort -u | awk -v d="$INPUT_SEPARATOR" '{s=(NR==1?s:s d)$0}END{print s}')
|
||||
UNMERGED=$(echo "${UNMERGED_ARRAY[*]}" | tr " " "\n" | sort -u | awk -v d="$INPUT_SEPARATOR" '{s=(NR==1?s:s d)$0}END{print s}')
|
||||
UNKNOWN=$(echo "${UNKNOWN_ARRAY[*]}" | tr " " "\n" | sort -u | awk -v d="$INPUT_SEPARATOR" '{s=(NR==1?s:s d)$0}END{print s}')
|
||||
ALL_CHANGED_AND_MODIFIED=$(echo "${ALL_CHANGED_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_MODIFIED_FILES=$(git diff --diff-filter="ACMR" --name-only "$PREVIOUS_SHA" "$CURRENT_SHA")
|
||||
|
||||
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_MODIFIED_FILES_ARRAY <<< "$(echo "${ALL_OTHER_MODIFIED_FILES[@]}" "${UNIQUE_ALL_MODIFIED_FILES_ARRAY[@]}" | tr " " "\n" | sort | uniq -u | tr "\n" " ")"
|
||||
|
||||
OTHER_MODIFIED_FILES=$(echo "${OTHER_MODIFIED_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_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_MODIFIED_FILES_ARRAY[*]}" ]]; then
|
||||
echo "Non Matching modified files: ${OTHER_MODIFIED_FILES_ARRAY[*]}"
|
||||
echo "::set-output name=only_changed::false"
|
||||
echo "::set-output name=other_changed_files::$OTHER_MODIFIED_FILES"
|
||||
elif [[ -n "${UNIQUE_ALL_MODIFIED_FILES_ARRAY[*]}" ]]; then
|
||||
echo "::set-output name=only_changed::true"
|
||||
fi
|
||||
|
||||
OTHER_DELETED_FILES=$(git diff --diff-filter=D --name-only "$PREVIOUS_SHA" "$CURRENT_SHA")
|
||||
|
||||
IFS=" " read -r -a UNIQUE_DELETED_FILES_ARRAY <<< "$(echo "${DELETED_ARRAY[*]}" | tr " " "\n" | sort -u | tr "\n" " ")"
|
||||
IFS=" " read -r -a OTHER_DELETED_FILES_ARRAY <<< "$(echo "${OTHER_DELETED_FILES[@]}" "${UNIQUE_DELETED_FILES_ARRAY[@]}" | tr " " "\n" | sort | uniq -u | tr "\n" " ")"
|
||||
|
||||
OTHER_DELETED_FILES=$(echo "${OTHER_DELETED_FILES_ARRAY[*]}" | tr " " "\n" | sort -u | awk -v d="$INPUT_SEPARATOR" '{s=(NR==1?s:s d)$0}END{print s}')
|
||||
|
||||
echo "Matching deleted files: ${UNIQUE_DELETED_FILES_ARRAY[*]}"
|
||||
|
||||
if [[ -n "${UNIQUE_DELETED_FILES_ARRAY[*]}" ]]; then
|
||||
echo "::set-output name=any_deleted::true"
|
||||
else
|
||||
echo "::set-output name=any_deleted::false"
|
||||
fi
|
||||
|
||||
if [[ -n "${OTHER_DELETED_FILES_ARRAY[*]}" ]]; then
|
||||
echo "Non Matching deleted files: ${OTHER_DELETED_FILES_ARRAY[*]}"
|
||||
echo "::set-output name=only_deleted::false"
|
||||
echo "::set-output name=other_deleted_files::$OTHER_DELETED_FILES"
|
||||
elif [[ -n "${UNIQUE_DELETED_FILES_ARRAY[*]}" ]]; then
|
||||
echo "::set-output name=only_deleted::true"
|
||||
fi
|
||||
fi
|
||||
|
||||
echo "Added files: $ADDED"
|
||||
@@ -144,35 +182,9 @@ echo "Renamed files: $RENAMED"
|
||||
echo "Type Changed files: $TYPE_CHANGED"
|
||||
echo "Unmerged files: $UNMERGED"
|
||||
echo "Unknown files: $UNKNOWN"
|
||||
echo "All changed files: $ALL_CHANGED"
|
||||
echo "All changed files: $ALL_CHANGED_AND_MODIFIED"
|
||||
echo "All modified files: $ALL_MODIFIED_FILES"
|
||||
|
||||
if [[ -n "$UNIQUE_FILES" ]]; then
|
||||
# shellcheck disable=SC2001
|
||||
ALL_INPUT_FILES=$(echo "$UNIQUE_FILES" | tr "\n" " " | xargs -0)
|
||||
ALL_OTHER_CHANGED_FILES=$(git diff --diff-filter="ACMR" --name-only "$PREVIOUS_SHA" "$CURRENT_SHA")
|
||||
|
||||
OTHER_CHANGED_FILES=$(echo "${ALL_OTHER_CHANGED_FILES[@]}" "${ALL_MODIFIED_FILES[@]}" | tr " " "\n" | sort | uniq -u | tr "\n" " " | xargs -0)
|
||||
|
||||
echo "Input files: ${ALL_INPUT_FILES[*]}"
|
||||
echo "Matching modified files: ${ALL_MODIFIED_FILES[*]}"
|
||||
|
||||
if [[ -n "$ALL_MODIFIED_FILES" ]]; 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[*]}"
|
||||
echo "::set-output name=only_changed::false"
|
||||
echo "::set-output name=other_changed_files::$OTHER_CHANGED_FILES"
|
||||
else
|
||||
echo "::set-output name=only_changed::true"
|
||||
fi
|
||||
|
||||
fi
|
||||
|
||||
git remote remove temp_changed_files
|
||||
|
||||
echo "::set-output name=added_files::$ADDED"
|
||||
@@ -183,7 +195,7 @@ echo "::set-output name=renamed_files::$RENAMED"
|
||||
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_files::$ALL_CHANGED"
|
||||
echo "::set-output name=all_changed_and_modified_files::$ALL_CHANGED_AND_MODIFIED"
|
||||
echo "::set-output name=all_modified_files::$ALL_MODIFIED_FILES"
|
||||
|
||||
echo "::endgroup::"
|
||||
|
||||
26
sourcefiles.sh
Normal file
26
sourcefiles.sh
Normal file
@@ -0,0 +1,26 @@
|
||||
#!/usr/bin/env bash
|
||||
|
||||
set -e
|
||||
|
||||
echo "::group::changed-files-from-source-file"
|
||||
|
||||
IFS=" " read -r -a FILES <<< "$(echo "${INPUT_FILES[@]}" | sort -u | tr "\n" " ")"
|
||||
|
||||
if [[ -n $INPUT_FILES_FROM_SOURCE_FILE ]]; then
|
||||
for file in $INPUT_FILES_FROM_SOURCE_FILE
|
||||
do
|
||||
while read -r fileName; do
|
||||
FILES+=("$fileName")
|
||||
done <"$file"
|
||||
done
|
||||
fi
|
||||
|
||||
echo "Input Files: ${FILES[*]}"
|
||||
|
||||
IFS=" " read -r -a ALL_UNIQUE_FILES <<< "$(echo "${FILES[@]}" | tr " " "\n" | sort -u | tr "\n" " ")"
|
||||
|
||||
echo "All Unique Input files: ${ALL_UNIQUE_FILES[*]}"
|
||||
|
||||
echo "::set-output name=files::${ALL_UNIQUE_FILES[*]}"
|
||||
|
||||
echo "::endgroup::"
|
||||
@@ -1 +1 @@
|
||||
|
||||
This is a test
|
||||
|
||||
Reference in New Issue
Block a user