Compare commits

...

33 Commits

Author SHA1 Message Date
Tonye Jack
4196030939 chore: add warrning message to diff error (#1593)
Co-authored-by: GitHub Action <action@github.com>
2023-09-20 19:14:07 +00:00
renovate[bot]
bbe796033e chore(deps): update dependency @types/node to v20.6.3 2023-09-20 03:33:59 +00:00
tj-actions[bot]
159562dc02 Upgraded to v39.1.1 (#1591)
Co-authored-by: jackton1 <jackton1@users.noreply.github.com>
2023-09-19 20:38:19 +00:00
Tonye Jack
a21a533a0c Update test.yml 2023-09-19 14:21:54 -06:00
Tonye Jack
eeb169a9f9 chore: add codacy config (#1590)
Co-authored-by: GitHub Action <action@github.com>
2023-09-19 14:19:15 -06:00
Arthur
951140b94a fix: changed_keys and modified_keys output to handle json and escape_json inputs (#1585)
Co-authored-by: Arthur Volant <arthur.volant@adevinta.com>
Co-authored-by: Tonye Jack <jtonye@ymail.com>
Co-authored-by: repo-ranger[bot] <39074581+repo-ranger[bot]@users.noreply.github.com>
2023-09-19 19:18:22 +00:00
Tonye Jack
dbf0700c7a fix: error with test (#1589) 2023-09-19 12:10:14 -06:00
tj-actions[bot]
dacbaebcaf Updated README.md (#1588)
Co-authored-by: jackton1 <jackton1@users.noreply.github.com>
2023-09-19 16:58:27 +00:00
allcontributors[bot]
36ab2fe9c2 docs: add V0lantis as a contributor for bug (#1587)
Co-authored-by: allcontributors[bot] <46447321+allcontributors[bot]@users.noreply.github.com>
2023-09-19 10:39:08 -06:00
Tonye Jack
7e3a4bac80 chore: Update test.yml (#1586) 2023-09-19 16:09:34 +00:00
Tonye Jack
dcbe9805f4 chore: move variable declaration (#1584)
Co-authored-by: repo-ranger[bot] <39074581+repo-ranger[bot]@users.noreply.github.com>
Co-authored-by: tj-actions[bot] <109116665+tj-actions-bot@users.noreply.github.com>
Co-authored-by: GitHub Action <action@github.com>
2023-09-18 23:37:47 +00:00
tj-actions[bot]
fd73c1248c Upgraded to v39.1.0 (#1583)
Co-authored-by: jackton1 <jackton1@users.noreply.github.com>
2023-09-18 20:39:02 +00:00
tj-actions[bot]
8e79ba7ab9 Updated README.md (#1582)
Co-authored-by: repo-ranger[bot] <repo-ranger[bot]@users.noreply.github.com>
2023-09-18 14:22:58 -06:00
Tonye Jack
5db7b578d5 feat: add support for returning YAML keys for paths that have changed (#1581)
Co-authored-by: GitHub Action <action@github.com>
2023-09-18 20:17:46 +00:00
renovate[bot]
a17e8c5252 chore(deps): update typescript-eslint monorepo to v6.7.2 2023-09-18 19:14:08 +00:00
renovate[bot]
d1e9506b19 chore(deps): lock file maintenance 2023-09-18 02:01:10 +00:00
tj-actions[bot]
1fdfe0928a Upgraded to v39.0.3 (#1577)
Co-authored-by: jackton1 <jackton1@users.noreply.github.com>
2023-09-17 21:34:54 +00:00
Tonye Jack
76c4d81a6a chore: cleanup imports (#1576) 2023-09-17 03:16:01 +00:00
Tonye Jack
d8904df6c5 chore: refactor function (#1572)
Co-authored-by: GitHub Action <action@github.com>
Co-authored-by: repo-ranger[bot] <39074581+repo-ranger[bot]@users.noreply.github.com>
2023-09-16 11:44:37 +00:00
renovate[bot]
662c03ea61 chore(deps): update dependency @types/node to v20.6.2 2023-09-16 09:06:38 +00:00
renovate[bot]
c8b7da7226 chore(deps): update dependency eslint-plugin-jest to v27.4.0 2023-09-16 00:28:53 +00:00
renovate[bot]
249c1698c5 chore(deps): update dependency @types/jest to v29.5.5 2023-09-15 22:09:24 +00:00
renovate[bot]
17352b2176 chore(deps): update dependency @types/node to v20.6.1 2023-09-15 08:58:26 +00:00
tj-actions[bot]
e8e6614779 Updated README.md (#1570)
Co-authored-by: jackton1 <jackton1@users.noreply.github.com>
2023-09-14 22:07:53 -06:00
Tonye Jack
ad4b06d999 Update README.md 2023-09-14 21:59:38 -06:00
Tonye Jack
b1a34eb336 Update README.md 2023-09-14 21:58:35 -06:00
Tonye Jack
d9a6ccb099 chore: update README.md (#1569) 2023-09-14 17:38:21 +00:00
renovate[bot]
090eb05f17 chore(deps): update dependency @types/uuid to v9.0.4 2023-09-14 15:58:41 +00:00
tj-actions[bot]
690bef673a Updated README.md (#1566)
Co-authored-by: repo-ranger[bot] <repo-ranger[bot]@users.noreply.github.com>
2023-09-13 17:36:28 +00:00
Tonye Jack
fb8d2c9c29 chore: update input description (#1565) 2023-09-13 17:25:26 +00:00
Tonye Jack
bb3b39cd33 Update README.md 2023-09-13 07:45:12 -06:00
renovate[bot]
001f56257c chore(deps): update dependency jest to v29.7.0 2023-09-12 09:59:39 +00:00
tj-actions[bot]
57245a9721 Upgraded to v39.0.2 (#1563)
Co-authored-by: jackton1 <jackton1@users.noreply.github.com>
2023-09-12 02:19:34 +00:00
15 changed files with 929 additions and 686 deletions

View File

@@ -187,6 +187,16 @@
"contributions": [
"doc"
]
},
{
"login": "V0lantis",
"name": "Arthur",
"avatar_url": "https://avatars.githubusercontent.com/u/37664438?v=4",
"profile": "https://arthurvolant.com",
"contributions": [
"bug",
"code"
]
}
],
"contributorsPerLine": 7,
@@ -195,5 +205,6 @@
"repoType": "github",
"repoHost": "https://github.com",
"skipCi": true,
"commitConvention": "angular"
"commitConvention": "angular",
"commitType": "docs"
}

4
.codacy.yml Normal file
View File

@@ -0,0 +1,4 @@
---
exclude_paths:
- "*.md"
- "dist/**"

View File

@@ -765,6 +765,12 @@ jobs:
echo "Expected: (test/test deleted.txt) got ${{ steps.changed-files-recover-deleted-files-with-files-yaml.outputs.test_deleted_files }}"
exit 1
- name: Verify that the modified_keys is correct
if: "!contains(steps.changed-files-recover-deleted-files-with-files-yaml.outputs.modified_keys, 'test')"
run: |
echo "Expected: (test) got ${{ steps.changed-files-recover-deleted-files-with-files-yaml.outputs.modified_keys }}"
exit 1
- name: Verify that test/test deleted.txt is restored
run: |
if [ ! -f "test/test deleted.txt" ]; then
@@ -839,7 +845,7 @@ jobs:
since_last_remote_commit: true
- name: Verify failed
if: steps.changed-files-since-last-remote-commit.outcome != 'failure' && matrix.fetch-depth == 1 && github.event_name != 'push'
if: steps.changed-files-since-last-remote-commit.outcome != 'failure' && matrix.fetch-depth == 1 && github.event.action == 'closed' && github.event_name == 'pull_request'
run: |
echo "Expected: (failure) got ${{ steps.changed-files-since-last-remote-commit.outcome }}"
exit 1

View File

@@ -1,5 +1,114 @@
# Changelog
# [39.1.1](https://github.com/tj-actions/changed-files/compare/v39.1.0...v39.1.1) - (2023-09-19)
## <!-- 1 -->🐛 Bug Fixes
- Changed_keys and modified_keys output to handle json and escape_json inputs ([#1585](https://github.com/tj-actions/changed-files/issues/1585)) ([951140b](https://github.com/tj-actions/changed-files/commit/951140b94a6a58dd2c62d7fb0b4d73898c79b196)) - (Arthur)
- Error with test ([#1589](https://github.com/tj-actions/changed-files/issues/1589)) ([dbf0700](https://github.com/tj-actions/changed-files/commit/dbf0700c7ac336b1ceed2ac8fe1b02d4cd3ac84f)) - (Tonye Jack)
## <!-- 26 -->🔄 Update
- Update test.yml ([a21a533](https://github.com/tj-actions/changed-files/commit/a21a533a0c244a27daac02f9dc6fcf8aeb996154)) - (Tonye Jack)
- Updated README.md ([#1588](https://github.com/tj-actions/changed-files/issues/1588))
Co-authored-by: jackton1 <jackton1@users.noreply.github.com> ([dacbaeb](https://github.com/tj-actions/changed-files/commit/dacbaebcaf9428d083702ffa9b449bac799dd2c3)) - (tj-actions[bot])
## <!-- 3 -->📚 Documentation
- Add V0lantis as a contributor for bug ([#1587](https://github.com/tj-actions/changed-files/issues/1587)) ([36ab2fe](https://github.com/tj-actions/changed-files/commit/36ab2fe9c2c58212caac6853d9b8e205a4d5c84b)) - (allcontributors[bot])
## <!-- 7 -->⚙️ Miscellaneous Tasks
- Add codacy config ([#1590](https://github.com/tj-actions/changed-files/issues/1590)) ([eeb169a](https://github.com/tj-actions/changed-files/commit/eeb169a9f925d0d92ff3dea3ac356ff0d5f288a8)) - (Tonye Jack)
- Update test.yml ([#1586](https://github.com/tj-actions/changed-files/issues/1586)) ([7e3a4ba](https://github.com/tj-actions/changed-files/commit/7e3a4bac80a0d6fdd60b44fea0dc5fa781ca8177)) - (Tonye Jack)
- Move variable declaration ([#1584](https://github.com/tj-actions/changed-files/issues/1584)) ([dcbe980](https://github.com/tj-actions/changed-files/commit/dcbe9805f4bb9e5128d8c802e2517943b4c09aa0)) - (Tonye Jack)
## <!-- 9 -->⬆️ Upgrades
- Upgraded to v39.1.0 ([#1583](https://github.com/tj-actions/changed-files/issues/1583))
Co-authored-by: jackton1 <jackton1@users.noreply.github.com> ([fd73c12](https://github.com/tj-actions/changed-files/commit/fd73c1248c8bebea8b243083223002698432c2a0)) - (tj-actions[bot])
# [39.1.0](https://github.com/tj-actions/changed-files/compare/v39.0.3...v39.1.0) - (2023-09-18)
## <!-- 0 -->🚀 Features
- Add support for returning YAML keys for paths that have changed ([#1581](https://github.com/tj-actions/changed-files/issues/1581)) ([5db7b57](https://github.com/tj-actions/changed-files/commit/5db7b578d50867ab5781bf9d867e7650b5b39fc4)) - (Tonye Jack)
## <!-- 26 -->🔄 Update
- Updated README.md ([#1582](https://github.com/tj-actions/changed-files/issues/1582))
Co-authored-by: repo-ranger[bot] <repo-ranger[bot]@users.noreply.github.com> ([8e79ba7](https://github.com/tj-actions/changed-files/commit/8e79ba7ab9fee9984275219aeb2c8db47bcb8a2d)) - (tj-actions[bot])
## <!-- 7 -->⚙️ Miscellaneous Tasks
- **deps:** Update typescript-eslint monorepo to v6.7.2 ([a17e8c5](https://github.com/tj-actions/changed-files/commit/a17e8c5252f6c9982b161714c528708a7f445479)) - (renovate[bot])
- **deps:** Lock file maintenance ([d1e9506](https://github.com/tj-actions/changed-files/commit/d1e9506b19d9c3a4053191d616b1ac09de1dfa55)) - (renovate[bot])
## <!-- 9 -->⬆️ Upgrades
- Upgraded to v39.0.3 ([#1577](https://github.com/tj-actions/changed-files/issues/1577))
Co-authored-by: jackton1 <jackton1@users.noreply.github.com> ([1fdfe09](https://github.com/tj-actions/changed-files/commit/1fdfe0928a9a55323f0d333ecf6ccfca8c6d73c9)) - (tj-actions[bot])
# [39.0.3](https://github.com/tj-actions/changed-files/compare/v39.0.2...v39.0.3) - (2023-09-17)
## <!-- 26 -->🔄 Update
- Updated README.md ([#1570](https://github.com/tj-actions/changed-files/issues/1570))
Co-authored-by: jackton1 <jackton1@users.noreply.github.com> ([e8e6614](https://github.com/tj-actions/changed-files/commit/e8e66147790920052eb3032cb5a62c70572bae22)) - (tj-actions[bot])
- Update README.md ([ad4b06d](https://github.com/tj-actions/changed-files/commit/ad4b06d99998aabe50aa36b86f0867357026a7e2)) - (Tonye Jack)
- Update README.md ([b1a34eb](https://github.com/tj-actions/changed-files/commit/b1a34eb336292345947ec693f02ef5fb59954683)) - (Tonye Jack)
- Updated README.md ([#1566](https://github.com/tj-actions/changed-files/issues/1566))
Co-authored-by: repo-ranger[bot] <repo-ranger[bot]@users.noreply.github.com> ([690bef6](https://github.com/tj-actions/changed-files/commit/690bef673ae8df0db1deff98f4c33c8f651ce3b9)) - (tj-actions[bot])
- Update README.md ([bb3b39c](https://github.com/tj-actions/changed-files/commit/bb3b39cd33dab0e736e0f00b67222c3edaaea664)) - (Tonye Jack)
## <!-- 7 -->⚙️ Miscellaneous Tasks
- Cleanup imports ([#1576](https://github.com/tj-actions/changed-files/issues/1576)) ([76c4d81](https://github.com/tj-actions/changed-files/commit/76c4d81a6acd339b55bd7407a016981c853eb702)) - (Tonye Jack)
- Refactor function ([#1572](https://github.com/tj-actions/changed-files/issues/1572)) ([d8904df](https://github.com/tj-actions/changed-files/commit/d8904df6c55e24ee0b072a93387f64ab19b03302)) - (Tonye Jack)
- **deps:** Update dependency @types/node to v20.6.2 ([662c03e](https://github.com/tj-actions/changed-files/commit/662c03ea61a144e0bb71991d27928fe08897109f)) - (renovate[bot])
- **deps:** Update dependency eslint-plugin-jest to v27.4.0 ([c8b7da7](https://github.com/tj-actions/changed-files/commit/c8b7da7226d05c69f882473d9bc05af8475f28fc)) - (renovate[bot])
- **deps:** Update dependency @types/jest to v29.5.5 ([249c169](https://github.com/tj-actions/changed-files/commit/249c1698c5b04bfa024f0af7fa876952cc638660)) - (renovate[bot])
- **deps:** Update dependency @types/node to v20.6.1 ([17352b2](https://github.com/tj-actions/changed-files/commit/17352b21768e018a02c594a8c7b151d0002e5d73)) - (renovate[bot])
- Update README.md ([#1569](https://github.com/tj-actions/changed-files/issues/1569)) ([d9a6ccb](https://github.com/tj-actions/changed-files/commit/d9a6ccb099927ca383d6bf06d0d44e3a4cc03dd9)) - (Tonye Jack)
- **deps:** Update dependency @types/uuid to v9.0.4 ([090eb05](https://github.com/tj-actions/changed-files/commit/090eb05f17c92a8e9b30d65ca4abe71ea35d8671)) - (renovate[bot])
- Update input description ([#1565](https://github.com/tj-actions/changed-files/issues/1565)) ([fb8d2c9](https://github.com/tj-actions/changed-files/commit/fb8d2c9c29d888bc338bd0b5cd23a78f8fd04baa)) - (Tonye Jack)
- **deps:** Update dependency jest to v29.7.0 ([001f562](https://github.com/tj-actions/changed-files/commit/001f56257c66815ba8267ded5207cc6feeb3c4fd)) - (renovate[bot])
## <!-- 9 -->⬆️ Upgrades
- Upgraded to v39.0.2 ([#1563](https://github.com/tj-actions/changed-files/issues/1563))
Co-authored-by: jackton1 <jackton1@users.noreply.github.com> ([57245a9](https://github.com/tj-actions/changed-files/commit/57245a97217e7a73240a81d75f5b3f4d9dc7fb04)) - (tj-actions[bot])
# [39.0.2](https://github.com/tj-actions/changed-files/compare/v39.0.1...v39.0.2) - (2023-09-11)
## <!-- 1 -->🐛 Bug Fixes
- **deps:** Update dependency @actions/core to v1.10.1 ([7e3122d](https://github.com/tj-actions/changed-files/commit/7e3122dc950f53aecf77675b13eb8549fc50702d)) - (renovate[bot])
## <!-- 16 --> Add
- Added missing changes and modified dist assets.
([dc40835](https://github.com/tj-actions/changed-files/commit/dc40835d4da682fdd0d708a18736c67f61dd30bd)) - (GitHub Action)
## <!-- 7 -->⚙️ Miscellaneous Tasks
- **deps:** Update typescript-eslint monorepo to v6.7.0 ([6ee9cdc](https://github.com/tj-actions/changed-files/commit/6ee9cdc5816333acda68e01cf12eedc619e28316)) - (renovate[bot])
- **deps:** Lock file maintenance ([0734795](https://github.com/tj-actions/changed-files/commit/073479583b8aa435de99bca59cf0f1d7c9ca60f1)) - (renovate[bot])
- **deps:** Lock file maintenance ([d76ddee](https://github.com/tj-actions/changed-files/commit/d76ddeeeaafef4ed076ba691b79b2ce022583e29)) - (renovate[bot])
## <!-- 9 -->⬆️ Upgrades
- Upgraded to v39.0.1 ([#1557](https://github.com/tj-actions/changed-files/issues/1557))
Co-authored-by: jackton1 <jackton1@users.noreply.github.com> ([7cdc56d](https://github.com/tj-actions/changed-files/commit/7cdc56dd7a1e035be75e46b4023543b68e58a0ac)) - (tj-actions[bot])
# [39.0.1](https://github.com/tj-actions/changed-files/compare/v39.0.0...v39.0.1) - (2023-09-09)
## <!-- 1 -->🐛 Bug Fixes

View File

@@ -9,7 +9,7 @@
<!-- ALL-CONTRIBUTORS-BADGE:START - Do not remove or modify this section -->
[![All Contributors](https://img.shields.io/badge/all_contributors-20-orange.svg?style=flat-square)](#contributors-)
[![All Contributors](https://img.shields.io/badge/all_contributors-21-orange.svg?style=flat-square)](#contributors-)
<!-- ALL-CONTRIBUTORS-BADGE:END -->
@@ -69,8 +69,8 @@ Effortlessly track all changed files and directories relative to a target branch
* Supports brace expansion.
* Supports negation.
* Uses [YAML](https://yaml.org/) syntax for specifying patterns.
* Supports [YAML anchors & aliases](https://www.educative.io/blog/advanced-yaml-syntax-cheatsheet#anchors).
* Supports [YAML multi-line strings](https://learnxinyminutes.com/docs/yaml/).
* Supports [YAML anchors & aliases](https://github.com/tj-actions/changed-files/blob/main/test/changed-files.yml#L8-L12).
* Supports [YAML multi-line strings](https://github.com/tj-actions/changed-files/blob/main/test/changed-files.yml#L13-L16).
And many more...
@@ -88,6 +88,8 @@ Visit the [discussions for more information](https://github.com/tj-actions/chang
### On `pull_request` 🔀
Detect changes to all files in a Pull request relative to the target branch or since the last pushed commit.
#### Using local .git history 📁
```yaml
@@ -209,6 +211,8 @@ jobs:
### On `push` ⬆️
Detect changes to files made since the last pushed commit.
```yaml
name: CI
@@ -255,7 +259,6 @@ jobs:
with:
fetch-depth: 0 # OR "2" -> To retrieve the preceding commit.
# Example 1
- name: Get changed files
id: changed-files
uses: tj-actions/changed-files@v39
@@ -267,11 +270,6 @@ jobs:
for file in ${{ steps.changed-files.outputs.all_changed_files }}; do
echo "$file was changed"
done
# Example 2: See above
...
# Example 3: See above
...
```
@@ -321,23 +319,25 @@ Support this project with a :star:
| <a name="output_all_modified_files_count"></a>[all\_modified\_files\_count](#output_all_modified_files_count) | string | Returns the number of `all_modified_files` |
| <a name="output_all_old_new_renamed_files"></a>[all\_old\_new\_renamed\_files](#output_all_old_new_renamed_files) | string | Returns only files that are <br>Renamed and lists their old <br>and new names. **NOTE:** This <br>requires setting `include_all_old_new_renamed_files` to `true`. <br>Also, keep in mind that <br>this output is global and <br>wouldn't be nested in outputs <br>generated when the `*_yaml_*` input <br>is used. (R) |
| <a name="output_all_old_new_renamed_files_count"></a>[all\_old\_new\_renamed\_files\_count](#output_all_old_new_renamed_files_count) | string | Returns the number of `all_old_new_renamed_files` |
| <a name="output_any_changed"></a>[any\_changed](#output_any_changed) | string | Returns `true` when any of <br>the filenames provided using the <br>`files*` or `files_ignore*` inputs has changed. i.e. <br>*using a combination of all added, copied, modified and renamed files (ACMR)*. |
| <a name="output_any_changed"></a>[any\_changed](#output_any_changed) | string | Returns `true` when any of <br>the filenames provided using the <br>`files*` or `files_ignore*` inputs has changed. i.e. <br>*includes a combination of all added, copied, modified and renamed files (ACMR)*. |
| <a name="output_any_deleted"></a>[any\_deleted](#output_any_deleted) | string | Returns `true` when any of <br>the filenames provided using the <br>`files*` or `files_ignore*` inputs has been deleted. <br>(D) |
| <a name="output_any_modified"></a>[any\_modified](#output_any_modified) | string | Returns `true` when any of <br>the filenames provided using the <br>`files*` or `files_ignore*` inputs has been modified. <br>i.e. *using a combination of all added, copied, modified, renamed, and deleted files (ACMRD)*. |
| <a name="output_any_modified"></a>[any\_modified](#output_any_modified) | string | Returns `true` when any of <br>the filenames provided using the <br>`files*` or `files_ignore*` inputs has been modified. <br>i.e. *includes a combination of all added, copied, modified, renamed, and deleted files (ACMRD)*. |
| <a name="output_changed_keys"></a>[changed\_keys](#output_changed_keys) | string | Returns all changed YAML keys <br>when the `files_yaml` input is <br>used. i.e. *key that contains any path that has either been added, copied, modified, and renamed (ACMR)* |
| <a name="output_copied_files"></a>[copied\_files](#output_copied_files) | string | Returns only files that are <br>Copied (C). |
| <a name="output_copied_files_count"></a>[copied\_files\_count](#output_copied_files_count) | string | Returns the number of `copied_files` |
| <a name="output_deleted_files"></a>[deleted\_files](#output_deleted_files) | string | Returns only files that are <br>Deleted (D). |
| <a name="output_deleted_files_count"></a>[deleted\_files\_count](#output_deleted_files_count) | string | Returns the number of `deleted_files` |
| <a name="output_modified_files"></a>[modified\_files](#output_modified_files) | string | Returns only files that are <br>Modified (M). |
| <a name="output_modified_files_count"></a>[modified\_files\_count](#output_modified_files_count) | string | Returns the number of `modified_files` |
| <a name="output_only_changed"></a>[only\_changed](#output_only_changed) | string | Returns `true` when only files <br>provided using the `files*` or `files_ignore*` inputs <br>has changed. i.e. *using a combination of all added, copied, modified and renamed files (ACMR)*. |
| <a name="output_modified_keys"></a>[modified\_keys](#output_modified_keys) | string | Returns all modified YAML keys <br>when the `files_yaml` input is <br>used. i.e. *key that contains any path that has either been added, copied, modified, and deleted (ACMRD)* |
| <a name="output_only_changed"></a>[only\_changed](#output_only_changed) | string | Returns `true` when only files <br>provided using the `files*` or `files_ignore*` inputs <br>has changed. i.e. *includes a combination of all added, copied, modified and renamed files (ACMR)*. |
| <a name="output_only_deleted"></a>[only\_deleted](#output_only_deleted) | string | Returns `true` when only files <br>provided using the `files*` or `files_ignore*` inputs <br>has been deleted. (D) |
| <a name="output_only_modified"></a>[only\_modified](#output_only_modified) | string | Returns `true` when only files <br>provided using the `files*` or `files_ignore*` inputs <br>has been modified. (ACMRD). |
| <a name="output_other_changed_files"></a>[other\_changed\_files](#output_other_changed_files) | string | Returns all other changed files <br>not listed in the files <br>input i.e. *using a combination of all added, copied, modified and renamed files (ACMR)*. |
| <a name="output_other_changed_files"></a>[other\_changed\_files](#output_other_changed_files) | string | Returns all other changed files <br>not listed in the files <br>input i.e. *includes a combination of all added, copied, modified and renamed files (ACMR)*. |
| <a name="output_other_changed_files_count"></a>[other\_changed\_files\_count](#output_other_changed_files_count) | string | Returns the number of `other_changed_files` |
| <a name="output_other_deleted_files"></a>[other\_deleted\_files](#output_other_deleted_files) | string | Returns all other deleted files <br>not listed in the files <br>input i.e. *a combination of all deleted files (D)* |
| <a name="output_other_deleted_files_count"></a>[other\_deleted\_files\_count](#output_other_deleted_files_count) | string | Returns the number of `other_deleted_files` |
| <a name="output_other_modified_files"></a>[other\_modified\_files](#output_other_modified_files) | string | Returns all other modified files <br>not listed in the files <br>input i.e. *a combination of all added, copied, modified, and deleted files (ACMRD)* |
| <a name="output_other_modified_files"></a>[other\_modified\_files](#output_other_modified_files) | string | Returns all other modified files <br>not listed in the files <br>input i.e. *a combination of all added, copied, modified, and deleted files (ACMRD)* |
| <a name="output_other_modified_files_count"></a>[other\_modified\_files\_count](#output_other_modified_files_count) | string | Returns the number of `other_modified_files` |
| <a name="output_renamed_files"></a>[renamed\_files](#output_renamed_files) | string | Returns only files that are <br>Renamed (R). |
| <a name="output_renamed_files_count"></a>[renamed\_files\_count](#output_renamed_files_count) | string | Returns the number of `renamed_files` |
@@ -1011,6 +1011,7 @@ Thanks goes to these wonderful people ([emoji key](https://allcontributors.org/d
<td align="center" valign="top" width="14.28%"><a href="https://github.com/adonisgarciac"><img src="https://avatars.githubusercontent.com/u/71078987?v=4?s=100" width="100px;" alt="adonisgarciac"/><br /><sub><b>adonisgarciac</b></sub></a><br /><a href="https://github.com/tj-actions/changed-files/commits?author=adonisgarciac" title="Code">💻</a> <a href="https://github.com/tj-actions/changed-files/commits?author=adonisgarciac" title="Documentation">📖</a></td>
<td align="center" valign="top" width="14.28%"><a href="https://github.com/cfernhout"><img src="https://avatars.githubusercontent.com/u/22294606?v=4?s=100" width="100px;" alt="Chiel Fernhout"/><br /><sub><b>Chiel Fernhout</b></sub></a><br /><a href="https://github.com/tj-actions/changed-files/commits?author=cfernhout" title="Documentation">📖</a></td>
<td align="center" valign="top" width="14.28%"><a href="https://github.com/albertoperdomo2"><img src="https://avatars.githubusercontent.com/u/62241095?v=4?s=100" width="100px;" alt="Alberto Perdomo"/><br /><sub><b>Alberto Perdomo</b></sub></a><br /><a href="https://github.com/tj-actions/changed-files/commits?author=albertoperdomo2" title="Documentation">📖</a></td>
<td align="center" valign="top" width="14.28%"><a href="https://arthurvolant.com"><img src="https://avatars.githubusercontent.com/u/37664438?v=4?s=100" width="100px;" alt="Arthur"/><br /><sub><b>Arthur</b></sub></a><br /><a href="https://github.com/tj-actions/changed-files/issues?q=author%3AV0lantis" title="Bug reports">🐛</a> <a href="https://github.com/tj-actions/changed-files/commits?author=V0lantis" title="Code">💻</a></td>
</tr>
</tbody>
</table>

View File

@@ -243,11 +243,11 @@ outputs:
all_changed_files_count:
description: "Returns the number of `all_changed_files`"
any_changed:
description: "Returns `true` when any of the filenames provided using the `files*` or `files_ignore*` inputs has changed. i.e. *using a combination of all added, copied, modified and renamed files (ACMR)*."
description: "Returns `true` when any of the filenames provided using the `files*` or `files_ignore*` inputs has changed. i.e. *includes a combination of all added, copied, modified and renamed files (ACMR)*."
only_changed:
description: "Returns `true` when only files provided using the `files*` or `files_ignore*` inputs has changed. i.e. *using a combination of all added, copied, modified and renamed files (ACMR)*."
description: "Returns `true` when only files provided using the `files*` or `files_ignore*` inputs has changed. i.e. *includes a combination of all added, copied, modified and renamed files (ACMR)*."
other_changed_files:
description: "Returns all other changed files not listed in the files input i.e. *using a combination of all added, copied, modified and renamed files (ACMR)*."
description: "Returns all other changed files not listed in the files input i.e. *includes a combination of all added, copied, modified and renamed files (ACMR)*."
other_changed_files_count:
description: "Returns the number of `other_changed_files`"
all_modified_files:
@@ -255,11 +255,11 @@ outputs:
all_modified_files_count:
description: "Returns the number of `all_modified_files`"
any_modified:
description: "Returns `true` when any of the filenames provided using the `files*` or `files_ignore*` inputs has been modified. i.e. *using a combination of all added, copied, modified, renamed, and deleted files (ACMRD)*."
description: "Returns `true` when any of the filenames provided using the `files*` or `files_ignore*` inputs has been modified. i.e. *includes a combination of all added, copied, modified, renamed, and deleted files (ACMRD)*."
only_modified:
description: "Returns `true` when only files provided using the `files*` or `files_ignore*` inputs has been modified. (ACMRD)."
other_modified_files:
description: "Returns all other modified files not listed in the files input i.e. *a combination of all added, copied, modified, and deleted files (ACMRD)*"
description: "Returns all other modified files not listed in the files input i.e. *a combination of all added, copied, modified, and deleted files (ACMRD)*"
other_modified_files_count:
description: "Returns the number of `other_modified_files`"
any_deleted:
@@ -270,6 +270,10 @@ outputs:
description: "Returns all other deleted files not listed in the files input i.e. *a combination of all deleted files (D)*"
other_deleted_files_count:
description: "Returns the number of `other_deleted_files`"
modified_keys:
description: "Returns all modified YAML keys when the `files_yaml` input is used. i.e. *key that contains any path that has either been added, copied, modified, and deleted (ACMRD)*"
changed_keys:
description: "Returns all changed YAML keys when the `files_yaml` input is used. i.e. *key that contains any path that has either been added, copied, modified, and renamed (ACMR)*"
runs:
using: 'node20'

266
dist/index.js generated vendored
View File

@@ -49,13 +49,84 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
return (mod && mod.__esModule) ? mod : { "default": mod };
};
Object.defineProperty(exports, "__esModule", ({ value: true }));
exports.getChangedFilesFromGithubAPI = exports.getAllChangeTypeFiles = exports.getChangeTypeFiles = exports.getAllDiffFiles = exports.ChangeTypeEnum = exports.getRenamedFiles = void 0;
exports.getChangedFilesFromGithubAPI = exports.getAllChangeTypeFiles = exports.getChangeTypeFiles = exports.getAllDiffFiles = exports.ChangeTypeEnum = exports.getRenamedFiles = exports.processChangedFiles = void 0;
const core = __importStar(__nccwpck_require__(2186));
const github = __importStar(__nccwpck_require__(5438));
const flatten_1 = __importDefault(__nccwpck_require__(2394));
const micromatch_1 = __importDefault(__nccwpck_require__(6228));
const path = __importStar(__nccwpck_require__(1017));
const changedFilesOutput_1 = __nccwpck_require__(8930);
const utils_1 = __nccwpck_require__(918);
const processChangedFiles = ({ filePatterns, allDiffFiles, inputs, yamlFilePatterns }) => __awaiter(void 0, void 0, void 0, function* () {
if (filePatterns.length > 0) {
core.startGroup('changed-files-patterns');
const allFilteredDiffFiles = yield (0, utils_1.getFilteredChangedFiles)({
allDiffFiles,
filePatterns
});
core.debug(`All filtered diff files: ${JSON.stringify(allFilteredDiffFiles)}`);
yield (0, changedFilesOutput_1.setOutputsAndGetModifiedAndChangedFilesStatus)({
allDiffFiles,
allFilteredDiffFiles,
inputs,
filePatterns
});
core.info('All Done!');
core.endGroup();
}
if (Object.keys(yamlFilePatterns).length > 0) {
const modifiedKeys = [];
const changedKeys = [];
for (const key of Object.keys(yamlFilePatterns)) {
core.startGroup(`changed-files-yaml-${key}`);
const allFilteredDiffFiles = yield (0, utils_1.getFilteredChangedFiles)({
allDiffFiles,
filePatterns: yamlFilePatterns[key]
});
core.debug(`All filtered diff files for ${key}: ${JSON.stringify(allFilteredDiffFiles)}`);
const { anyChanged, anyModified } = yield (0, changedFilesOutput_1.setOutputsAndGetModifiedAndChangedFilesStatus)({
allDiffFiles,
allFilteredDiffFiles,
inputs,
filePatterns: yamlFilePatterns[key],
outputPrefix: key
});
if (anyModified) {
modifiedKeys.push(key);
}
if (anyChanged) {
changedKeys.push(key);
}
core.info('All Done!');
core.endGroup();
}
if (modifiedKeys.length > 0) {
yield (0, utils_1.setArrayOutput)({
key: 'modified_keys',
inputs,
value: modifiedKeys
});
}
if (changedKeys.length > 0) {
yield (0, utils_1.setArrayOutput)({
key: 'changed_keys',
inputs,
value: changedKeys
});
}
}
if (filePatterns.length === 0 && Object.keys(yamlFilePatterns).length === 0) {
core.startGroup('changed-files-all');
yield (0, changedFilesOutput_1.setOutputsAndGetModifiedAndChangedFilesStatus)({
allDiffFiles,
allFilteredDiffFiles: allDiffFiles,
inputs
});
core.info('All Done!');
core.endGroup();
}
});
exports.processChangedFiles = processChangedFiles;
const getRenamedFiles = ({ inputs, workingDirectory, hasSubmodule, diffResult, submodulePaths }) => __awaiter(void 0, void 0, void 0, function* () {
const renamedFiles = yield (0, utils_1.gitRenamedFiles)({
cwd: workingDirectory,
@@ -356,17 +427,14 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge
});
};
Object.defineProperty(exports, "__esModule", ({ value: true }));
exports.setChangedFilesOutput = void 0;
exports.setOutputsAndGetModifiedAndChangedFilesStatus = void 0;
const core = __importStar(__nccwpck_require__(2186));
const changedFiles_1 = __nccwpck_require__(7358);
const utils_1 = __nccwpck_require__(918);
const getOutputKey = (key, outputPrefix) => {
return outputPrefix ? `${outputPrefix}_${key}` : key;
};
const getArrayFromPaths = (paths, inputs) => {
return Array.isArray(paths) ? paths : paths.split(inputs.separator);
};
const setChangedFilesOutput = ({ allDiffFiles, allFilteredDiffFiles, inputs, filePatterns = [], outputPrefix = '' }) => __awaiter(void 0, void 0, void 0, function* () {
const setOutputsAndGetModifiedAndChangedFilesStatus = ({ allDiffFiles, allFilteredDiffFiles, inputs, filePatterns = [], outputPrefix = '' }) => __awaiter(void 0, void 0, void 0, function* () {
const addedFiles = yield (0, changedFiles_1.getChangeTypeFiles)({
inputs,
changedFiles: allFilteredDiffFiles,
@@ -374,7 +442,7 @@ const setChangedFilesOutput = ({ allDiffFiles, allFilteredDiffFiles, inputs, fil
});
core.debug(`Added files: ${JSON.stringify(addedFiles)}`);
yield (0, utils_1.setOutput)({
key: getOutputKey('added_files', outputPrefix),
key: (0, utils_1.getOutputKey)('added_files', outputPrefix),
value: addedFiles.paths,
writeOutputFiles: inputs.writeOutputFiles,
outputDir: inputs.outputDir,
@@ -382,7 +450,7 @@ const setChangedFilesOutput = ({ allDiffFiles, allFilteredDiffFiles, inputs, fil
shouldEscape: inputs.escapeJson
});
yield (0, utils_1.setOutput)({
key: getOutputKey('added_files_count', outputPrefix),
key: (0, utils_1.getOutputKey)('added_files_count', outputPrefix),
value: addedFiles.count,
writeOutputFiles: inputs.writeOutputFiles,
outputDir: inputs.outputDir
@@ -394,7 +462,7 @@ const setChangedFilesOutput = ({ allDiffFiles, allFilteredDiffFiles, inputs, fil
});
core.debug(`Copied files: ${JSON.stringify(copiedFiles)}`);
yield (0, utils_1.setOutput)({
key: getOutputKey('copied_files', outputPrefix),
key: (0, utils_1.getOutputKey)('copied_files', outputPrefix),
value: copiedFiles.paths,
writeOutputFiles: inputs.writeOutputFiles,
outputDir: inputs.outputDir,
@@ -402,7 +470,7 @@ const setChangedFilesOutput = ({ allDiffFiles, allFilteredDiffFiles, inputs, fil
shouldEscape: inputs.escapeJson
});
yield (0, utils_1.setOutput)({
key: getOutputKey('copied_files_count', outputPrefix),
key: (0, utils_1.getOutputKey)('copied_files_count', outputPrefix),
value: copiedFiles.count,
writeOutputFiles: inputs.writeOutputFiles,
outputDir: inputs.outputDir
@@ -414,7 +482,7 @@ const setChangedFilesOutput = ({ allDiffFiles, allFilteredDiffFiles, inputs, fil
});
core.debug(`Modified files: ${JSON.stringify(modifiedFiles)}`);
yield (0, utils_1.setOutput)({
key: getOutputKey('modified_files', outputPrefix),
key: (0, utils_1.getOutputKey)('modified_files', outputPrefix),
value: modifiedFiles.paths,
writeOutputFiles: inputs.writeOutputFiles,
outputDir: inputs.outputDir,
@@ -422,7 +490,7 @@ const setChangedFilesOutput = ({ allDiffFiles, allFilteredDiffFiles, inputs, fil
shouldEscape: inputs.escapeJson
});
yield (0, utils_1.setOutput)({
key: getOutputKey('modified_files_count', outputPrefix),
key: (0, utils_1.getOutputKey)('modified_files_count', outputPrefix),
value: modifiedFiles.count,
writeOutputFiles: inputs.writeOutputFiles,
outputDir: inputs.outputDir
@@ -434,7 +502,7 @@ const setChangedFilesOutput = ({ allDiffFiles, allFilteredDiffFiles, inputs, fil
});
core.debug(`Renamed files: ${JSON.stringify(renamedFiles)}`);
yield (0, utils_1.setOutput)({
key: getOutputKey('renamed_files', outputPrefix),
key: (0, utils_1.getOutputKey)('renamed_files', outputPrefix),
value: renamedFiles.paths,
writeOutputFiles: inputs.writeOutputFiles,
outputDir: inputs.outputDir,
@@ -442,7 +510,7 @@ const setChangedFilesOutput = ({ allDiffFiles, allFilteredDiffFiles, inputs, fil
shouldEscape: inputs.escapeJson
});
yield (0, utils_1.setOutput)({
key: getOutputKey('renamed_files_count', outputPrefix),
key: (0, utils_1.getOutputKey)('renamed_files_count', outputPrefix),
value: renamedFiles.count,
writeOutputFiles: inputs.writeOutputFiles,
outputDir: inputs.outputDir
@@ -454,7 +522,7 @@ const setChangedFilesOutput = ({ allDiffFiles, allFilteredDiffFiles, inputs, fil
});
core.debug(`Type changed files: ${JSON.stringify(typeChangedFiles)}`);
yield (0, utils_1.setOutput)({
key: getOutputKey('type_changed_files', outputPrefix),
key: (0, utils_1.getOutputKey)('type_changed_files', outputPrefix),
value: typeChangedFiles.paths,
writeOutputFiles: inputs.writeOutputFiles,
outputDir: inputs.outputDir,
@@ -462,7 +530,7 @@ const setChangedFilesOutput = ({ allDiffFiles, allFilteredDiffFiles, inputs, fil
shouldEscape: inputs.escapeJson
});
yield (0, utils_1.setOutput)({
key: getOutputKey('type_changed_files_count', outputPrefix),
key: (0, utils_1.getOutputKey)('type_changed_files_count', outputPrefix),
value: typeChangedFiles.count,
writeOutputFiles: inputs.writeOutputFiles,
outputDir: inputs.outputDir
@@ -474,7 +542,7 @@ const setChangedFilesOutput = ({ allDiffFiles, allFilteredDiffFiles, inputs, fil
});
core.debug(`Unmerged files: ${JSON.stringify(unmergedFiles)}`);
yield (0, utils_1.setOutput)({
key: getOutputKey('unmerged_files', outputPrefix),
key: (0, utils_1.getOutputKey)('unmerged_files', outputPrefix),
value: unmergedFiles.paths,
writeOutputFiles: inputs.writeOutputFiles,
outputDir: inputs.outputDir,
@@ -482,7 +550,7 @@ const setChangedFilesOutput = ({ allDiffFiles, allFilteredDiffFiles, inputs, fil
shouldEscape: inputs.escapeJson
});
yield (0, utils_1.setOutput)({
key: getOutputKey('unmerged_files_count', outputPrefix),
key: (0, utils_1.getOutputKey)('unmerged_files_count', outputPrefix),
value: unmergedFiles.count,
writeOutputFiles: inputs.writeOutputFiles,
outputDir: inputs.outputDir
@@ -494,7 +562,7 @@ const setChangedFilesOutput = ({ allDiffFiles, allFilteredDiffFiles, inputs, fil
});
core.debug(`Unknown files: ${JSON.stringify(unknownFiles)}`);
yield (0, utils_1.setOutput)({
key: getOutputKey('unknown_files', outputPrefix),
key: (0, utils_1.getOutputKey)('unknown_files', outputPrefix),
value: unknownFiles.paths,
writeOutputFiles: inputs.writeOutputFiles,
outputDir: inputs.outputDir,
@@ -502,7 +570,7 @@ const setChangedFilesOutput = ({ allDiffFiles, allFilteredDiffFiles, inputs, fil
shouldEscape: inputs.escapeJson
});
yield (0, utils_1.setOutput)({
key: getOutputKey('unknown_files_count', outputPrefix),
key: (0, utils_1.getOutputKey)('unknown_files_count', outputPrefix),
value: unknownFiles.count,
writeOutputFiles: inputs.writeOutputFiles,
outputDir: inputs.outputDir
@@ -513,7 +581,7 @@ const setChangedFilesOutput = ({ allDiffFiles, allFilteredDiffFiles, inputs, fil
});
core.debug(`All changed and modified files: ${JSON.stringify(allChangedAndModifiedFiles)}`);
yield (0, utils_1.setOutput)({
key: getOutputKey('all_changed_and_modified_files', outputPrefix),
key: (0, utils_1.getOutputKey)('all_changed_and_modified_files', outputPrefix),
value: allChangedAndModifiedFiles.paths,
writeOutputFiles: inputs.writeOutputFiles,
outputDir: inputs.outputDir,
@@ -521,7 +589,7 @@ const setChangedFilesOutput = ({ allDiffFiles, allFilteredDiffFiles, inputs, fil
shouldEscape: inputs.escapeJson
});
yield (0, utils_1.setOutput)({
key: getOutputKey('all_changed_and_modified_files_count', outputPrefix),
key: (0, utils_1.getOutputKey)('all_changed_and_modified_files_count', outputPrefix),
value: allChangedAndModifiedFiles.count,
writeOutputFiles: inputs.writeOutputFiles,
outputDir: inputs.outputDir
@@ -538,7 +606,7 @@ const setChangedFilesOutput = ({ allDiffFiles, allFilteredDiffFiles, inputs, fil
});
core.debug(`All changed files: ${JSON.stringify(allChangedFiles)}`);
yield (0, utils_1.setOutput)({
key: getOutputKey('all_changed_files', outputPrefix),
key: (0, utils_1.getOutputKey)('all_changed_files', outputPrefix),
value: allChangedFiles.paths,
writeOutputFiles: inputs.writeOutputFiles,
outputDir: inputs.outputDir,
@@ -546,13 +614,13 @@ const setChangedFilesOutput = ({ allDiffFiles, allFilteredDiffFiles, inputs, fil
shouldEscape: inputs.escapeJson
});
yield (0, utils_1.setOutput)({
key: getOutputKey('all_changed_files_count', outputPrefix),
key: (0, utils_1.getOutputKey)('all_changed_files_count', outputPrefix),
value: allChangedFiles.count,
writeOutputFiles: inputs.writeOutputFiles,
outputDir: inputs.outputDir
});
yield (0, utils_1.setOutput)({
key: getOutputKey('any_changed', outputPrefix),
key: (0, utils_1.getOutputKey)('any_changed', outputPrefix),
value: allChangedFiles.paths.length > 0 && filePatterns.length > 0,
writeOutputFiles: inputs.writeOutputFiles,
outputDir: inputs.outputDir,
@@ -576,24 +644,20 @@ const setChangedFilesOutput = ({ allDiffFiles, allFilteredDiffFiles, inputs, fil
allChangedFiles.paths.length > 0 &&
filePatterns.length > 0;
yield (0, utils_1.setOutput)({
key: getOutputKey('only_changed', outputPrefix),
key: (0, utils_1.getOutputKey)('only_changed', outputPrefix),
value: onlyChanged,
writeOutputFiles: inputs.writeOutputFiles,
outputDir: inputs.outputDir,
json: inputs.json
});
yield (0, utils_1.setOutput)({
key: getOutputKey('other_changed_files', outputPrefix),
value: inputs.json
? otherChangedFiles
: otherChangedFiles.join(inputs.separator),
writeOutputFiles: inputs.writeOutputFiles,
outputDir: inputs.outputDir,
json: inputs.json,
shouldEscape: inputs.escapeJson
yield (0, utils_1.setArrayOutput)({
key: 'other_changed_files',
inputs,
value: otherChangedFiles,
outputPrefix
});
yield (0, utils_1.setOutput)({
key: getOutputKey('other_changed_files_count', outputPrefix),
key: (0, utils_1.getOutputKey)('other_changed_files_count', outputPrefix),
value: otherChangedFiles.length.toString(),
writeOutputFiles: inputs.writeOutputFiles,
outputDir: inputs.outputDir
@@ -611,7 +675,7 @@ const setChangedFilesOutput = ({ allDiffFiles, allFilteredDiffFiles, inputs, fil
});
core.debug(`All modified files: ${JSON.stringify(allModifiedFiles)}`);
yield (0, utils_1.setOutput)({
key: getOutputKey('all_modified_files', outputPrefix),
key: (0, utils_1.getOutputKey)('all_modified_files', outputPrefix),
value: allModifiedFiles.paths,
writeOutputFiles: inputs.writeOutputFiles,
outputDir: inputs.outputDir,
@@ -619,13 +683,13 @@ const setChangedFilesOutput = ({ allDiffFiles, allFilteredDiffFiles, inputs, fil
shouldEscape: inputs.escapeJson
});
yield (0, utils_1.setOutput)({
key: getOutputKey('all_modified_files_count', outputPrefix),
key: (0, utils_1.getOutputKey)('all_modified_files_count', outputPrefix),
value: allModifiedFiles.count,
writeOutputFiles: inputs.writeOutputFiles,
outputDir: inputs.outputDir
});
yield (0, utils_1.setOutput)({
key: getOutputKey('any_modified', outputPrefix),
key: (0, utils_1.getOutputKey)('any_modified', outputPrefix),
value: allModifiedFiles.paths.length > 0 && filePatterns.length > 0,
writeOutputFiles: inputs.writeOutputFiles,
outputDir: inputs.outputDir,
@@ -649,24 +713,20 @@ const setChangedFilesOutput = ({ allDiffFiles, allFilteredDiffFiles, inputs, fil
allModifiedFiles.paths.length > 0 &&
filePatterns.length > 0;
yield (0, utils_1.setOutput)({
key: getOutputKey('only_modified', outputPrefix),
key: (0, utils_1.getOutputKey)('only_modified', outputPrefix),
value: onlyModified,
writeOutputFiles: inputs.writeOutputFiles,
outputDir: inputs.outputDir,
json: inputs.json
});
yield (0, utils_1.setOutput)({
key: getOutputKey('other_modified_files', outputPrefix),
value: inputs.json
? otherModifiedFiles
: otherModifiedFiles.join(inputs.separator),
writeOutputFiles: inputs.writeOutputFiles,
outputDir: inputs.outputDir,
json: inputs.json,
shouldEscape: inputs.escapeJson
yield (0, utils_1.setArrayOutput)({
key: 'other_modified_files',
inputs,
value: otherModifiedFiles,
outputPrefix
});
yield (0, utils_1.setOutput)({
key: getOutputKey('other_modified_files_count', outputPrefix),
key: (0, utils_1.getOutputKey)('other_modified_files_count', outputPrefix),
value: otherModifiedFiles.length.toString(),
writeOutputFiles: inputs.writeOutputFiles,
outputDir: inputs.outputDir
@@ -678,7 +738,7 @@ const setChangedFilesOutput = ({ allDiffFiles, allFilteredDiffFiles, inputs, fil
});
core.debug(`Deleted files: ${JSON.stringify(deletedFiles)}`);
yield (0, utils_1.setOutput)({
key: getOutputKey('deleted_files', outputPrefix),
key: (0, utils_1.getOutputKey)('deleted_files', outputPrefix),
value: deletedFiles.paths,
writeOutputFiles: inputs.writeOutputFiles,
outputDir: inputs.outputDir,
@@ -686,13 +746,13 @@ const setChangedFilesOutput = ({ allDiffFiles, allFilteredDiffFiles, inputs, fil
shouldEscape: inputs.escapeJson
});
yield (0, utils_1.setOutput)({
key: getOutputKey('deleted_files_count', outputPrefix),
key: (0, utils_1.getOutputKey)('deleted_files_count', outputPrefix),
value: deletedFiles.count,
writeOutputFiles: inputs.writeOutputFiles,
outputDir: inputs.outputDir
});
yield (0, utils_1.setOutput)({
key: getOutputKey('any_deleted', outputPrefix),
key: (0, utils_1.getOutputKey)('any_deleted', outputPrefix),
value: deletedFiles.paths.length > 0 && filePatterns.length > 0,
writeOutputFiles: inputs.writeOutputFiles,
outputDir: inputs.outputDir,
@@ -710,30 +770,30 @@ const setChangedFilesOutput = ({ allDiffFiles, allFilteredDiffFiles, inputs, fil
deletedFiles.paths.length > 0 &&
filePatterns.length > 0;
yield (0, utils_1.setOutput)({
key: getOutputKey('only_deleted', outputPrefix),
key: (0, utils_1.getOutputKey)('only_deleted', outputPrefix),
value: onlyDeleted,
writeOutputFiles: inputs.writeOutputFiles,
outputDir: inputs.outputDir,
json: inputs.json
});
yield (0, utils_1.setOutput)({
key: getOutputKey('other_deleted_files', outputPrefix),
value: inputs.json
? otherDeletedFiles
: otherDeletedFiles.join(inputs.separator),
writeOutputFiles: inputs.writeOutputFiles,
outputDir: inputs.outputDir,
json: inputs.json,
shouldEscape: inputs.escapeJson
yield (0, utils_1.setArrayOutput)({
key: 'other_deleted_files',
inputs,
value: otherDeletedFiles,
outputPrefix
});
yield (0, utils_1.setOutput)({
key: getOutputKey('other_deleted_files_count', outputPrefix),
key: (0, utils_1.getOutputKey)('other_deleted_files_count', outputPrefix),
value: otherDeletedFiles.length.toString(),
writeOutputFiles: inputs.writeOutputFiles,
outputDir: inputs.outputDir
});
return {
anyModified: allModifiedFiles.paths.length > 0 && filePatterns.length > 0,
anyChanged: allChangedFiles.paths.length > 0 && filePatterns.length > 0
};
});
exports.setChangedFilesOutput = setChangedFilesOutput;
exports.setOutputsAndGetModifiedAndChangedFilesStatus = setOutputsAndGetModifiedAndChangedFilesStatus;
/***/ }),
@@ -1201,6 +1261,8 @@ const getSHAForPullRequestEvent = (inputs, env, workingDirectory, isShallow, has
sha2: currentSha,
diff
}))) {
core.warning('If this pull request is from a forked repository, please set the checkout action `repository` input to the same repository as the pull request.');
core.warning('This can be done by setting actions/checkout `repository` to ${{ github.event.pull_request.head.repo.full_name }}');
throw new Error(`Unable to determine a difference between ${previousSha}${diff}${currentSha}`);
}
if (previousSha === currentSha) {
@@ -1541,59 +1603,11 @@ const core = __importStar(__nccwpck_require__(2186));
const github = __importStar(__nccwpck_require__(5438));
const path_1 = __importDefault(__nccwpck_require__(1017));
const changedFiles_1 = __nccwpck_require__(7358);
const changedFilesOutput_1 = __nccwpck_require__(8930);
const commitSha_1 = __nccwpck_require__(8613);
const env_1 = __nccwpck_require__(9763);
const inputs_1 = __nccwpck_require__(6180);
const utils_1 = __nccwpck_require__(918);
const changedFilesOutput = ({ filePatterns, allDiffFiles, inputs, yamlFilePatterns }) => __awaiter(void 0, void 0, void 0, function* () {
if (filePatterns.length > 0) {
core.startGroup('changed-files-patterns');
const allFilteredDiffFiles = yield (0, utils_1.getFilteredChangedFiles)({
allDiffFiles,
filePatterns
});
core.debug(`All filtered diff files: ${JSON.stringify(allFilteredDiffFiles)}`);
yield (0, changedFilesOutput_1.setChangedFilesOutput)({
allDiffFiles,
allFilteredDiffFiles,
inputs,
filePatterns
});
core.info('All Done!');
core.endGroup();
}
if (Object.keys(yamlFilePatterns).length > 0) {
for (const key of Object.keys(yamlFilePatterns)) {
core.startGroup(`changed-files-yaml-${key}`);
const allFilteredDiffFiles = yield (0, utils_1.getFilteredChangedFiles)({
allDiffFiles,
filePatterns: yamlFilePatterns[key]
});
core.debug(`All filtered diff files for ${key}: ${JSON.stringify(allFilteredDiffFiles)}`);
yield (0, changedFilesOutput_1.setChangedFilesOutput)({
allDiffFiles,
allFilteredDiffFiles,
inputs,
filePatterns: yamlFilePatterns[key],
outputPrefix: key
});
core.info('All Done!');
core.endGroup();
}
}
if (filePatterns.length === 0 && Object.keys(yamlFilePatterns).length === 0) {
core.startGroup('changed-files-all');
yield (0, changedFilesOutput_1.setChangedFilesOutput)({
allDiffFiles,
allFilteredDiffFiles: allDiffFiles,
inputs
});
core.info('All Done!');
core.endGroup();
}
});
const getChangedFilesFromLocalGit = ({ inputs, env, workingDirectory, filePatterns, yamlFilePatterns }) => __awaiter(void 0, void 0, void 0, function* () {
const getChangedFilesFromLocalGitHistory = ({ inputs, env, workingDirectory, filePatterns, yamlFilePatterns }) => __awaiter(void 0, void 0, void 0, function* () {
var _a, _b, _c;
yield (0, utils_1.verifyMinimumGitVersion)();
let quotePathValue = 'on';
@@ -1664,7 +1678,7 @@ const getChangedFilesFromLocalGit = ({ inputs, env, workingDirectory, filePatter
sha: diffResult.previousSha
});
}
yield changedFilesOutput({
yield (0, changedFiles_1.processChangedFiles)({
filePatterns,
allDiffFiles,
inputs,
@@ -1704,7 +1718,7 @@ const getChangedFilesFromRESTAPI = ({ inputs, filePatterns, yamlFilePatterns })
});
core.debug(`All diff files: ${JSON.stringify(allDiffFiles)}`);
core.info('All Done!');
yield changedFilesOutput({
yield (0, changedFiles_1.processChangedFiles)({
filePatterns,
allDiffFiles,
inputs,
@@ -1769,7 +1783,7 @@ function run() {
return;
}
core.info('Using local .git directory');
yield getChangedFilesFromLocalGit({
yield getChangedFilesFromLocalGitHistory({
inputs,
env,
workingDirectory,
@@ -1851,7 +1865,7 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
return (mod && mod.__esModule) ? mod : { "default": mod };
};
Object.defineProperty(exports, "__esModule", ({ value: true }));
exports.hasLocalGitDirectory = exports.recoverDeletedFiles = exports.setOutput = exports.getRecoverFilePatterns = exports.getYamlFilePatterns = exports.getFilePatterns = exports.getDirNamesIncludeFilesPattern = exports.jsonOutput = exports.getDirnameMaxDepth = exports.canDiffCommits = exports.getPreviousGitTag = exports.verifyCommitSha = exports.getParentSha = exports.getRemoteBranchHeadSha = exports.isInsideWorkTree = exports.getHeadSha = exports.gitLog = exports.getFilteredChangedFiles = exports.getAllChangedFiles = exports.gitRenamedFiles = exports.gitSubmoduleDiffSHA = exports.getSubmodulePath = exports.gitFetchSubmodules = exports.gitFetch = exports.submoduleExists = exports.isRepoShallow = exports.updateGitGlobalConfig = exports.verifyMinimumGitVersion = exports.getDirname = exports.normalizeSeparators = exports.isWindows = void 0;
exports.hasLocalGitDirectory = exports.recoverDeletedFiles = exports.setOutput = exports.setArrayOutput = exports.getOutputKey = exports.getRecoverFilePatterns = exports.getYamlFilePatterns = exports.getFilePatterns = exports.getDirNamesIncludeFilesPattern = exports.jsonOutput = exports.getDirnameMaxDepth = exports.canDiffCommits = exports.getPreviousGitTag = exports.verifyCommitSha = exports.getParentSha = exports.getRemoteBranchHeadSha = exports.isInsideWorkTree = exports.getHeadSha = exports.gitLog = exports.getFilteredChangedFiles = exports.getAllChangedFiles = exports.gitRenamedFiles = exports.gitSubmoduleDiffSHA = exports.getSubmodulePath = exports.gitFetchSubmodules = exports.gitFetch = exports.submoduleExists = exports.isRepoShallow = exports.updateGitGlobalConfig = exports.verifyMinimumGitVersion = exports.getDirname = exports.normalizeSeparators = exports.isWindows = void 0;
/*global AsyncIterableIterator*/
const core = __importStar(__nccwpck_require__(2186));
const exec = __importStar(__nccwpck_require__(1514));
@@ -2672,6 +2686,22 @@ const getRecoverFilePatterns = ({ inputs }) => {
return filePatterns.filter(Boolean);
};
exports.getRecoverFilePatterns = getRecoverFilePatterns;
const getOutputKey = (key, outputPrefix) => {
return outputPrefix ? `${outputPrefix}_${key}` : key;
};
exports.getOutputKey = getOutputKey;
const setArrayOutput = ({ key, inputs, value, outputPrefix }) => __awaiter(void 0, void 0, void 0, function* () {
core.debug(`${key}: ${JSON.stringify(value)}`);
yield (0, exports.setOutput)({
key: outputPrefix ? (0, exports.getOutputKey)(key, outputPrefix) : key,
value: inputs.json ? value : value.join(inputs.separator),
writeOutputFiles: inputs.writeOutputFiles,
outputDir: inputs.outputDir,
json: inputs.json,
shouldEscape: inputs.escapeJson
});
});
exports.setArrayOutput = setArrayOutput;
const setOutput = ({ key, value, writeOutputFiles, outputDir, json = false, shouldEscape = false }) => __awaiter(void 0, void 0, void 0, function* () {
let cleanedValue;
if (json) {

2
dist/index.js.map generated vendored

File diff suppressed because one or more lines are too long

View File

@@ -1,6 +1,6 @@
{
"name": "@tj-actions/changed-files",
"version": "39.0.1",
"version": "39.1.1",
"description": "Github action to retrieve all (added, copied, modified, deleted, renamed, type changed, unmerged, unknown) files and directories.",
"main": "lib/main.js",
"publishConfig": {

View File

@@ -4,7 +4,7 @@ import type {RestEndpointMethodTypes} from '@octokit/rest'
import flatten from 'lodash/flatten'
import mm from 'micromatch'
import * as path from 'path'
import {setOutputsAndGetModifiedAndChangedFilesStatus} from './changedFilesOutput'
import {DiffResult} from './commitSha'
import {Inputs} from './inputs'
import {
@@ -12,12 +12,107 @@ import {
getAllChangedFiles,
getDirnameMaxDepth,
getDirNamesIncludeFilesPattern,
getFilteredChangedFiles,
gitRenamedFiles,
gitSubmoduleDiffSHA,
isWindows,
jsonOutput
jsonOutput,
setArrayOutput
} from './utils'
export const processChangedFiles = async ({
filePatterns,
allDiffFiles,
inputs,
yamlFilePatterns
}: {
filePatterns: string[]
allDiffFiles: ChangedFiles
inputs: Inputs
yamlFilePatterns: Record<string, string[]>
}): Promise<void> => {
if (filePatterns.length > 0) {
core.startGroup('changed-files-patterns')
const allFilteredDiffFiles = await getFilteredChangedFiles({
allDiffFiles,
filePatterns
})
core.debug(
`All filtered diff files: ${JSON.stringify(allFilteredDiffFiles)}`
)
await setOutputsAndGetModifiedAndChangedFilesStatus({
allDiffFiles,
allFilteredDiffFiles,
inputs,
filePatterns
})
core.info('All Done!')
core.endGroup()
}
if (Object.keys(yamlFilePatterns).length > 0) {
const modifiedKeys: string[] = []
const changedKeys: string[] = []
for (const key of Object.keys(yamlFilePatterns)) {
core.startGroup(`changed-files-yaml-${key}`)
const allFilteredDiffFiles = await getFilteredChangedFiles({
allDiffFiles,
filePatterns: yamlFilePatterns[key]
})
core.debug(
`All filtered diff files for ${key}: ${JSON.stringify(
allFilteredDiffFiles
)}`
)
const {anyChanged, anyModified} =
await setOutputsAndGetModifiedAndChangedFilesStatus({
allDiffFiles,
allFilteredDiffFiles,
inputs,
filePatterns: yamlFilePatterns[key],
outputPrefix: key
})
if (anyModified) {
modifiedKeys.push(key)
}
if (anyChanged) {
changedKeys.push(key)
}
core.info('All Done!')
core.endGroup()
}
if (modifiedKeys.length > 0) {
await setArrayOutput({
key: 'modified_keys',
inputs,
value: modifiedKeys
})
}
if (changedKeys.length > 0) {
await setArrayOutput({
key: 'changed_keys',
inputs,
value: changedKeys
})
}
}
if (filePatterns.length === 0 && Object.keys(yamlFilePatterns).length === 0) {
core.startGroup('changed-files-all')
await setOutputsAndGetModifiedAndChangedFilesStatus({
allDiffFiles,
allFilteredDiffFiles: allDiffFiles,
inputs
})
core.info('All Done!')
core.endGroup()
}
}
export const getRenamedFiles = async ({
inputs,
workingDirectory,

View File

@@ -6,11 +6,7 @@ import {
getChangeTypeFiles
} from './changedFiles'
import {Inputs} from './inputs'
import {setOutput} from './utils'
const getOutputKey = (key: string, outputPrefix: string): string => {
return outputPrefix ? `${outputPrefix}_${key}` : key
}
import {getOutputKey, setArrayOutput, setOutput} from './utils'
const getArrayFromPaths = (
paths: string | string[],
@@ -19,7 +15,7 @@ const getArrayFromPaths = (
return Array.isArray(paths) ? paths : paths.split(inputs.separator)
}
export const setChangedFilesOutput = async ({
export const setOutputsAndGetModifiedAndChangedFilesStatus = async ({
allDiffFiles,
allFilteredDiffFiles,
inputs,
@@ -31,7 +27,7 @@ export const setChangedFilesOutput = async ({
inputs: Inputs
filePatterns?: string[]
outputPrefix?: string
}): Promise<void> => {
}): Promise<{anyModified: boolean; anyChanged: boolean}> => {
const addedFiles = await getChangeTypeFiles({
inputs,
changedFiles: allFilteredDiffFiles,
@@ -283,15 +279,11 @@ export const setChangedFilesOutput = async ({
json: inputs.json
})
await setOutput({
key: getOutputKey('other_changed_files', outputPrefix),
value: inputs.json
? otherChangedFiles
: otherChangedFiles.join(inputs.separator),
writeOutputFiles: inputs.writeOutputFiles,
outputDir: inputs.outputDir,
json: inputs.json,
shouldEscape: inputs.escapeJson
await setArrayOutput({
key: 'other_changed_files',
inputs,
value: otherChangedFiles,
outputPrefix
})
await setOutput({
@@ -376,15 +368,11 @@ export const setChangedFilesOutput = async ({
json: inputs.json
})
await setOutput({
key: getOutputKey('other_modified_files', outputPrefix),
value: inputs.json
? otherModifiedFiles
: otherModifiedFiles.join(inputs.separator),
writeOutputFiles: inputs.writeOutputFiles,
outputDir: inputs.outputDir,
json: inputs.json,
shouldEscape: inputs.escapeJson
await setArrayOutput({
key: 'other_modified_files',
inputs,
value: otherModifiedFiles,
outputPrefix
})
await setOutput({
@@ -457,15 +445,11 @@ export const setChangedFilesOutput = async ({
json: inputs.json
})
await setOutput({
key: getOutputKey('other_deleted_files', outputPrefix),
value: inputs.json
? otherDeletedFiles
: otherDeletedFiles.join(inputs.separator),
writeOutputFiles: inputs.writeOutputFiles,
outputDir: inputs.outputDir,
json: inputs.json,
shouldEscape: inputs.escapeJson
await setArrayOutput({
key: 'other_deleted_files',
inputs,
value: otherDeletedFiles,
outputPrefix
})
await setOutput({
@@ -474,4 +458,9 @@ export const setChangedFilesOutput = async ({
writeOutputFiles: inputs.writeOutputFiles,
outputDir: inputs.outputDir
})
return {
anyModified: allModifiedFiles.paths.length > 0 && filePatterns.length > 0,
anyChanged: allChangedFiles.paths.length > 0 && filePatterns.length > 0
}
}

View File

@@ -551,6 +551,12 @@ export const getSHAForPullRequestEvent = async (
diff
}))
) {
core.warning(
'If this pull request is from a forked repository, please set the checkout action `repository` input to the same repository as the pull request.'
)
core.warning(
'This can be done by setting actions/checkout `repository` to ${{ github.event.pull_request.head.repo.full_name }}'
)
throw new Error(
`Unable to determine a difference between ${previousSha}${diff}${currentSha}`
)

View File

@@ -2,13 +2,12 @@ import * as core from '@actions/core'
import * as github from '@actions/github'
import path from 'path'
import {
ChangedFiles,
processChangedFiles,
ChangeTypeEnum,
getAllDiffFiles,
getChangedFilesFromGithubAPI,
getRenamedFiles
} from './changedFiles'
import {setChangedFilesOutput} from './changedFilesOutput'
import {
DiffResult,
getSHAForNonPullRequestEvent,
@@ -18,7 +17,6 @@ import {Env, getEnv} from './env'
import {getInputs, Inputs} from './inputs'
import {
getFilePatterns,
getFilteredChangedFiles,
getRecoverFilePatterns,
getSubmodulePath,
getYamlFilePatterns,
@@ -31,73 +29,7 @@ import {
verifyMinimumGitVersion
} from './utils'
const changedFilesOutput = async ({
filePatterns,
allDiffFiles,
inputs,
yamlFilePatterns
}: {
filePatterns: string[]
allDiffFiles: ChangedFiles
inputs: Inputs
yamlFilePatterns: Record<string, string[]>
}): Promise<void> => {
if (filePatterns.length > 0) {
core.startGroup('changed-files-patterns')
const allFilteredDiffFiles = await getFilteredChangedFiles({
allDiffFiles,
filePatterns
})
core.debug(
`All filtered diff files: ${JSON.stringify(allFilteredDiffFiles)}`
)
await setChangedFilesOutput({
allDiffFiles,
allFilteredDiffFiles,
inputs,
filePatterns
})
core.info('All Done!')
core.endGroup()
}
if (Object.keys(yamlFilePatterns).length > 0) {
for (const key of Object.keys(yamlFilePatterns)) {
core.startGroup(`changed-files-yaml-${key}`)
const allFilteredDiffFiles = await getFilteredChangedFiles({
allDiffFiles,
filePatterns: yamlFilePatterns[key]
})
core.debug(
`All filtered diff files for ${key}: ${JSON.stringify(
allFilteredDiffFiles
)}`
)
await setChangedFilesOutput({
allDiffFiles,
allFilteredDiffFiles,
inputs,
filePatterns: yamlFilePatterns[key],
outputPrefix: key
})
core.info('All Done!')
core.endGroup()
}
}
if (filePatterns.length === 0 && Object.keys(yamlFilePatterns).length === 0) {
core.startGroup('changed-files-all')
await setChangedFilesOutput({
allDiffFiles,
allFilteredDiffFiles: allDiffFiles,
inputs
})
core.info('All Done!')
core.endGroup()
}
}
const getChangedFilesFromLocalGit = async ({
const getChangedFilesFromLocalGitHistory = async ({
inputs,
env,
workingDirectory,
@@ -216,7 +148,7 @@ const getChangedFilesFromLocalGit = async ({
})
}
await changedFilesOutput({
await processChangedFiles({
filePatterns,
allDiffFiles,
inputs,
@@ -267,7 +199,7 @@ const getChangedFilesFromRESTAPI = async ({
core.debug(`All diff files: ${JSON.stringify(allDiffFiles)}`)
core.info('All Done!')
await changedFilesOutput({
await processChangedFiles({
filePatterns,
allDiffFiles,
inputs,
@@ -349,7 +281,7 @@ export async function run(): Promise<void> {
}
core.info('Using local .git directory')
await getChangedFilesFromLocalGit({
await getChangedFilesFromLocalGitHistory({
inputs,
env,
workingDirectory,

View File

@@ -9,7 +9,6 @@ import * as path from 'path'
import {createInterface} from 'readline'
import {parseDocument} from 'yaml'
import {ChangedFiles, ChangeTypeEnum} from './changedFiles'
import {Inputs} from './inputs'
const MINIMUM_GIT_VERSION = '2.18.0'
@@ -1223,6 +1222,32 @@ export const getRecoverFilePatterns = ({
return filePatterns.filter(Boolean)
}
export const getOutputKey = (key: string, outputPrefix: string): string => {
return outputPrefix ? `${outputPrefix}_${key}` : key
}
export const setArrayOutput = async ({
key,
inputs,
value,
outputPrefix
}: {
key: string
inputs: Inputs
value: string[]
outputPrefix?: string
}): Promise<void> => {
core.debug(`${key}: ${JSON.stringify(value)}`)
await setOutput({
key: outputPrefix ? getOutputKey(key, outputPrefix) : key,
value: inputs.json ? value : value.join(inputs.separator),
writeOutputFiles: inputs.writeOutputFiles,
outputDir: inputs.outputDir,
json: inputs.json,
shouldEscape: inputs.escapeJson
})
}
export const setOutput = async ({
key,
value,

901
yarn.lock

File diff suppressed because it is too large Load Diff