Compare commits
39 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
2c85495a7b | ||
|
|
98bf782e42 | ||
|
|
e77fe6304b | ||
|
|
d0d33c82a2 | ||
|
|
4ea1cf7500 | ||
|
|
835db067d1 | ||
|
|
281391b987 | ||
|
|
e458dee210 | ||
|
|
c4d765fc77 | ||
|
|
283e1f384e | ||
|
|
c204bb533c | ||
|
|
3f66a14524 | ||
|
|
b7e12d640e | ||
|
|
c1d40aa45b | ||
|
|
4e8540cc23 | ||
|
|
9b119a28a5 | ||
|
|
ff749ea95a | ||
|
|
775240461c | ||
|
|
642651fe29 | ||
|
|
c029ed4f59 | ||
|
|
2f20ef2c6b | ||
|
|
686b672b03 | ||
|
|
59233a5db9 | ||
|
|
00f80efd45 | ||
|
|
000d3cff5a | ||
|
|
c1644a1f17 | ||
|
|
af9f912974 | ||
|
|
f56e736bed | ||
|
|
0d89cb5d73 | ||
|
|
ef4467c8b8 | ||
|
|
16f1061f41 | ||
|
|
ee22dfaf73 | ||
|
|
38982dbe41 | ||
|
|
064d858f63 | ||
|
|
31bc57ef04 | ||
|
|
9c1a181e67 | ||
|
|
b160683938 | ||
|
|
78b8e06a07 | ||
|
|
8ddde738a5 |
@@ -60,6 +60,15 @@
|
||||
"contributions": [
|
||||
"doc"
|
||||
]
|
||||
},
|
||||
{
|
||||
"login": "Zamiell",
|
||||
"name": "James",
|
||||
"avatar_url": "https://avatars.githubusercontent.com/u/5511220?v=4",
|
||||
"profile": "https://github.com/Zamiell",
|
||||
"contributions": [
|
||||
"doc"
|
||||
]
|
||||
}
|
||||
],
|
||||
"contributorsPerLine": 7,
|
||||
|
||||
2
.github/workflows/sync-release-version.yml
vendored
2
.github/workflows/sync-release-version.yml
vendored
@@ -19,7 +19,7 @@ jobs:
|
||||
paths: |
|
||||
README.md
|
||||
- name: Generate CHANGELOG
|
||||
uses: tj-actions/github-changelog-generator@v1.8
|
||||
uses: tj-actions/github-changelog-generator@v1.11
|
||||
with:
|
||||
output: 'HISTORY.md'
|
||||
- name: Create Pull Request
|
||||
|
||||
8
.github/workflows/test.yml
vendored
8
.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.12
|
||||
uses: reviewdog/action-shellcheck@v1.13
|
||||
|
||||
test-multiple-repositories:
|
||||
name: Test with multiple repositories
|
||||
@@ -342,7 +342,7 @@ jobs:
|
||||
uses: ./
|
||||
with:
|
||||
files: |
|
||||
.github/workflows/test.yml
|
||||
**/test.yml
|
||||
action.yml
|
||||
separator: "|"
|
||||
- name: Show output
|
||||
@@ -425,7 +425,7 @@ jobs:
|
||||
test/changed-files-list.txt
|
||||
test/changed-files-list.txt
|
||||
files: |
|
||||
.github/workflows/rebase.yml
|
||||
**/workflows/rebase.yml
|
||||
- name: Verify any_changed from source files
|
||||
if: |
|
||||
(
|
||||
@@ -555,7 +555,7 @@ jobs:
|
||||
uses: ./
|
||||
with:
|
||||
files: |
|
||||
.github/workflows/test.yml
|
||||
.github/**/test.yml
|
||||
- name: Verify only_changed files
|
||||
if: steps.changed-files-specific-only-changed.outputs.other_changed_files != ''
|
||||
run: |
|
||||
|
||||
2
.github/workflows/update-readme.yml
vendored
2
.github/workflows/update-readme.yml
vendored
@@ -14,7 +14,7 @@ jobs:
|
||||
fetch-depth: 0
|
||||
|
||||
- name: Run test
|
||||
uses: tj-actions/remark@v1.7
|
||||
uses: tj-actions/remark@v2.3
|
||||
|
||||
- name: Verify Changed files
|
||||
uses: tj-actions/verify-changed-files@v8
|
||||
|
||||
86
HISTORY.md
86
HISTORY.md
@@ -1,8 +1,85 @@
|
||||
# Changelog
|
||||
|
||||
## [v1.1.4](https://github.com/tj-actions/changed-files/tree/v1.1.4) (2021-12-14)
|
||||
## [v3.0.0](https://github.com/tj-actions/changed-files/tree/v3.0.0) (2022-01-05)
|
||||
|
||||
[Full Changelog](https://github.com/tj-actions/changed-files/compare/v11.9...v1.1.4)
|
||||
[Full Changelog](https://github.com/tj-actions/changed-files/compare/v13...v3.0.0)
|
||||
|
||||
**Merged pull requests:**
|
||||
|
||||
- Upgraded to v13 [\#307](https://github.com/tj-actions/changed-files/pull/307) ([jackton1](https://github.com/jackton1))
|
||||
|
||||
## [v13](https://github.com/tj-actions/changed-files/tree/v13) (2022-01-05)
|
||||
|
||||
[Full Changelog](https://github.com/tj-actions/changed-files/compare/v2.0.1...v13)
|
||||
|
||||
**Implemented enhancements:**
|
||||
|
||||
- \[Feature\] Make it easier to exclude files [\#265](https://github.com/tj-actions/changed-files/issues/265)
|
||||
- \[Feature\] Support the same filter syntax as GitHub Workflows [\#264](https://github.com/tj-actions/changed-files/issues/264)
|
||||
|
||||
**Closed issues:**
|
||||
|
||||
- Dependency Dashboard [\#27](https://github.com/tj-actions/changed-files/issues/27)
|
||||
|
||||
**Merged pull requests:**
|
||||
|
||||
- Upgraded tj-actions/glob to v3.2 [\#306](https://github.com/tj-actions/changed-files/pull/306) ([jackton1](https://github.com/jackton1))
|
||||
- Update tj-actions/remark action to v2.3 [\#305](https://github.com/tj-actions/changed-files/pull/305) ([renovate[bot]](https://github.com/apps/renovate))
|
||||
- Add support for using github's glob pattern syntax [\#304](https://github.com/tj-actions/changed-files/pull/304) ([jackton1](https://github.com/jackton1))
|
||||
- Update tj-actions/remark action to v2 [\#302](https://github.com/tj-actions/changed-files/pull/302) ([renovate[bot]](https://github.com/apps/renovate))
|
||||
- Bump tj-actions/github-changelog-generator from 1.10 to 1.11 [\#300](https://github.com/tj-actions/changed-files/pull/300) ([dependabot[bot]](https://github.com/apps/dependabot))
|
||||
- Update tj-actions/github-changelog-generator action to v1.10 [\#299](https://github.com/tj-actions/changed-files/pull/299) ([renovate[bot]](https://github.com/apps/renovate))
|
||||
- Upgraded to v2.0.1 [\#298](https://github.com/tj-actions/changed-files/pull/298) ([jackton1](https://github.com/jackton1))
|
||||
- Upgraded to v12.2 [\#297](https://github.com/tj-actions/changed-files/pull/297) ([jackton1](https://github.com/jackton1))
|
||||
|
||||
## [v2.0.1](https://github.com/tj-actions/changed-files/tree/v2.0.1) (2021-12-30)
|
||||
|
||||
[Full Changelog](https://github.com/tj-actions/changed-files/compare/v12.2...v2.0.1)
|
||||
|
||||
## [v12.2](https://github.com/tj-actions/changed-files/tree/v12.2) (2021-12-30)
|
||||
|
||||
[Full Changelog](https://github.com/tj-actions/changed-files/compare/v12.1...v12.2)
|
||||
|
||||
**Merged pull requests:**
|
||||
|
||||
- Fixed unbound variable warnings [\#296](https://github.com/tj-actions/changed-files/pull/296) ([jackton1](https://github.com/jackton1))
|
||||
- Upgraded to v12.1 [\#295](https://github.com/tj-actions/changed-files/pull/295) ([jackton1](https://github.com/jackton1))
|
||||
|
||||
## [v12.1](https://github.com/tj-actions/changed-files/tree/v12.1) (2021-12-30)
|
||||
|
||||
[Full Changelog](https://github.com/tj-actions/changed-files/compare/v2.0.0...v12.1)
|
||||
|
||||
**Fixed bugs:**
|
||||
|
||||
- \[BUG\] The `other_modified_files` contains all modified files even those that match the file `filter`. [\#293](https://github.com/tj-actions/changed-files/issues/293)
|
||||
- \[BUG\] The `only_modified` is evaluated to `true` even when `other_modified_files` is not empty. [\#292](https://github.com/tj-actions/changed-files/issues/292)
|
||||
|
||||
**Merged pull requests:**
|
||||
|
||||
- Fixed regression bug with other\_modified and other\_changed outputs [\#294](https://github.com/tj-actions/changed-files/pull/294) ([jackton1](https://github.com/jackton1))
|
||||
- Update reviewdog/action-shellcheck action to v1.13 [\#291](https://github.com/tj-actions/changed-files/pull/291) ([renovate[bot]](https://github.com/apps/renovate))
|
||||
- Upgraded to v2.0.0 [\#290](https://github.com/tj-actions/changed-files/pull/290) ([jackton1](https://github.com/jackton1))
|
||||
- Updated README.md [\#289](https://github.com/tj-actions/changed-files/pull/289) ([jackton1](https://github.com/jackton1))
|
||||
|
||||
## [v2.0.0](https://github.com/tj-actions/changed-files/tree/v2.0.0) (2021-12-17)
|
||||
|
||||
[Full Changelog](https://github.com/tj-actions/changed-files/compare/v12...v2.0.0)
|
||||
|
||||
**Fixed bugs:**
|
||||
|
||||
- \[BUG\] Files input doesn't work when running with `act` [\#251](https://github.com/tj-actions/changed-files/issues/251)
|
||||
|
||||
**Closed issues:**
|
||||
|
||||
- Breaking changes in patch updates? [\#288](https://github.com/tj-actions/changed-files/issues/288)
|
||||
|
||||
**Merged pull requests:**
|
||||
|
||||
- Upgraded to v12 [\#287](https://github.com/tj-actions/changed-files/pull/287) ([jackton1](https://github.com/jackton1))
|
||||
|
||||
## [v12](https://github.com/tj-actions/changed-files/tree/v12) (2021-12-14)
|
||||
|
||||
[Full Changelog](https://github.com/tj-actions/changed-files/compare/v11.9...v12)
|
||||
|
||||
**Implemented enhancements:**
|
||||
|
||||
@@ -12,12 +89,9 @@
|
||||
|
||||
- \[BUG\] Failed to get change files on pull\_request merge event [\#281](https://github.com/tj-actions/changed-files/issues/281)
|
||||
|
||||
**Closed issues:**
|
||||
|
||||
- Dependency Dashboard [\#27](https://github.com/tj-actions/changed-files/issues/27)
|
||||
|
||||
**Merged pull requests:**
|
||||
|
||||
- Upgraded to v1.1.4 [\#286](https://github.com/tj-actions/changed-files/pull/286) ([jackton1](https://github.com/jackton1))
|
||||
- \[PR 2\]: Added support for listing all\_modified\_files. [\#285](https://github.com/tj-actions/changed-files/pull/285) ([jackton1](https://github.com/jackton1))
|
||||
- Update peter-evans/create-pull-request action to v3.12.0 [\#284](https://github.com/tj-actions/changed-files/pull/284) ([renovate[bot]](https://github.com/apps/renovate))
|
||||
- \[PR 1\]: Renamed all\_modified\_files to all\_changed\_files [\#283](https://github.com/tj-actions/changed-files/pull/283) ([jackton1](https://github.com/jackton1))
|
||||
|
||||
70
README.md
70
README.md
@@ -7,7 +7,7 @@
|
||||
|
||||
<!-- ALL-CONTRIBUTORS-BADGE:START - Do not remove or modify this section -->
|
||||
|
||||
[](#contributors-)
|
||||
[](#contributors-)
|
||||
|
||||
<!-- ALL-CONTRIBUTORS-BADGE:END -->
|
||||
|
||||
@@ -31,7 +31,7 @@ Retrieve all changed files relative to the default branch (`pull_request*` based
|
||||
* Between the last remote branch commit and the current HEAD.
|
||||
* Restrict change detection to a subset of files.
|
||||
* 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.
|
||||
* Using [Glob pattern](https://docs.github.com/en/actions/learn-github-actions/workflow-syntax-for-github-actions#filter-pattern-cheat-sheet) matching.
|
||||
|
||||
## Usage
|
||||
|
||||
@@ -39,7 +39,7 @@ Retrieve all changed files relative to the default branch (`pull_request*` based
|
||||
>
|
||||
> * **IMPORTANT:** For `push` events you need to include `fetch-depth: 0` **OR** `fetch-depth: 2` depending on your use case.
|
||||
> * When using `persist-credentials: false` with `actions/checkout@v2` you'll need to specify a `token` using the `token` input.
|
||||
> * For monorepos were pulling all the branch history might not be desired the `fetch-depth` can be omitted for `pull_request` events.
|
||||
> * For monorepos where pulling all the branch history might not be desired, you can omit `fetch-depth` for `pull_request` events.
|
||||
|
||||
```yaml
|
||||
name: CI
|
||||
@@ -63,7 +63,7 @@ jobs:
|
||||
|
||||
- name: Get changed files
|
||||
id: changed-files
|
||||
uses: tj-actions/changed-files@v1.1.4
|
||||
uses: tj-actions/changed-files@v13
|
||||
|
||||
- name: List all changed files
|
||||
run: |
|
||||
@@ -140,11 +140,11 @@ Support this project with a :star:
|
||||
|
||||
- name: Get changed files using defaults
|
||||
id: changed-files
|
||||
uses: tj-actions/changed-files@v1.1.4
|
||||
uses: tj-actions/changed-files@v13
|
||||
|
||||
- name: Get changed files using a comma separator
|
||||
id: changed-files-comma
|
||||
uses: tj-actions/changed-files@v1.1.4
|
||||
uses: tj-actions/changed-files@v13
|
||||
with:
|
||||
separator: ","
|
||||
|
||||
@@ -155,36 +155,37 @@ Support this project with a :star:
|
||||
done
|
||||
|
||||
- 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: |
|
||||
echo "Your my-file.txt file has been modified."
|
||||
|
||||
- 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: |
|
||||
echo "Your test.txt file has been deleted."
|
||||
|
||||
- name: Get specific changed files
|
||||
id: changed-files-specific
|
||||
uses: tj-actions/changed-files@v1.1.4
|
||||
uses: tj-actions/changed-files@v13
|
||||
with:
|
||||
files: |
|
||||
my-file.txt
|
||||
test.txt
|
||||
new.txt
|
||||
test_directory
|
||||
\.sh$
|
||||
.(png|jpeg)$
|
||||
.(sql|py)$
|
||||
^(mynewfile|custom)
|
||||
*.sh
|
||||
*.png
|
||||
!*.md
|
||||
*.jpeg
|
||||
**/migrate-*.sql
|
||||
|
||||
- name: Run step if any of the listed files above change
|
||||
if: steps.changed-files-specific.outputs.any_changed == 'true'
|
||||
if: steps.changed-files-specific.outputs.any_changed == "true"
|
||||
run: |
|
||||
echo "One or more files listed above has changed."
|
||||
|
||||
- name: Run step if only the files listed above change
|
||||
if: steps.changed-files-specific.outputs.only_changed == 'true'
|
||||
if: steps.changed-files-specific.outputs.only_changed == "true"
|
||||
run: |
|
||||
echo "Only files listed above have changed."
|
||||
|
||||
@@ -204,14 +205,14 @@ Support this project with a :star:
|
||||
|
||||
- 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.1.4
|
||||
uses: tj-actions/changed-files@v13
|
||||
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.1.4
|
||||
uses: tj-actions/changed-files@v13
|
||||
with:
|
||||
files_from_source_file: |
|
||||
test/changed-files-list.txt
|
||||
@@ -220,13 +221,13 @@ Support this project with a :star:
|
||||
|
||||
- name: Use a different commit SHA
|
||||
id: changed-files-custom-sha
|
||||
uses: tj-actions/changed-files@v1.1.4
|
||||
uses: tj-actions/changed-files@v13
|
||||
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.1.4
|
||||
uses: tj-actions/changed-files@v13
|
||||
with:
|
||||
base_sha: "2096ed0"
|
||||
|
||||
@@ -238,7 +239,7 @@ Support this project with a :star:
|
||||
|
||||
- name: Run changed-files with defaults on the dir1
|
||||
id: changed-files-for-dir1
|
||||
uses: tj-actions/changed-files@v1.1.4
|
||||
uses: tj-actions/changed-files@v13
|
||||
with:
|
||||
path: dir1
|
||||
|
||||
@@ -250,32 +251,12 @@ Support this project with a :star:
|
||||
|
||||
- name: Run changed-files using the last commit on the remote branch
|
||||
id: changed-files-since-last-remote-commit
|
||||
uses: tj-actions/changed-files@v1.1.4
|
||||
uses: tj-actions/changed-files@v13
|
||||
with:
|
||||
since_last_remote_commit: 'true'
|
||||
since_last_remote_commit: "true"
|
||||
|
||||
```
|
||||
|
||||
### Running [pre-commit](https://pre-commit.com/) on all modified files
|
||||
|
||||
```yaml
|
||||
...
|
||||
steps:
|
||||
- uses: actions/checkout@v2
|
||||
with:
|
||||
fetch-depth: 0
|
||||
|
||||
- name: Get changed files
|
||||
id: changed-files
|
||||
uses: tj-actions/changed-files@v1.1.4
|
||||
|
||||
- name: Pre-commit
|
||||
uses: pre-commit/action@v2.0.0
|
||||
with:
|
||||
extra_args: -v --hook-stage push --files ${{ steps.changed-files.outputs.all_changed_files }}
|
||||
token: ${{ secrets.github_token }}
|
||||
```
|
||||
|
||||
<img width="1147" alt="Screen Shot 2021-11-19 at 4 59 21 PM" src="https://user-images.githubusercontent.com/17484350/142696936-8b7ca955-7ef9-4d53-9bdf-3e0008e90c3f.png">
|
||||
|
||||
* Free software: [MIT license](LICENSE)
|
||||
@@ -320,6 +301,7 @@ Thanks goes to these wonderful people ([emoji key](https://allcontributors.org/d
|
||||
<td align="center"><a href="https://github.com/IvanPizhenko"><img src="https://avatars.githubusercontent.com/u/11859904?v=4?s=100" width="100px;" alt=""/><br /><sub><b>Ivan Pizhenko</b></sub></a><br /><a href="https://github.com/tj-actions/changed-files/commits?author=IvanPizhenko" title="Code">💻</a> <a href="https://github.com/tj-actions/changed-files/commits?author=IvanPizhenko" title="Documentation">📖</a></td>
|
||||
<td align="center"><a href="https://github.com/talva-tr"><img src="https://avatars.githubusercontent.com/u/82046981?v=4?s=100" width="100px;" alt=""/><br /><sub><b>talva-tr</b></sub></a><br /><a href="https://github.com/tj-actions/changed-files/commits?author=talva-tr" title="Code">💻</a></td>
|
||||
<td align="center"><a href="https://bandism.net/"><img src="https://avatars.githubusercontent.com/u/22633385?v=4?s=100" width="100px;" alt=""/><br /><sub><b>Ikko Ashimine</b></sub></a><br /><a href="https://github.com/tj-actions/changed-files/commits?author=eltociear" title="Documentation">📖</a></td>
|
||||
<td align="center"><a href="https://github.com/Zamiell"><img src="https://avatars.githubusercontent.com/u/5511220?v=4?s=100" width="100px;" alt=""/><br /><sub><b>James</b></sub></a><br /><a href="https://github.com/tj-actions/changed-files/commits?author=Zamiell" title="Documentation">📖</a></td>
|
||||
</tr>
|
||||
</table>
|
||||
|
||||
@@ -330,7 +312,3 @@ Thanks goes to these wonderful people ([emoji key](https://allcontributors.org/d
|
||||
<!-- ALL-CONTRIBUTORS-LIST:END -->
|
||||
|
||||
This project follows the [all-contributors](https://github.com/all-contributors/all-contributors) specification. Contributions of any kind welcome!
|
||||
|
||||
[buymeacoffee]: https://www.buymeacoffee.com/jackton1
|
||||
|
||||
[buymeacoffee-shield]: https://www.buymeacoffee.com/assets/img/custom_images/orange_img.png
|
||||
|
||||
25
action.yml
25
action.yml
@@ -99,13 +99,6 @@ outputs:
|
||||
runs:
|
||||
using: 'composite'
|
||||
steps:
|
||||
- run: |
|
||||
bash $GITHUB_ACTION_PATH/sourcefiles.sh
|
||||
id: source-input-files
|
||||
shell: bash
|
||||
env:
|
||||
INPUT_FILES: ${{ inputs.files }}
|
||||
INPUT_FILES_FROM_SOURCE_FILE: ${{ inputs.files_from_source_file }}
|
||||
- run: |
|
||||
# "Set base sha..."
|
||||
if [[ -n "${{ inputs.base_sha }}" ]]; then
|
||||
@@ -119,6 +112,22 @@ runs:
|
||||
fi
|
||||
id: base-sha
|
||||
shell: bash
|
||||
- run: |
|
||||
bash $GITHUB_ACTION_PATH/sourcefiles.sh
|
||||
id: source-input-files
|
||||
shell: bash
|
||||
env:
|
||||
# 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_FILES: ${{ inputs.files }}
|
||||
INPUT_FILES_FROM_SOURCE_FILE: ${{ inputs.files_from_source_file }}
|
||||
- name: Glob match
|
||||
uses: tj-actions/glob@v3.3
|
||||
id: glob
|
||||
with:
|
||||
files: ${{ steps.source-input-files.outputs.files }}
|
||||
files-separator: " "
|
||||
separator: "|"
|
||||
- run: |
|
||||
bash $GITHUB_ACTION_PATH/entrypoint.sh
|
||||
id: changed-files
|
||||
@@ -132,7 +141,7 @@ runs:
|
||||
INPUT_SHA: ${{ inputs.sha }}
|
||||
INPUT_BASE_SHA: ${{ steps.base-sha.outputs.base_sha }}
|
||||
INPUT_TOKEN: ${{ inputs.token }}
|
||||
INPUT_FILES: ${{ steps.source-input-files.outputs.files }}
|
||||
INPUT_FILES: ${{ steps.glob.outputs.paths }}
|
||||
INPUT_SEPARATOR: ${{ inputs.separator }}
|
||||
INPUT_PATH: ${{ inputs.path }}
|
||||
|
||||
|
||||
@@ -106,34 +106,32 @@ if [[ -z "${INPUT_FILES[*]}" ]]; then
|
||||
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}')
|
||||
ALL_MODIFIED=$(git diff --diff-filter="ACMRD" --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[*]}"
|
||||
echo "Input files: $INPUT_FILES"
|
||||
|
||||
FILES=$(echo "${INPUT_FILES[*]}" | awk '{gsub(/ /,"\n"); print $0;}' | awk -v d="|" '{s=(NR==1?s:s d)$0}END{print s}')
|
||||
|
||||
echo "Checking for file changes: \"${FILES}\"..."
|
||||
ADDED=$(git diff --diff-filter=A --name-only "$PREVIOUS_SHA" "$CURRENT_SHA" | grep -E "(${FILES})" | awk -v d="|" '{s=(NR==1?s:s d)$0}END{print s}')
|
||||
COPIED=$(git diff --diff-filter=C --name-only "$PREVIOUS_SHA" "$CURRENT_SHA" | grep -E "(${FILES})" | awk -v d="|" '{s=(NR==1?s:s d)$0}END{print s}')
|
||||
DELETED=$(git diff --diff-filter=D --name-only "$PREVIOUS_SHA" "$CURRENT_SHA" | grep -E "(${FILES})" | awk -v d="|" '{s=(NR==1?s:s d)$0}END{print s}')
|
||||
MODIFIED=$(git diff --diff-filter=M --name-only "$PREVIOUS_SHA" "$CURRENT_SHA" | grep -E "(${FILES})" | awk -v d="|" '{s=(NR==1?s:s d)$0}END{print s}')
|
||||
RENAMED=$(git diff --diff-filter=R --name-only "$PREVIOUS_SHA" "$CURRENT_SHA" | grep -E "(${FILES})" | awk -v d="|" '{s=(NR==1?s:s d)$0}END{print s}')
|
||||
TYPE_CHANGED=$(git diff --diff-filter=T --name-only "$PREVIOUS_SHA" "$CURRENT_SHA" | grep -E "(${FILES})" | awk -v d="|" '{s=(NR==1?s:s d)$0}END{print s}')
|
||||
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_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_MODIFIED=$(git diff --diff-filter="ACMRD" --name-only "$PREVIOUS_SHA" "$CURRENT_SHA" | grep -E "(${FILES})" | awk -v d="|" '{s=(NR==1?s:s d)$0}END{print s}')
|
||||
echo "Checking for file changes: \"${INPUT_FILES}\"..."
|
||||
ADDED=$(git diff --diff-filter=A --name-only "$PREVIOUS_SHA" "$CURRENT_SHA" | grep -E "(${INPUT_FILES})" | awk -v d="|" '{s=(NR==1?s:s d)$0}END{print s}')
|
||||
COPIED=$(git diff --diff-filter=C --name-only "$PREVIOUS_SHA" "$CURRENT_SHA" | grep -E "(${INPUT_FILES})" | awk -v d="|" '{s=(NR==1?s:s d)$0}END{print s}')
|
||||
DELETED=$(git diff --diff-filter=D --name-only "$PREVIOUS_SHA" "$CURRENT_SHA" | grep -E "(${INPUT_FILES})" | awk -v d="|" '{s=(NR==1?s:s d)$0}END{print s}')
|
||||
MODIFIED=$(git diff --diff-filter=M --name-only "$PREVIOUS_SHA" "$CURRENT_SHA" | grep -E "(${INPUT_FILES})" | awk -v d="|" '{s=(NR==1?s:s d)$0}END{print s}')
|
||||
RENAMED=$(git diff --diff-filter=R --name-only "$PREVIOUS_SHA" "$CURRENT_SHA" | grep -E "(${INPUT_FILES})" | awk -v d="|" '{s=(NR==1?s:s d)$0}END{print s}')
|
||||
TYPE_CHANGED=$(git diff --diff-filter=T --name-only "$PREVIOUS_SHA" "$CURRENT_SHA" | grep -E "(${INPUT_FILES})" | awk -v d="|" '{s=(NR==1?s:s d)$0}END{print s}')
|
||||
UNMERGED=$(git diff --diff-filter=U --name-only "$PREVIOUS_SHA" "$CURRENT_SHA" | grep -E "(${INPUT_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 "(${INPUT_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 "(${INPUT_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 "(${INPUT_FILES})" | awk -v d="|" '{s=(NR==1?s:s d)$0}END{print s}')
|
||||
ALL_MODIFIED=$(git diff --diff-filter="ACMRD" --name-only "$PREVIOUS_SHA" "$CURRENT_SHA" | grep -E "(${INPUT_FILES})" | awk -v d="|" '{s=(NR==1?s:s d)$0}END{print s}')
|
||||
|
||||
ALL_OTHER_CHANGED=$(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_CHANGED=$(echo "${ALL_CHANGED}" | awk '{gsub(/\|/,"\n"); print $0;}' | sort -u | awk -v d="|" '{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_CHANGED}" ]]; then
|
||||
echo "Matching modified files: ${UNIQUE_ALL_CHANGED}"
|
||||
echo "Matching changed files: ${UNIQUE_ALL_CHANGED}"
|
||||
echo "::set-output name=any_changed::true"
|
||||
else
|
||||
echo "::set-output name=any_changed::false"
|
||||
fi
|
||||
|
||||
OTHER_CHANGED=""
|
||||
|
||||
if [[ -n $ALL_OTHER_CHANGED ]]; then
|
||||
if [[ -n "$UNIQUE_ALL_CHANGED" ]]; then
|
||||
@@ -156,14 +154,14 @@ else
|
||||
ALL_OTHER_MODIFIED=$(git diff --diff-filter="ACMRD" --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_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}')
|
||||
|
||||
if [[ -n "${UNIQUE_ALL_MODIFIED}" ]]; then
|
||||
echo "Matching modified files: ${UNIQUE_ALL_MODIFIED}"
|
||||
echo "::set-output name=any_modified::true"
|
||||
else
|
||||
echo "::set-output name=any_modified::false"
|
||||
fi
|
||||
|
||||
OTHER_MODIFIED=""
|
||||
|
||||
if [[ -n $ALL_OTHER_MODIFIED ]]; then
|
||||
if [[ -n "$UNIQUE_ALL_MODIFIED" ]]; then
|
||||
@@ -192,10 +190,12 @@ else
|
||||
else
|
||||
echo "::set-output name=any_deleted::false"
|
||||
fi
|
||||
|
||||
OTHER_DELETED=""
|
||||
|
||||
if [[ -n $ALL_OTHER_DELETED ]]; then
|
||||
if [[ -n "$UNIQUE_ALL_DELETED" ]]; then
|
||||
OTHER_DELETED=$(echo "${ALL_OTHER_DELETED}|${UNIQUE_ALL_DELETED}" | awk '{gsub(/\|/,"\n"); print $0;}' | sort | uniq -u | awk -v d="|" '{s=(NR==1?s:s d)$0}END{print s}')
|
||||
OTHER_DELETED=$(echo "${ALL_OTHER_DELETED}|${UNIQUE_ALL_DELETED}" | awk '{gsub(/\|/,"\n"); print $0;}' | sort | uniq -u | awk -v d="|" '{s=(NR==1?s:s d)$0}END{print s}')
|
||||
else
|
||||
OTHER_DELETED=$ALL_OTHER_DELETED
|
||||
fi
|
||||
|
||||
@@ -4,22 +4,26 @@ set -e
|
||||
|
||||
echo "::group::changed-files-from-source-file"
|
||||
|
||||
IFS=" " read -r -a FILES <<< "$(echo "${INPUT_FILES[@]}" | sort -u | tr "\n" " ")"
|
||||
RAW_FILES=()
|
||||
|
||||
if [[ -n $INPUT_FILES_FROM_SOURCE_FILE ]]; then
|
||||
for file in $INPUT_FILES_FROM_SOURCE_FILE
|
||||
do
|
||||
while read -r fileName; do
|
||||
FILES+=("$fileName")
|
||||
RAW_FILES+=("$fileName")
|
||||
done <"$file"
|
||||
done
|
||||
fi
|
||||
|
||||
echo "Input Files: ${FILES[*]}"
|
||||
IFS=" " read -r -a CLEAN_FILES <<< "$(echo "${RAW_FILES[*]}" | tr "\r\n" "\n" | tr " " "\n" | sort -u | awk -v d=" " '{s=(NR==1?s:s d)$0}END{print s}')"
|
||||
|
||||
IFS=" " read -r -a ALL_UNIQUE_FILES <<< "$(echo "${FILES[@]}" | tr " " "\n" | sort -u | tr "\n" " ")"
|
||||
IFS=" " read -r -a CLEAN_INPUT_FILES <<< "$(echo "${INPUT_FILES}" | tr "\r\n" "\n" | tr " " "\n" | sort -u | awk -v d=" " '{s=(NR==1?s:s d)$0}END{print s}')"
|
||||
|
||||
echo "All Unique Input files: ${ALL_UNIQUE_FILES[*]}"
|
||||
FILES=("${CLEAN_FILES[@]}" "${CLEAN_INPUT_FILES[@]}")
|
||||
|
||||
IFS=" " read -r -a ALL_UNIQUE_FILES <<< "$(echo "${FILES[@]}" | tr "\r\n" "\n" | tr " " "\n" | sort -u | awk -v d=" " '{s=(NR==1?s:s d)$0}END{print s}')"
|
||||
|
||||
echo "Input files: ${ALL_UNIQUE_FILES[*]}"
|
||||
|
||||
echo "::set-output name=files::${ALL_UNIQUE_FILES[*]}"
|
||||
|
||||
|
||||
@@ -2,3 +2,4 @@
|
||||
action.yml
|
||||
action.yml
|
||||
action.yml
|
||||
!*.txt
|
||||
|
||||
Reference in New Issue
Block a user