Compare commits

...

39 Commits
v12 ... v13.1

Author SHA1 Message Date
Tonye Jack
2c85495a7b Updated separator 2022-02-16 22:20:21 -05:00
Tonye Jack
98bf782e42 Update README.md 2022-01-09 12:11:39 -05:00
Tonye Jack
e77fe6304b Update README.md 2022-01-09 12:10:47 -05:00
Renovate Bot
d0d33c82a2 Update tj-actions/glob action to v3.3 2022-01-09 04:49:33 -05:00
Tonye Jack
4ea1cf7500 Updated README.md (#312)
Co-authored-by: jackton1 <jackton1@users.noreply.github.com>
2022-01-09 03:23:45 -05:00
Tonye Jack
835db067d1 Clean up unused code (#311)
* Clean up unused code

* Update entrypoint.sh

* Update action.yml

* Update entrypoint.sh

* Update action.yml
2022-01-09 03:18:29 -05:00
allcontributors[bot]
281391b987 doc: add Zamiell as a contributor for doc (#310)
* docs: update README.md [skip ci]

* docs: update .all-contributorsrc [skip ci]

* Update .all-contributorsrc

* Update README.md

Co-authored-by: allcontributors[bot] <46447321+allcontributors[bot]@users.noreply.github.com>
Co-authored-by: Tonye Jack <jtonye@ymail.com>
2022-01-07 14:31:32 -05:00
James
e458dee210 spelling/grammar (#309) 2022-01-07 13:51:45 -05:00
Tonye Jack
c4d765fc77 Update README.md 2022-01-05 00:19:25 -05:00
Tonye Jack
283e1f384e Upgraded from v13 -> v3.0.0 (#308)
Co-authored-by: jackton1 <jackton1@users.noreply.github.com>
2022-01-04 22:56:23 -05:00
Tonye Jack
c204bb533c Upgraded from v12.2 -> v13 (#307)
Co-authored-by: jackton1 <jackton1@users.noreply.github.com>
2022-01-04 22:27:11 -05:00
Tonye Jack
3f66a14524 Upgraded tj-actions/glob to v3.2 (#306) 2022-01-04 22:23:46 -05:00
Tonye Jack
b7e12d640e Update action.yml 2022-01-04 22:10:38 -05:00
Tonye Jack
c1d40aa45b Update README.md 2022-01-04 22:08:06 -05:00
Tonye Jack
4e8540cc23 Add support for using github's glob pattern syntax (#304)
* Add support for using github's glob pattern syntax

Fixes: #264 #265

* Update sourcefiles.sh

* Update sourcefiles.sh

* Update sourcefiles.sh

* Update sourcefiles.sh

* Update sourcefiles.sh

* Update sourcefiles.sh

* Update sourcefiles.sh

* Update sourcefiles.sh

Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>

* Update sourcefiles.sh

* Update sourcefiles.sh

* Update action.yml

* Update action.yml

* Update action.yml

* Update action.yml

* Update sourcefiles.sh

* Update sourcefiles.sh

* Update sourcefiles.sh

* Update sourcefiles.sh

* Update sourcefiles.sh

* Update sourcefiles.sh

* Update sourcefiles.sh

* Update sourcefiles.sh

* Update sourcefiles.sh

* Update sourcefiles.sh

* Update sourcefiles.sh

* Update sourcefiles.sh

* Update sourcefiles.sh

* Update sourcefiles.sh

* Update sourcefiles.sh

* Update sourcefiles.sh

* Update sourcefiles.sh

* Update sourcefiles.sh

* Update sourcefiles.sh

* Update sourcefiles.sh

* Update sourcefiles.sh

* Update sourcefiles.sh

* Update sourcefiles.sh

* Update sourcefiles.sh

* Update sourcefiles.sh

* Update sourcefiles.sh

* Update sourcefiles.sh

* Update sourcefiles.sh

* Update sourcefiles.sh

* Update sourcefiles.sh

* Update sourcefiles.sh

* Update sourcefiles.sh

* Update action.yml

* Update test.yml

* Update changed-files-list.txt

* Update changed-files-list.txt

* Update action.yml

* Update action.yml

* Update entrypoint.sh

* Update test.yml

* Update README.md

* Update test.yml

* Update entrypoint.sh

* Update test.yml

Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>
2022-01-04 21:38:03 -05:00
Tonye Jack
9b119a28a5 Updated comments 2022-01-04 20:28:30 -05:00
Renovate Bot
ff749ea95a Update tj-actions/remark action to v2.3 2022-01-03 16:13:31 -05:00
Renovate Bot
775240461c Update tj-actions/remark action to v2 2022-01-02 21:59:56 -05:00
dependabot[bot]
642651fe29 Bump tj-actions/github-changelog-generator from 1.10 to 1.11
Bumps [tj-actions/github-changelog-generator](https://github.com/tj-actions/github-changelog-generator) from 1.10 to 1.11.
- [Release notes](https://github.com/tj-actions/github-changelog-generator/releases)
- [Changelog](https://github.com/tj-actions/github-changelog-generator/blob/main/HISTORY.md)
- [Commits](https://github.com/tj-actions/github-changelog-generator/compare/v1.10...v1.11)

---
updated-dependencies:
- dependency-name: tj-actions/github-changelog-generator
  dependency-type: direct:production
  update-type: version-update:semver-minor
...

Signed-off-by: dependabot[bot] <support@github.com>
2022-01-02 20:29:26 -05:00
Renovate Bot
c029ed4f59 Update tj-actions/github-changelog-generator action to v1.10 2021-12-31 20:29:31 -05:00
Tonye Jack
2f20ef2c6b Update README.md 2021-12-29 21:31:50 -05:00
Tonye Jack
686b672b03 Upgraded to v2.0.1 (#298)
Co-authored-by: jackton1 <jackton1@users.noreply.github.com>
2021-12-29 21:29:56 -05:00
Tonye Jack
59233a5db9 Upgraded to v12.2 (#297)
Co-authored-by: jackton1 <jackton1@users.noreply.github.com>
2021-12-29 21:25:25 -05:00
Tonye Jack
00f80efd45 Fixed unbound variable warnings (#296) 2021-12-29 21:22:46 -05:00
Tonye Jack
000d3cff5a Update README.md 2021-12-29 20:45:48 -05:00
Tonye Jack
c1644a1f17 Update README.md 2021-12-29 20:44:54 -05:00
Tonye Jack
af9f912974 Upgraded to v12.1 (#295)
Co-authored-by: jackton1 <jackton1@users.noreply.github.com>
2021-12-29 20:01:32 -05:00
Tonye Jack
f56e736bed Fixed regression bug with other_modified and other_changed outputs (#294) 2021-12-29 19:57:35 -05:00
Renovate Bot
0d89cb5d73 Update reviewdog/action-shellcheck action to v1.13 2021-12-28 05:11:23 -05:00
Tonye Jack
ef4467c8b8 Update README.md 2021-12-24 12:33:11 -05:00
Tonye Jack
16f1061f41 Update README.md 2021-12-20 02:41:41 -05:00
Tonye Jack
ee22dfaf73 Update README.md 2021-12-20 02:40:27 -05:00
Tonye Jack
38982dbe41 Update README.md 2021-12-17 20:12:28 -05:00
Tonye Jack
064d858f63 Updated README.md (#289)
* Updated README.md

* Update README.md

Co-authored-by: jackton1 <jackton1@users.noreply.github.com>
2021-12-17 15:36:30 -05:00
Tonye Jack
31bc57ef04 Upgraded from v12 -> v2.0.0 (#290)
Co-authored-by: jackton1 <jackton1@users.noreply.github.com>
2021-12-17 15:13:40 -05:00
Tonye Jack
9c1a181e67 Update README.md 2021-12-17 15:01:08 -05:00
Tonye Jack
b160683938 Update README.md 2021-12-17 15:00:14 -05:00
Tonye Jack
78b8e06a07 Update entrypoint.sh 2021-12-14 16:55:39 -05:00
Tonye Jack
8ddde738a5 Upgraded from v1.1.4 -> v12 (#287)
Co-authored-by: jackton1 <jackton1@users.noreply.github.com>
2021-12-14 02:24:18 -05:00
10 changed files with 167 additions and 92 deletions

View File

@@ -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,

View File

@@ -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

View File

@@ -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: |

View File

@@ -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

View File

@@ -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))

View File

@@ -7,7 +7,7 @@
<!-- ALL-CONTRIBUTORS-BADGE:START - Do not remove or modify this section -->
[![All Contributors](https://img.shields.io/badge/all_contributors-6-orange.svg?style=flat-square)](#contributors-)
[![All Contributors](https://img.shields.io/badge/all_contributors-7-orange.svg?style=flat-square)](#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

View File

@@ -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 }}

View File

@@ -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

View File

@@ -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[*]}"

View File

@@ -2,3 +2,4 @@
action.yml
action.yml
action.yml
!*.txt