Compare commits

...

63 Commits

Author SHA1 Message Date
tj-actions[bot]
8238a41032 Updated README.md (#1602)
Co-authored-by: jackton1 <jackton1@users.noreply.github.com>
2023-09-22 13:48:09 -06:00
Tonye Jack
aaf4339aa1 Merge pull request #1601 from tj-actions/feat/add-support-for-restricting-the-deleted-files-output-to-only-deleted-directories 2023-09-22 13:45:16 -06:00
Tonye Jack
d2486b470f Update test 2023-09-22 12:59:02 -06:00
Tonye Jack
e7fd9e59a4 Updated test 2023-09-22 12:52:27 -06:00
repo-ranger[bot]
e3cc088a96 Merge branch 'main' into feat/add-support-for-restricting-the-deleted-files-output-to-only-deleted-directories 2023-09-22 18:38:48 +00:00
renovate[bot]
72d7089b72 chore(deps): update actions/checkout digest to 8ade135 2023-09-22 18:36:50 +00:00
Tonye Jack
e94da5a065 Fixed test for windows 2023-09-22 12:25:28 -06:00
Tonye Jack
a721d001dd Fixed the test 2023-09-22 12:15:09 -06:00
GitHub Action
8af3110d4d Added missing changes and modified dist assets. 2023-09-22 17:07:10 +00:00
Tonye Jack
a351a301d2 Merge 62a23f82b1 into 0b947ed818 2023-09-22 17:05:50 +00:00
Tonye Jack
62a23f82b1 Updated debug message 2023-09-22 11:05:42 -06:00
Tonye Jack
ef42e5ad18 Update test 2023-09-22 10:36:41 -06:00
Tonye Jack
cd1e384723 Deleted the test3 directory 2023-09-22 10:23:52 -06:00
Tonye Jack
a52f8621d2 Deleted a single test file 2023-09-22 10:22:56 -06:00
Tonye Jack
920856cfdd Added a test files 2023-09-22 10:21:55 -06:00
Tonye Jack
08906b3254 Updated the test 2023-09-22 10:14:29 -06:00
Tonye Jack
cd35eace22 Updated description 2023-09-22 10:06:37 -06:00
GitHub Action
8296c33fd0 Added missing changes and modified dist assets. 2023-09-22 16:06:08 +00:00
Tonye Jack
0ad71b9855 Merge c98e6d20fc into 0b947ed818 2023-09-22 10:02:09 -06:00
Tonye Jack
c98e6d20fc Removed unused code 2023-09-22 10:01:57 -06:00
GitHub Action
2398551415 Added missing changes and modified dist assets. 2023-09-22 10:01:57 -06:00
Tonye Jack
060b3b9b03 Removed unused code 2023-09-22 10:01:57 -06:00
GitHub Action
ff65504325 Added missing changes and modified dist assets. 2023-09-22 10:01:57 -06:00
Tonye Jack
543c1a25c6 Updated use of deletedFilesPaths 2023-09-22 10:01:57 -06:00
Tonye Jack
1be42003d7 Updated action.yml 2023-09-22 10:01:57 -06:00
GitHub Action
2325baada3 Added missing changes and modified dist assets. 2023-09-22 10:01:57 -06:00
Tonye Jack
e6ce728d79 feat: add support for restricting the deleted files output to only deleted directories 2023-09-22 10:01:57 -06:00
Tonye Jack
0b947ed818 Update README.md 2023-09-22 07:31:05 -06:00
Tonye Jack
e8dbf6d670 Update README.md 2023-09-20 19:48:40 -06:00
tj-actions[bot]
41c232aad8 Upgraded to v39.1.2 (#1594)
Co-authored-by: jackton1 <jackton1@users.noreply.github.com>
2023-09-20 21:03:55 +00:00
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
22 changed files with 1160 additions and 756 deletions

View File

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

@@ -29,7 +29,7 @@ jobs:
steps: steps:
# Checkout the repository to the GitHub Actions runner # Checkout the repository to the GitHub Actions runner
- name: Checkout code - name: Checkout code
uses: actions/checkout@3df4ab11eba7bda6032a0b82a6bb43b11571feac # v4 uses: actions/checkout@8ade135a41bc03ea155e62e844d188df1ea18608 # v4
# Execute Codacy Analysis CLI and generate a SARIF output with the security issues identified during the analysis # Execute Codacy Analysis CLI and generate a SARIF output with the security issues identified during the analysis
- name: Run Codacy Analysis CLI - name: Run Codacy Analysis CLI

View File

@@ -38,7 +38,7 @@ jobs:
steps: steps:
- name: Checkout repository - name: Checkout repository
uses: actions/checkout@3df4ab11eba7bda6032a0b82a6bb43b11571feac # v4 uses: actions/checkout@8ade135a41bc03ea155e62e844d188df1ea18608 # v4
# Initializes the CodeQL tools for scanning. # Initializes the CodeQL tools for scanning.
- name: Initialize CodeQL - name: Initialize CodeQL

View File

@@ -16,7 +16,7 @@ jobs:
steps: steps:
- name: Checkout - name: Checkout
uses: actions/checkout@3df4ab11eba7bda6032a0b82a6bb43b11571feac # v4 uses: actions/checkout@8ade135a41bc03ea155e62e844d188df1ea18608 # v4
with: with:
submodules: true submodules: true
fetch-depth: 0 fetch-depth: 0

View File

@@ -14,7 +14,7 @@ jobs:
matrix: ${{ steps.set-matrix.outputs.matrix }} matrix: ${{ steps.set-matrix.outputs.matrix }}
steps: steps:
- name: Checkout - name: Checkout
uses: actions/checkout@3df4ab11eba7bda6032a0b82a6bb43b11571feac # v4 uses: actions/checkout@8ade135a41bc03ea155e62e844d188df1ea18608 # v4
with: with:
fetch-depth: 0 fetch-depth: 0
- name: Get changed files - name: Get changed files
@@ -38,7 +38,7 @@ jobs:
fail-fast: false fail-fast: false
steps: steps:
- name: Checkout - name: Checkout
uses: actions/checkout@3df4ab11eba7bda6032a0b82a6bb43b11571feac # v4 uses: actions/checkout@8ade135a41bc03ea155e62e844d188df1ea18608 # v4
- name: Test - name: Test
run: | run: |
echo ${{ matrix.files }} echo ${{ matrix.files }}

View File

@@ -8,7 +8,7 @@ jobs:
update-version: update-version:
runs-on: ubuntu-latest runs-on: ubuntu-latest
steps: steps:
- uses: actions/checkout@3df4ab11eba7bda6032a0b82a6bb43b11571feac # v4 - uses: actions/checkout@8ade135a41bc03ea155e62e844d188df1ea18608 # v4
with: with:
fetch-depth: 0 fetch-depth: 0
- name: Run release-tagger - name: Run release-tagger

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 }}" echo "Expected: (test/test deleted.txt) got ${{ steps.changed-files-recover-deleted-files-with-files-yaml.outputs.test_deleted_files }}"
exit 1 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 - name: Verify that test/test deleted.txt is restored
run: | run: |
if [ ! -f "test/test deleted.txt" ]; then if [ ! -f "test/test deleted.txt" ]; then
@@ -806,6 +812,80 @@ jobs:
cat "deleted_files/test/test deleted.txt" cat "deleted_files/test/test deleted.txt"
fi fi
test-dir-names-deleted-files-include-only-deleted-dirs-single-file:
name: Test dir names deleted files include only deleted dirs single file
runs-on: ubuntu-latest
needs: build
if: needs.build.outputs.files_changed != 'true'
steps:
- name: Checkout branch
uses: actions/checkout@v4
with:
ref: a52f8621d26d5d9f54b80f74bda2d9eedff94693
repository: ${{ github.event.pull_request.head.repo.full_name }}
submodules: true
fetch-depth: 2
- name: Run changed-files with dir_names and dir_names_deleted_files_include_only_deleted_dirs with a single file deleted withing the test directory
id: changed-files-dir-names-deleted-files-include-only-deleted-dirs-single-file
uses: ./
with:
base_sha: 920856cfdd4b4be17810e34b197596397473adf6
sha: a52f8621d26d5d9f54b80f74bda2d9eedff94693
dir_names: true
dir_names_deleted_files_include_only_deleted_dirs: true
- name: Show output
run: |
echo '${{ toJSON(steps.changed-files-dir-names-deleted-files-include-only-deleted-dirs-single-file.outputs) }}'
shell:
bash
- name: Check deleted_files output
if: steps.changed-files-dir-names-deleted-files-include-only-deleted-dirs-single-file.outputs.deleted_files != ''
run: |
echo "Invalid output: Expected '' got (${{ steps.changed-files-dir-names-deleted-files-include-only-deleted-dirs-single-file.outputs.deleted_files }})"
exit 1
shell:
bash
test-dir-names-deleted-files-include-only-deleted-dirs-directory:
name: Test dir names deleted files include only deleted dirs
runs-on: ubuntu-latest
needs: build
if: needs.build.outputs.files_changed != 'true'
steps:
- name: Checkout branch
uses: actions/checkout@v4
with:
ref: cd1e384723e4d1a184568182ac2b27c53ebf017f
repository: ${{ github.event.pull_request.head.repo.full_name }}
submodules: true
fetch-depth: 2
- name: Run changed-files with dir_names and dir_names_deleted_files_include_only_deleted_dirs with the test directory deleted
id: changed-files-dir-names-deleted-files-include-only-deleted-dirs-directory
uses: ./
with:
base_sha: a52f8621d26d5d9f54b80f74bda2d9eedff94693
sha: cd1e384723e4d1a184568182ac2b27c53ebf017f
dir_names: true
dir_names_deleted_files_include_only_deleted_dirs: true
- name: Show output
run: |
echo '${{ toJSON(steps.changed-files-dir-names-deleted-files-include-only-deleted-dirs-directory.outputs) }}'
shell:
bash
- name: Check deleted_files output on non windows platform
if: steps.changed-files-dir-names-deleted-files-include-only-deleted-dirs-directory.outputs.deleted_files != 'test/test3' && runner.os != 'Windows'
run: |
echo "Invalid output: Expected (test/test3) got (${{ steps.changed-files-dir-names-deleted-files-include-only-deleted-dirs-directory.outputs.deleted_files }})"
exit 1
shell:
bash
- name: Check deleted_files output on windows platform
if: "!contains(steps.changed-files-dir-names-deleted-files-include-only-deleted-dirs-directory.outputs.deleted_files, 'test\\test3') && runner.os == 'Windows'"
run: |
echo "Invalid output: Expected (test\\test3) got (${{ steps.changed-files-dir-names-deleted-files-include-only-deleted-dirs-directory.outputs.deleted_files }})"
exit 1
shell:
bash
test-since-last-remote-commit: test-since-last-remote-commit:
name: Test changed-files since last remote commit name: Test changed-files since last remote commit
runs-on: ubuntu-latest runs-on: ubuntu-latest
@@ -839,7 +919,7 @@ jobs:
since_last_remote_commit: true since_last_remote_commit: true
- name: Verify failed - 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: | run: |
echo "Expected: (failure) got ${{ steps.changed-files-since-last-remote-commit.outcome }}" echo "Expected: (failure) got ${{ steps.changed-files-since-last-remote-commit.outcome }}"
exit 1 exit 1
@@ -1417,14 +1497,14 @@ jobs:
fi fi
shell: shell:
bash bash
- name: Check if a excluded file is not included in any_deleted on non windows platform - name: Check if an excluded file is included in deleted_files output on non windows platform
if: "contains(steps.changed-files-specific.outputs.deleted_files, 'test/test/test.txt') && runner.os != 'Windows'" if: "contains(steps.changed-files-specific.outputs.deleted_files, 'test/test/test.txt') && runner.os != 'Windows'"
run: | run: |
echo "Invalid output: Expected not to include (test/test/test.txt) got (${{ steps.changed-files-specific.outputs.deleted_files }})" echo "Invalid output: Expected not to include (test/test/test.txt) got (${{ steps.changed-files-specific.outputs.deleted_files }})"
exit 1 exit 1
shell: shell:
bash bash
- name: Check if a excluded file is not included in any_deleted on windows platform - name: Check if an excluded file is included in deleted_files output on windows platform
if: "contains(steps.changed-files-specific.outputs.deleted_files, 'test\\test\\test.txt') && runner.os == 'Windows'" if: "contains(steps.changed-files-specific.outputs.deleted_files, 'test\\test\\test.txt') && runner.os == 'Windows'"
run: | run: |
echo "Invalid output: Expected not to include (test\\test\\test.txt) got (${{ steps.changed-files-specific.outputs.deleted_files }})" echo "Invalid output: Expected not to include (test\\test\\test.txt) got (${{ steps.changed-files-specific.outputs.deleted_files }})"

View File

@@ -9,7 +9,7 @@ jobs:
sync-assets: sync-assets:
runs-on: ubuntu-latest runs-on: ubuntu-latest
steps: steps:
- uses: actions/checkout@3df4ab11eba7bda6032a0b82a6bb43b11571feac # v4 - uses: actions/checkout@8ade135a41bc03ea155e62e844d188df1ea18608 # v4
with: with:
fetch-depth: 0 fetch-depth: 0

View File

@@ -1,5 +1,127 @@
# Changelog # Changelog
# [39.1.2](https://github.com/tj-actions/changed-files/compare/v39.1.1...v39.1.2) - (2023-09-20)
## <!-- 7 -->⚙️ Miscellaneous Tasks
- Add warrning message to diff error ([#1593](https://github.com/tj-actions/changed-files/issues/1593)) ([4196030](https://github.com/tj-actions/changed-files/commit/41960309398d165631f08c5df47a11147e14712b)) - (Tonye Jack)
- **deps:** Update dependency @types/node to v20.6.3 ([bbe7960](https://github.com/tj-actions/changed-files/commit/bbe796033ec7cd22e0e20315c172c13048fc437c)) - (renovate[bot])
## <!-- 9 -->⬆️ Upgrades
- Upgraded to v39.1.1 ([#1591](https://github.com/tj-actions/changed-files/issues/1591))
Co-authored-by: jackton1 <jackton1@users.noreply.github.com> ([159562d](https://github.com/tj-actions/changed-files/commit/159562dc02e645a8a858fca8e12f289e65d30fa5)) - (tj-actions[bot])
# [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) # [39.0.1](https://github.com/tj-actions/changed-files/compare/v39.0.0...v39.0.1) - (2023-09-09)
## <!-- 1 -->🐛 Bug Fixes ## <!-- 1 -->🐛 Bug Fixes

View File

@@ -5,11 +5,10 @@
[![Codacy Badge](https://app.codacy.com/project/badge/Grade/4a625e9b62794b5b98e169c15c0e673c)](https://www.codacy.com/gh/tj-actions/changed-files/dashboard?utm_source=github.com\&utm_medium=referral\&utm_content=tj-actions/changed-files\&utm_campaign=Badge_Grade) [![Codacy Badge](https://app.codacy.com/project/badge/Grade/4a625e9b62794b5b98e169c15c0e673c)](https://www.codacy.com/gh/tj-actions/changed-files/dashboard?utm_source=github.com\&utm_medium=referral\&utm_content=tj-actions/changed-files\&utm_campaign=Badge_Grade)
[![CI](https://github.com/tj-actions/changed-files/actions/workflows/test.yml/badge.svg)](https://github.com/tj-actions/changed-files/actions/workflows/test.yml) [![CI](https://github.com/tj-actions/changed-files/actions/workflows/test.yml/badge.svg)](https://github.com/tj-actions/changed-files/actions/workflows/test.yml)
[![Update release version.](https://github.com/tj-actions/changed-files/actions/workflows/sync-release-version.yml/badge.svg)](https://github.com/tj-actions/changed-files/actions/workflows/sync-release-version.yml)
<!-- ALL-CONTRIBUTORS-BADGE:START - Do not remove or modify this section --> <!-- 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 --> <!-- ALL-CONTRIBUTORS-BADGE:END -->
@@ -69,8 +68,8 @@ Effortlessly track all changed files and directories relative to a target branch
* Supports brace expansion. * Supports brace expansion.
* Supports negation. * Supports negation.
* Uses [YAML](https://yaml.org/) syntax for specifying patterns. * 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 anchors & aliases](https://github.com/tj-actions/changed-files/blob/main/test/changed-files.yml#L8-L12).
* Supports [YAML multi-line strings](https://learnxinyminutes.com/docs/yaml/). * Supports [YAML multi-line strings](https://github.com/tj-actions/changed-files/blob/main/test/changed-files.yml#L13-L16).
And many more... And many more...
@@ -82,12 +81,14 @@ And many more...
> * For mono repositories where pulling all branch history might not be desired, you can still use the default [`fetch-depth`](https://github.com/actions/checkout#usage), which is set to `1` for `pull_request` events. > * For mono repositories where pulling all branch history might not be desired, you can still use the default [`fetch-depth`](https://github.com/actions/checkout#usage), which is set to `1` for `pull_request` events.
> * Avoid using single or double quotes for multiline inputs, as the value is already a string separated by a newline character. See [Examples](#examples) for more information. > * Avoid using single or double quotes for multiline inputs, as the value is already a string separated by a newline character. See [Examples](#examples) for more information.
> * If [`fetch-depth`](https://github.com/actions/checkout#usage) isn't set to `0`, ensure that `persist-credentials` is set to `true` when configuring [`actions/checkout`](https://github.com/actions/checkout#usage). > * If [`fetch-depth`](https://github.com/actions/checkout#usage) isn't set to `0`, ensure that `persist-credentials` is set to `true` when configuring [`actions/checkout`](https://github.com/actions/checkout#usage).
> * For repositories that have PRs generated from forks, when configuring [`actions/checkout`](https://github.com/actions/checkout#usage), set the [`repository`](https://github.com/actions/checkout#usage) to `${{ github.event.pull_request.head.repo.full_name }}`. See [Example](https://github.com/tj-actions/changed-files/blob/main/.github/workflows/test.yml#L47-L51). > * For repositories that have PRs generated from forks, when configuring [`actions/checkout`](https://github.com/actions/checkout#usage), set the [`repository`](https://github.com/actions/checkout#usage) to `${{ github.event.pull_request.head.repo.full_name }}`. See [Example](https://github.com/tj-actions/changed-files/blob/main/.github/workflows/test.yml#L49-L53).
Visit the [discussions for more information](https://github.com/tj-actions/changed-files/discussions) or [create a new discussion](https://github.com/tj-actions/changed-files/discussions/new/choose) for usage-related questions. Visit the [discussions for more information](https://github.com/tj-actions/changed-files/discussions) or [create a new discussion](https://github.com/tj-actions/changed-files/discussions/new/choose) for usage-related questions.
### On `pull_request` 🔀 ### 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 📁 #### Using local .git history 📁
```yaml ```yaml
@@ -209,6 +210,8 @@ jobs:
### On `push` ⬆️ ### On `push` ⬆️
Detect changes to files made since the last pushed commit.
```yaml ```yaml
name: CI name: CI
@@ -255,7 +258,6 @@ jobs:
with: with:
fetch-depth: 0 # OR "2" -> To retrieve the preceding commit. fetch-depth: 0 # OR "2" -> To retrieve the preceding commit.
# Example 1
- name: Get changed files - name: Get changed files
id: changed-files id: changed-files
uses: tj-actions/changed-files@v39 uses: tj-actions/changed-files@v39
@@ -267,11 +269,6 @@ jobs:
for file in ${{ steps.changed-files.outputs.all_changed_files }}; do for file in ${{ steps.changed-files.outputs.all_changed_files }}; do
echo "$file was changed" echo "$file was changed"
done done
# Example 2: See above
...
# Example 3: See above
... ...
``` ```
@@ -321,19 +318,21 @@ 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_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"></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_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_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"></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_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"></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_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"></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_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_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_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_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"></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_deleted_files_count"></a>[other\_deleted\_files\_count](#output_other_deleted_files_count) | string | Returns the number of `other_deleted_files` |
@@ -355,11 +354,12 @@ Support this project with a :star:
<!-- AUTO-DOC-INPUT:START - Do not remove or modify this section --> <!-- AUTO-DOC-INPUT:START - Do not remove or modify this section -->
| INPUT | TYPE | REQUIRED | DEFAULT | DESCRIPTION | | INPUT | TYPE | REQUIRED | DEFAULT | DESCRIPTION |
|----------------------------------------------------------------------------------------------------------------------------------------------------------------------|--------|----------|---------------------------|------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------| |-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|--------|----------|---------------------------|------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|
| <a name="input_api_url"></a>[api\_url](#input_api_url) | string | false | `"${{ github.api_url }}"` | Github API URL. | | <a name="input_api_url"></a>[api\_url](#input_api_url) | string | false | `"${{ github.api_url }}"` | Github API URL. |
| <a name="input_base_sha"></a>[base\_sha](#input_base_sha) | string | false | | Specify a different base commit <br>SHA used for comparing changes | | <a name="input_base_sha"></a>[base\_sha](#input_base_sha) | string | false | | Specify a different base commit <br>SHA used for comparing changes |
| <a name="input_diff_relative"></a>[diff\_relative](#input_diff_relative) | string | false | `"true"` | Exclude changes outside the current <br>directory and show path names <br>relative to it. **NOTE:** This <br>requires you to specify the <br>top level directory via the <br>`path` input. | | <a name="input_diff_relative"></a>[diff\_relative](#input_diff_relative) | string | false | `"true"` | Exclude changes outside the current <br>directory and show path names <br>relative to it. **NOTE:** This <br>requires you to specify the <br>top level directory via the <br>`path` input. |
| <a name="input_dir_names"></a>[dir\_names](#input_dir_names) | string | false | `"false"` | Output unique changed directories instead <br>of filenames. **NOTE:** This returns <br>`.` for changed files located <br>in the current working directory <br>which defaults to `$GITHUB_WORKSPACE`. | | <a name="input_dir_names"></a>[dir\_names](#input_dir_names) | string | false | `"false"` | Output unique changed directories instead <br>of filenames. **NOTE:** This returns <br>`.` for changed files located <br>in the current working directory <br>which defaults to `$GITHUB_WORKSPACE`. |
| <a name="input_dir_names_deleted_files_include_only_deleted_dirs"></a>[dir\_names\_deleted\_files\_include\_only\_deleted\_dirs](#input_dir_names_deleted_files_include_only_deleted_dirs) | string | false | `"false"` | Include only directories that have <br>been deleted as opposed to <br>directory names of files that <br>have been deleted in the <br>`deleted_files` output when `dir_names` is <br>set to `true`. |
| <a name="input_dir_names_exclude_current_dir"></a>[dir\_names\_exclude\_current\_dir](#input_dir_names_exclude_current_dir) | string | false | `"false"` | Exclude the current directory represented <br>by `.` from the output <br>when `dir_names` is set to <br>`true`. | | <a name="input_dir_names_exclude_current_dir"></a>[dir\_names\_exclude\_current\_dir](#input_dir_names_exclude_current_dir) | string | false | `"false"` | Exclude the current directory represented <br>by `.` from the output <br>when `dir_names` is set to <br>`true`. |
| <a name="input_dir_names_include_files"></a>[dir\_names\_include\_files](#input_dir_names_include_files) | string | false | | Include files in the output <br>when `dir_names` is set to <br>`true`. **NOTE:** This returns only <br>the matching files and also <br>the directory names. | | <a name="input_dir_names_include_files"></a>[dir\_names\_include\_files](#input_dir_names_include_files) | string | false | | Include files in the output <br>when `dir_names` is set to <br>`true`. **NOTE:** This returns only <br>the matching files and also <br>the directory names. |
| <a name="input_dir_names_include_files_separator"></a>[dir\_names\_include\_files\_separator](#input_dir_names_include_files_separator) | string | false | `"\n"` | Separator used to split the <br>`dir_names_include_files` input | | <a name="input_dir_names_include_files_separator"></a>[dir\_names\_include\_files\_separator](#input_dir_names_include_files_separator) | string | false | `"\n"` | Separator used to split the <br>`dir_names_include_files` input |
@@ -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/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/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://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> </tr>
</tbody> </tbody>
</table> </table>

View File

@@ -120,6 +120,10 @@ inputs:
description: "Separator used to split the `dir_names_include_files` input" description: "Separator used to split the `dir_names_include_files` input"
default: "\n" default: "\n"
required: false required: false
dir_names_deleted_files_include_only_deleted_dirs:
description: "Include only directories that have been deleted as opposed to directory names of files that have been deleted in the `deleted_files` output when `dir_names` is set to `true`."
required: false
default: "false"
json: json:
description: "Output list of changed files in a JSON formatted string which can be used for matrix jobs. [Example](https://github.com/tj-actions/changed-files/blob/main/.github/workflows/matrix-test.yml)" description: "Output list of changed files in a JSON formatted string which can be used for matrix jobs. [Example](https://github.com/tj-actions/changed-files/blob/main/.github/workflows/matrix-test.yml)"
required: false required: false
@@ -243,11 +247,11 @@ outputs:
all_changed_files_count: all_changed_files_count:
description: "Returns the number of `all_changed_files`" description: "Returns the number of `all_changed_files`"
any_changed: 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: 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: 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: other_changed_files_count:
description: "Returns the number of `other_changed_files`" description: "Returns the number of `other_changed_files`"
all_modified_files: all_modified_files:
@@ -255,7 +259,7 @@ outputs:
all_modified_files_count: all_modified_files_count:
description: "Returns the number of `all_modified_files`" description: "Returns the number of `all_modified_files`"
any_modified: 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: only_modified:
description: "Returns `true` when only files provided using the `files*` or `files_ignore*` inputs has been modified. (ACMRD)." description: "Returns `true` when only files provided using the `files*` or `files_ignore*` inputs has been modified. (ACMRD)."
other_modified_files: other_modified_files:
@@ -270,6 +274,10 @@ outputs:
description: "Returns all other deleted files not listed in the files input i.e. *a combination of all deleted files (D)*" 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: other_deleted_files_count:
description: "Returns the number of `other_deleted_files`" 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: runs:
using: 'node20' using: 'node20'

305
dist/index.js generated vendored
View File

@@ -49,13 +49,87 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
return (mod && mod.__esModule) ? mod : { "default": mod }; return (mod && mod.__esModule) ? mod : { "default": mod };
}; };
Object.defineProperty(exports, "__esModule", ({ value: true })); 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 core = __importStar(__nccwpck_require__(2186));
const github = __importStar(__nccwpck_require__(5438)); const github = __importStar(__nccwpck_require__(5438));
const flatten_1 = __importDefault(__nccwpck_require__(2394)); const flatten_1 = __importDefault(__nccwpck_require__(2394));
const micromatch_1 = __importDefault(__nccwpck_require__(6228)); const micromatch_1 = __importDefault(__nccwpck_require__(6228));
const path = __importStar(__nccwpck_require__(1017)); const path = __importStar(__nccwpck_require__(1017));
const changedFilesOutput_1 = __nccwpck_require__(8930);
const utils_1 = __nccwpck_require__(918); const utils_1 = __nccwpck_require__(918);
const processChangedFiles = ({ filePatterns, allDiffFiles, inputs, yamlFilePatterns, workingDirectory }) => __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,
workingDirectory
});
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,
workingDirectory
});
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,
workingDirectory
});
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 getRenamedFiles = ({ inputs, workingDirectory, hasSubmodule, diffResult, submodulePaths }) => __awaiter(void 0, void 0, void 0, function* () {
const renamedFiles = yield (0, utils_1.gitRenamedFiles)({ const renamedFiles = yield (0, utils_1.gitRenamedFiles)({
cwd: workingDirectory, cwd: workingDirectory,
@@ -355,18 +429,19 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge
step((generator = generator.apply(thisArg, _arguments || [])).next()); step((generator = generator.apply(thisArg, _arguments || [])).next());
}); });
}; };
var __importDefault = (this && this.__importDefault) || function (mod) {
return (mod && mod.__esModule) ? mod : { "default": mod };
};
Object.defineProperty(exports, "__esModule", ({ value: true })); Object.defineProperty(exports, "__esModule", ({ value: true }));
exports.setChangedFilesOutput = void 0; exports.setOutputsAndGetModifiedAndChangedFilesStatus = void 0;
const core = __importStar(__nccwpck_require__(2186)); const core = __importStar(__nccwpck_require__(2186));
const path_1 = __importDefault(__nccwpck_require__(1017));
const changedFiles_1 = __nccwpck_require__(7358); const changedFiles_1 = __nccwpck_require__(7358);
const utils_1 = __nccwpck_require__(918); const utils_1 = __nccwpck_require__(918);
const getOutputKey = (key, outputPrefix) => {
return outputPrefix ? `${outputPrefix}_${key}` : key;
};
const getArrayFromPaths = (paths, inputs) => { const getArrayFromPaths = (paths, inputs) => {
return Array.isArray(paths) ? paths : paths.split(inputs.separator); 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 = '', workingDirectory }) => __awaiter(void 0, void 0, void 0, function* () {
const addedFiles = yield (0, changedFiles_1.getChangeTypeFiles)({ const addedFiles = yield (0, changedFiles_1.getChangeTypeFiles)({
inputs, inputs,
changedFiles: allFilteredDiffFiles, changedFiles: allFilteredDiffFiles,
@@ -374,7 +449,7 @@ const setChangedFilesOutput = ({ allDiffFiles, allFilteredDiffFiles, inputs, fil
}); });
core.debug(`Added files: ${JSON.stringify(addedFiles)}`); core.debug(`Added files: ${JSON.stringify(addedFiles)}`);
yield (0, utils_1.setOutput)({ yield (0, utils_1.setOutput)({
key: getOutputKey('added_files', outputPrefix), key: (0, utils_1.getOutputKey)('added_files', outputPrefix),
value: addedFiles.paths, value: addedFiles.paths,
writeOutputFiles: inputs.writeOutputFiles, writeOutputFiles: inputs.writeOutputFiles,
outputDir: inputs.outputDir, outputDir: inputs.outputDir,
@@ -382,7 +457,7 @@ const setChangedFilesOutput = ({ allDiffFiles, allFilteredDiffFiles, inputs, fil
shouldEscape: inputs.escapeJson shouldEscape: inputs.escapeJson
}); });
yield (0, utils_1.setOutput)({ yield (0, utils_1.setOutput)({
key: getOutputKey('added_files_count', outputPrefix), key: (0, utils_1.getOutputKey)('added_files_count', outputPrefix),
value: addedFiles.count, value: addedFiles.count,
writeOutputFiles: inputs.writeOutputFiles, writeOutputFiles: inputs.writeOutputFiles,
outputDir: inputs.outputDir outputDir: inputs.outputDir
@@ -394,7 +469,7 @@ const setChangedFilesOutput = ({ allDiffFiles, allFilteredDiffFiles, inputs, fil
}); });
core.debug(`Copied files: ${JSON.stringify(copiedFiles)}`); core.debug(`Copied files: ${JSON.stringify(copiedFiles)}`);
yield (0, utils_1.setOutput)({ yield (0, utils_1.setOutput)({
key: getOutputKey('copied_files', outputPrefix), key: (0, utils_1.getOutputKey)('copied_files', outputPrefix),
value: copiedFiles.paths, value: copiedFiles.paths,
writeOutputFiles: inputs.writeOutputFiles, writeOutputFiles: inputs.writeOutputFiles,
outputDir: inputs.outputDir, outputDir: inputs.outputDir,
@@ -402,7 +477,7 @@ const setChangedFilesOutput = ({ allDiffFiles, allFilteredDiffFiles, inputs, fil
shouldEscape: inputs.escapeJson shouldEscape: inputs.escapeJson
}); });
yield (0, utils_1.setOutput)({ yield (0, utils_1.setOutput)({
key: getOutputKey('copied_files_count', outputPrefix), key: (0, utils_1.getOutputKey)('copied_files_count', outputPrefix),
value: copiedFiles.count, value: copiedFiles.count,
writeOutputFiles: inputs.writeOutputFiles, writeOutputFiles: inputs.writeOutputFiles,
outputDir: inputs.outputDir outputDir: inputs.outputDir
@@ -414,7 +489,7 @@ const setChangedFilesOutput = ({ allDiffFiles, allFilteredDiffFiles, inputs, fil
}); });
core.debug(`Modified files: ${JSON.stringify(modifiedFiles)}`); core.debug(`Modified files: ${JSON.stringify(modifiedFiles)}`);
yield (0, utils_1.setOutput)({ yield (0, utils_1.setOutput)({
key: getOutputKey('modified_files', outputPrefix), key: (0, utils_1.getOutputKey)('modified_files', outputPrefix),
value: modifiedFiles.paths, value: modifiedFiles.paths,
writeOutputFiles: inputs.writeOutputFiles, writeOutputFiles: inputs.writeOutputFiles,
outputDir: inputs.outputDir, outputDir: inputs.outputDir,
@@ -422,7 +497,7 @@ const setChangedFilesOutput = ({ allDiffFiles, allFilteredDiffFiles, inputs, fil
shouldEscape: inputs.escapeJson shouldEscape: inputs.escapeJson
}); });
yield (0, utils_1.setOutput)({ yield (0, utils_1.setOutput)({
key: getOutputKey('modified_files_count', outputPrefix), key: (0, utils_1.getOutputKey)('modified_files_count', outputPrefix),
value: modifiedFiles.count, value: modifiedFiles.count,
writeOutputFiles: inputs.writeOutputFiles, writeOutputFiles: inputs.writeOutputFiles,
outputDir: inputs.outputDir outputDir: inputs.outputDir
@@ -434,7 +509,7 @@ const setChangedFilesOutput = ({ allDiffFiles, allFilteredDiffFiles, inputs, fil
}); });
core.debug(`Renamed files: ${JSON.stringify(renamedFiles)}`); core.debug(`Renamed files: ${JSON.stringify(renamedFiles)}`);
yield (0, utils_1.setOutput)({ yield (0, utils_1.setOutput)({
key: getOutputKey('renamed_files', outputPrefix), key: (0, utils_1.getOutputKey)('renamed_files', outputPrefix),
value: renamedFiles.paths, value: renamedFiles.paths,
writeOutputFiles: inputs.writeOutputFiles, writeOutputFiles: inputs.writeOutputFiles,
outputDir: inputs.outputDir, outputDir: inputs.outputDir,
@@ -442,7 +517,7 @@ const setChangedFilesOutput = ({ allDiffFiles, allFilteredDiffFiles, inputs, fil
shouldEscape: inputs.escapeJson shouldEscape: inputs.escapeJson
}); });
yield (0, utils_1.setOutput)({ yield (0, utils_1.setOutput)({
key: getOutputKey('renamed_files_count', outputPrefix), key: (0, utils_1.getOutputKey)('renamed_files_count', outputPrefix),
value: renamedFiles.count, value: renamedFiles.count,
writeOutputFiles: inputs.writeOutputFiles, writeOutputFiles: inputs.writeOutputFiles,
outputDir: inputs.outputDir outputDir: inputs.outputDir
@@ -454,7 +529,7 @@ const setChangedFilesOutput = ({ allDiffFiles, allFilteredDiffFiles, inputs, fil
}); });
core.debug(`Type changed files: ${JSON.stringify(typeChangedFiles)}`); core.debug(`Type changed files: ${JSON.stringify(typeChangedFiles)}`);
yield (0, utils_1.setOutput)({ yield (0, utils_1.setOutput)({
key: getOutputKey('type_changed_files', outputPrefix), key: (0, utils_1.getOutputKey)('type_changed_files', outputPrefix),
value: typeChangedFiles.paths, value: typeChangedFiles.paths,
writeOutputFiles: inputs.writeOutputFiles, writeOutputFiles: inputs.writeOutputFiles,
outputDir: inputs.outputDir, outputDir: inputs.outputDir,
@@ -462,7 +537,7 @@ const setChangedFilesOutput = ({ allDiffFiles, allFilteredDiffFiles, inputs, fil
shouldEscape: inputs.escapeJson shouldEscape: inputs.escapeJson
}); });
yield (0, utils_1.setOutput)({ 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, value: typeChangedFiles.count,
writeOutputFiles: inputs.writeOutputFiles, writeOutputFiles: inputs.writeOutputFiles,
outputDir: inputs.outputDir outputDir: inputs.outputDir
@@ -474,7 +549,7 @@ const setChangedFilesOutput = ({ allDiffFiles, allFilteredDiffFiles, inputs, fil
}); });
core.debug(`Unmerged files: ${JSON.stringify(unmergedFiles)}`); core.debug(`Unmerged files: ${JSON.stringify(unmergedFiles)}`);
yield (0, utils_1.setOutput)({ yield (0, utils_1.setOutput)({
key: getOutputKey('unmerged_files', outputPrefix), key: (0, utils_1.getOutputKey)('unmerged_files', outputPrefix),
value: unmergedFiles.paths, value: unmergedFiles.paths,
writeOutputFiles: inputs.writeOutputFiles, writeOutputFiles: inputs.writeOutputFiles,
outputDir: inputs.outputDir, outputDir: inputs.outputDir,
@@ -482,7 +557,7 @@ const setChangedFilesOutput = ({ allDiffFiles, allFilteredDiffFiles, inputs, fil
shouldEscape: inputs.escapeJson shouldEscape: inputs.escapeJson
}); });
yield (0, utils_1.setOutput)({ yield (0, utils_1.setOutput)({
key: getOutputKey('unmerged_files_count', outputPrefix), key: (0, utils_1.getOutputKey)('unmerged_files_count', outputPrefix),
value: unmergedFiles.count, value: unmergedFiles.count,
writeOutputFiles: inputs.writeOutputFiles, writeOutputFiles: inputs.writeOutputFiles,
outputDir: inputs.outputDir outputDir: inputs.outputDir
@@ -494,7 +569,7 @@ const setChangedFilesOutput = ({ allDiffFiles, allFilteredDiffFiles, inputs, fil
}); });
core.debug(`Unknown files: ${JSON.stringify(unknownFiles)}`); core.debug(`Unknown files: ${JSON.stringify(unknownFiles)}`);
yield (0, utils_1.setOutput)({ yield (0, utils_1.setOutput)({
key: getOutputKey('unknown_files', outputPrefix), key: (0, utils_1.getOutputKey)('unknown_files', outputPrefix),
value: unknownFiles.paths, value: unknownFiles.paths,
writeOutputFiles: inputs.writeOutputFiles, writeOutputFiles: inputs.writeOutputFiles,
outputDir: inputs.outputDir, outputDir: inputs.outputDir,
@@ -502,7 +577,7 @@ const setChangedFilesOutput = ({ allDiffFiles, allFilteredDiffFiles, inputs, fil
shouldEscape: inputs.escapeJson shouldEscape: inputs.escapeJson
}); });
yield (0, utils_1.setOutput)({ yield (0, utils_1.setOutput)({
key: getOutputKey('unknown_files_count', outputPrefix), key: (0, utils_1.getOutputKey)('unknown_files_count', outputPrefix),
value: unknownFiles.count, value: unknownFiles.count,
writeOutputFiles: inputs.writeOutputFiles, writeOutputFiles: inputs.writeOutputFiles,
outputDir: inputs.outputDir outputDir: inputs.outputDir
@@ -513,7 +588,7 @@ const setChangedFilesOutput = ({ allDiffFiles, allFilteredDiffFiles, inputs, fil
}); });
core.debug(`All changed and modified files: ${JSON.stringify(allChangedAndModifiedFiles)}`); core.debug(`All changed and modified files: ${JSON.stringify(allChangedAndModifiedFiles)}`);
yield (0, utils_1.setOutput)({ 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, value: allChangedAndModifiedFiles.paths,
writeOutputFiles: inputs.writeOutputFiles, writeOutputFiles: inputs.writeOutputFiles,
outputDir: inputs.outputDir, outputDir: inputs.outputDir,
@@ -521,7 +596,7 @@ const setChangedFilesOutput = ({ allDiffFiles, allFilteredDiffFiles, inputs, fil
shouldEscape: inputs.escapeJson shouldEscape: inputs.escapeJson
}); });
yield (0, utils_1.setOutput)({ 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, value: allChangedAndModifiedFiles.count,
writeOutputFiles: inputs.writeOutputFiles, writeOutputFiles: inputs.writeOutputFiles,
outputDir: inputs.outputDir outputDir: inputs.outputDir
@@ -538,7 +613,7 @@ const setChangedFilesOutput = ({ allDiffFiles, allFilteredDiffFiles, inputs, fil
}); });
core.debug(`All changed files: ${JSON.stringify(allChangedFiles)}`); core.debug(`All changed files: ${JSON.stringify(allChangedFiles)}`);
yield (0, utils_1.setOutput)({ yield (0, utils_1.setOutput)({
key: getOutputKey('all_changed_files', outputPrefix), key: (0, utils_1.getOutputKey)('all_changed_files', outputPrefix),
value: allChangedFiles.paths, value: allChangedFiles.paths,
writeOutputFiles: inputs.writeOutputFiles, writeOutputFiles: inputs.writeOutputFiles,
outputDir: inputs.outputDir, outputDir: inputs.outputDir,
@@ -546,13 +621,13 @@ const setChangedFilesOutput = ({ allDiffFiles, allFilteredDiffFiles, inputs, fil
shouldEscape: inputs.escapeJson shouldEscape: inputs.escapeJson
}); });
yield (0, utils_1.setOutput)({ 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, value: allChangedFiles.count,
writeOutputFiles: inputs.writeOutputFiles, writeOutputFiles: inputs.writeOutputFiles,
outputDir: inputs.outputDir outputDir: inputs.outputDir
}); });
yield (0, utils_1.setOutput)({ 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, value: allChangedFiles.paths.length > 0 && filePatterns.length > 0,
writeOutputFiles: inputs.writeOutputFiles, writeOutputFiles: inputs.writeOutputFiles,
outputDir: inputs.outputDir, outputDir: inputs.outputDir,
@@ -576,24 +651,20 @@ const setChangedFilesOutput = ({ allDiffFiles, allFilteredDiffFiles, inputs, fil
allChangedFiles.paths.length > 0 && allChangedFiles.paths.length > 0 &&
filePatterns.length > 0; filePatterns.length > 0;
yield (0, utils_1.setOutput)({ yield (0, utils_1.setOutput)({
key: getOutputKey('only_changed', outputPrefix), key: (0, utils_1.getOutputKey)('only_changed', outputPrefix),
value: onlyChanged, value: onlyChanged,
writeOutputFiles: inputs.writeOutputFiles, writeOutputFiles: inputs.writeOutputFiles,
outputDir: inputs.outputDir, outputDir: inputs.outputDir,
json: inputs.json json: inputs.json
}); });
yield (0, utils_1.setOutput)({ yield (0, utils_1.setArrayOutput)({
key: getOutputKey('other_changed_files', outputPrefix), key: 'other_changed_files',
value: inputs.json inputs,
? otherChangedFiles value: otherChangedFiles,
: otherChangedFiles.join(inputs.separator), outputPrefix
writeOutputFiles: inputs.writeOutputFiles,
outputDir: inputs.outputDir,
json: inputs.json,
shouldEscape: inputs.escapeJson
}); });
yield (0, utils_1.setOutput)({ 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(), value: otherChangedFiles.length.toString(),
writeOutputFiles: inputs.writeOutputFiles, writeOutputFiles: inputs.writeOutputFiles,
outputDir: inputs.outputDir outputDir: inputs.outputDir
@@ -611,7 +682,7 @@ const setChangedFilesOutput = ({ allDiffFiles, allFilteredDiffFiles, inputs, fil
}); });
core.debug(`All modified files: ${JSON.stringify(allModifiedFiles)}`); core.debug(`All modified files: ${JSON.stringify(allModifiedFiles)}`);
yield (0, utils_1.setOutput)({ yield (0, utils_1.setOutput)({
key: getOutputKey('all_modified_files', outputPrefix), key: (0, utils_1.getOutputKey)('all_modified_files', outputPrefix),
value: allModifiedFiles.paths, value: allModifiedFiles.paths,
writeOutputFiles: inputs.writeOutputFiles, writeOutputFiles: inputs.writeOutputFiles,
outputDir: inputs.outputDir, outputDir: inputs.outputDir,
@@ -619,13 +690,13 @@ const setChangedFilesOutput = ({ allDiffFiles, allFilteredDiffFiles, inputs, fil
shouldEscape: inputs.escapeJson shouldEscape: inputs.escapeJson
}); });
yield (0, utils_1.setOutput)({ 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, value: allModifiedFiles.count,
writeOutputFiles: inputs.writeOutputFiles, writeOutputFiles: inputs.writeOutputFiles,
outputDir: inputs.outputDir outputDir: inputs.outputDir
}); });
yield (0, utils_1.setOutput)({ 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, value: allModifiedFiles.paths.length > 0 && filePatterns.length > 0,
writeOutputFiles: inputs.writeOutputFiles, writeOutputFiles: inputs.writeOutputFiles,
outputDir: inputs.outputDir, outputDir: inputs.outputDir,
@@ -649,24 +720,20 @@ const setChangedFilesOutput = ({ allDiffFiles, allFilteredDiffFiles, inputs, fil
allModifiedFiles.paths.length > 0 && allModifiedFiles.paths.length > 0 &&
filePatterns.length > 0; filePatterns.length > 0;
yield (0, utils_1.setOutput)({ yield (0, utils_1.setOutput)({
key: getOutputKey('only_modified', outputPrefix), key: (0, utils_1.getOutputKey)('only_modified', outputPrefix),
value: onlyModified, value: onlyModified,
writeOutputFiles: inputs.writeOutputFiles, writeOutputFiles: inputs.writeOutputFiles,
outputDir: inputs.outputDir, outputDir: inputs.outputDir,
json: inputs.json json: inputs.json
}); });
yield (0, utils_1.setOutput)({ yield (0, utils_1.setArrayOutput)({
key: getOutputKey('other_modified_files', outputPrefix), key: 'other_modified_files',
value: inputs.json inputs,
? otherModifiedFiles value: otherModifiedFiles,
: otherModifiedFiles.join(inputs.separator), outputPrefix
writeOutputFiles: inputs.writeOutputFiles,
outputDir: inputs.outputDir,
json: inputs.json,
shouldEscape: inputs.escapeJson
}); });
yield (0, utils_1.setOutput)({ 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(), value: otherModifiedFiles.length.toString(),
writeOutputFiles: inputs.writeOutputFiles, writeOutputFiles: inputs.writeOutputFiles,
outputDir: inputs.outputDir outputDir: inputs.outputDir
@@ -677,8 +744,26 @@ const setChangedFilesOutput = ({ allDiffFiles, allFilteredDiffFiles, inputs, fil
changeTypes: [changedFiles_1.ChangeTypeEnum.Deleted] changeTypes: [changedFiles_1.ChangeTypeEnum.Deleted]
}); });
core.debug(`Deleted files: ${JSON.stringify(deletedFiles)}`); core.debug(`Deleted files: ${JSON.stringify(deletedFiles)}`);
if (inputs.dirNamesDeletedFilesIncludeOnlyDeletedDirs &&
inputs.dirNames &&
workingDirectory) {
const newDeletedFilesPaths = [];
for (const deletedPath of getArrayFromPaths(deletedFiles.paths, inputs)) {
const dirPath = path_1.default.join(workingDirectory, deletedPath);
core.debug(`Checking if directory exists: ${dirPath}`);
if (!(yield (0, utils_1.exists)(dirPath))) {
core.debug(`Directory not found: ${dirPath}`);
newDeletedFilesPaths.push(deletedPath);
}
}
deletedFiles.paths = inputs.json
? newDeletedFilesPaths
: newDeletedFilesPaths.join(inputs.separator);
deletedFiles.count = newDeletedFilesPaths.length.toString();
core.debug(`New deleted files: ${JSON.stringify(deletedFiles)}`);
}
yield (0, utils_1.setOutput)({ yield (0, utils_1.setOutput)({
key: getOutputKey('deleted_files', outputPrefix), key: (0, utils_1.getOutputKey)('deleted_files', outputPrefix),
value: deletedFiles.paths, value: deletedFiles.paths,
writeOutputFiles: inputs.writeOutputFiles, writeOutputFiles: inputs.writeOutputFiles,
outputDir: inputs.outputDir, outputDir: inputs.outputDir,
@@ -686,13 +771,13 @@ const setChangedFilesOutput = ({ allDiffFiles, allFilteredDiffFiles, inputs, fil
shouldEscape: inputs.escapeJson shouldEscape: inputs.escapeJson
}); });
yield (0, utils_1.setOutput)({ yield (0, utils_1.setOutput)({
key: getOutputKey('deleted_files_count', outputPrefix), key: (0, utils_1.getOutputKey)('deleted_files_count', outputPrefix),
value: deletedFiles.count, value: deletedFiles.count,
writeOutputFiles: inputs.writeOutputFiles, writeOutputFiles: inputs.writeOutputFiles,
outputDir: inputs.outputDir outputDir: inputs.outputDir
}); });
yield (0, utils_1.setOutput)({ 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, value: deletedFiles.paths.length > 0 && filePatterns.length > 0,
writeOutputFiles: inputs.writeOutputFiles, writeOutputFiles: inputs.writeOutputFiles,
outputDir: inputs.outputDir, outputDir: inputs.outputDir,
@@ -710,30 +795,30 @@ const setChangedFilesOutput = ({ allDiffFiles, allFilteredDiffFiles, inputs, fil
deletedFiles.paths.length > 0 && deletedFiles.paths.length > 0 &&
filePatterns.length > 0; filePatterns.length > 0;
yield (0, utils_1.setOutput)({ yield (0, utils_1.setOutput)({
key: getOutputKey('only_deleted', outputPrefix), key: (0, utils_1.getOutputKey)('only_deleted', outputPrefix),
value: onlyDeleted, value: onlyDeleted,
writeOutputFiles: inputs.writeOutputFiles, writeOutputFiles: inputs.writeOutputFiles,
outputDir: inputs.outputDir, outputDir: inputs.outputDir,
json: inputs.json json: inputs.json
}); });
yield (0, utils_1.setOutput)({ yield (0, utils_1.setArrayOutput)({
key: getOutputKey('other_deleted_files', outputPrefix), key: 'other_deleted_files',
value: inputs.json inputs,
? otherDeletedFiles value: otherDeletedFiles,
: otherDeletedFiles.join(inputs.separator), outputPrefix
writeOutputFiles: inputs.writeOutputFiles,
outputDir: inputs.outputDir,
json: inputs.json,
shouldEscape: inputs.escapeJson
}); });
yield (0, utils_1.setOutput)({ 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(), value: otherDeletedFiles.length.toString(),
writeOutputFiles: inputs.writeOutputFiles, writeOutputFiles: inputs.writeOutputFiles,
outputDir: inputs.outputDir 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 +1286,8 @@ const getSHAForPullRequestEvent = (inputs, env, workingDirectory, isShallow, has
sha2: currentSha, sha2: currentSha,
diff 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}`); throw new Error(`Unable to determine a difference between ${previousSha}${diff}${currentSha}`);
} }
if (previousSha === currentSha) { if (previousSha === currentSha) {
@@ -1431,6 +1518,9 @@ const getInputs = () => {
const failOnSubmoduleDiffError = core.getBooleanInput('fail_on_submodule_diff_error', { const failOnSubmoduleDiffError = core.getBooleanInput('fail_on_submodule_diff_error', {
required: false required: false
}); });
const dirNamesDeletedFilesIncludeOnlyDeletedDirs = core.getBooleanInput('dir_names_deleted_files_include_only_deleted_dirs', {
required: false
});
const inputs = { const inputs = {
files, files,
filesSeparator, filesSeparator,
@@ -1474,6 +1564,7 @@ const getInputs = () => {
dirNamesExcludeCurrentDir, dirNamesExcludeCurrentDir,
dirNamesIncludeFiles, dirNamesIncludeFiles,
dirNamesIncludeFilesSeparator, dirNamesIncludeFilesSeparator,
dirNamesDeletedFilesIncludeOnlyDeletedDirs,
json, json,
escapeJson, escapeJson,
writeOutputFiles, writeOutputFiles,
@@ -1541,59 +1632,11 @@ const core = __importStar(__nccwpck_require__(2186));
const github = __importStar(__nccwpck_require__(5438)); const github = __importStar(__nccwpck_require__(5438));
const path_1 = __importDefault(__nccwpck_require__(1017)); const path_1 = __importDefault(__nccwpck_require__(1017));
const changedFiles_1 = __nccwpck_require__(7358); const changedFiles_1 = __nccwpck_require__(7358);
const changedFilesOutput_1 = __nccwpck_require__(8930);
const commitSha_1 = __nccwpck_require__(8613); const commitSha_1 = __nccwpck_require__(8613);
const env_1 = __nccwpck_require__(9763); const env_1 = __nccwpck_require__(9763);
const inputs_1 = __nccwpck_require__(6180); const inputs_1 = __nccwpck_require__(6180);
const utils_1 = __nccwpck_require__(918); const utils_1 = __nccwpck_require__(918);
const changedFilesOutput = ({ filePatterns, allDiffFiles, inputs, yamlFilePatterns }) => __awaiter(void 0, void 0, void 0, function* () { const getChangedFilesFromLocalGitHistory = ({ inputs, env, workingDirectory, filePatterns, 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* () {
var _a, _b, _c; var _a, _b, _c;
yield (0, utils_1.verifyMinimumGitVersion)(); yield (0, utils_1.verifyMinimumGitVersion)();
let quotePathValue = 'on'; let quotePathValue = 'on';
@@ -1664,11 +1707,12 @@ const getChangedFilesFromLocalGit = ({ inputs, env, workingDirectory, filePatter
sha: diffResult.previousSha sha: diffResult.previousSha
}); });
} }
yield changedFilesOutput({ yield (0, changedFiles_1.processChangedFiles)({
filePatterns, filePatterns,
allDiffFiles, allDiffFiles,
inputs, inputs,
yamlFilePatterns yamlFilePatterns,
workingDirectory
}); });
if (inputs.includeAllOldNewRenamedFiles) { if (inputs.includeAllOldNewRenamedFiles) {
core.startGroup('changed-files-all-old-new-renamed-files'); core.startGroup('changed-files-all-old-new-renamed-files');
@@ -1704,7 +1748,7 @@ const getChangedFilesFromRESTAPI = ({ inputs, filePatterns, yamlFilePatterns })
}); });
core.debug(`All diff files: ${JSON.stringify(allDiffFiles)}`); core.debug(`All diff files: ${JSON.stringify(allDiffFiles)}`);
core.info('All Done!'); core.info('All Done!');
yield changedFilesOutput({ yield (0, changedFiles_1.processChangedFiles)({
filePatterns, filePatterns,
allDiffFiles, allDiffFiles,
inputs, inputs,
@@ -1769,7 +1813,7 @@ function run() {
return; return;
} }
core.info('Using local .git directory'); core.info('Using local .git directory');
yield getChangedFilesFromLocalGit({ yield getChangedFilesFromLocalGitHistory({
inputs, inputs,
env, env,
workingDirectory, workingDirectory,
@@ -1851,7 +1895,7 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
return (mod && mod.__esModule) ? mod : { "default": mod }; return (mod && mod.__esModule) ? mod : { "default": mod };
}; };
Object.defineProperty(exports, "__esModule", ({ value: true })); 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.exists = exports.verifyMinimumGitVersion = exports.getDirname = exports.normalizeSeparators = exports.isWindows = void 0;
/*global AsyncIterableIterator*/ /*global AsyncIterableIterator*/
const core = __importStar(__nccwpck_require__(2186)); const core = __importStar(__nccwpck_require__(2186));
const exec = __importStar(__nccwpck_require__(1514)); const exec = __importStar(__nccwpck_require__(1514));
@@ -1977,6 +2021,7 @@ const exists = (filePath) => __awaiter(void 0, void 0, void 0, function* () {
return false; return false;
} }
}); });
exports.exists = exists;
/** /**
* Generates lines of a file as an async iterable iterator * Generates lines of a file as an async iterable iterator
* @param filePath - path of file to read * @param filePath - path of file to read
@@ -2548,7 +2593,7 @@ const getYamlFilePatternsFromContents = ({ content = '', filePath = '', excluded
const filePatterns = {}; const filePatterns = {};
let source = ''; let source = '';
if (filePath) { if (filePath) {
if (!(yield exists(filePath))) { if (!(yield (0, exports.exists)(filePath))) {
core.error(`File does not exist: ${filePath}`); core.error(`File does not exist: ${filePath}`);
throw new Error(`File does not exist: ${filePath}`); throw new Error(`File does not exist: ${filePath}`);
} }
@@ -2672,6 +2717,22 @@ const getRecoverFilePatterns = ({ inputs }) => {
return filePatterns.filter(Boolean); return filePatterns.filter(Boolean);
}; };
exports.getRecoverFilePatterns = getRecoverFilePatterns; 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* () { const setOutput = ({ key, value, writeOutputFiles, outputDir, json = false, shouldEscape = false }) => __awaiter(void 0, void 0, void 0, function* () {
let cleanedValue; let cleanedValue;
if (json) { if (json) {
@@ -2684,7 +2745,7 @@ const setOutput = ({ key, value, writeOutputFiles, outputDir, json = false, shou
if (writeOutputFiles) { if (writeOutputFiles) {
const extension = json ? 'json' : 'txt'; const extension = json ? 'json' : 'txt';
const outputFilePath = path.join(outputDir, `${key}.${extension}`); const outputFilePath = path.join(outputDir, `${key}.${extension}`);
if (!(yield exists(outputDir))) { if (!(yield (0, exports.exists)(outputDir))) {
yield fs_1.promises.mkdir(outputDir, { recursive: true }); yield fs_1.promises.mkdir(outputDir, { recursive: true });
} }
yield fs_1.promises.writeFile(outputFilePath, cleanedValue.replace(/\\"/g, '"')); yield fs_1.promises.writeFile(outputFilePath, cleanedValue.replace(/\\"/g, '"'));
@@ -2723,7 +2784,7 @@ const recoverDeletedFiles = ({ inputs, workingDirectory, deletedFiles, recoverPa
filePath: deletedFile, filePath: deletedFile,
sha sha
}); });
if (!(yield exists(path.dirname(target)))) { if (!(yield (0, exports.exists)(path.dirname(target)))) {
yield fs_1.promises.mkdir(path.dirname(target), { recursive: true }); yield fs_1.promises.mkdir(path.dirname(target), { recursive: true });
} }
yield fs_1.promises.writeFile(target, deletedFileContents); yield fs_1.promises.writeFile(target, deletedFileContents);

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", "name": "@tj-actions/changed-files",
"version": "39.0.1", "version": "39.1.2",
"description": "Github action to retrieve all (added, copied, modified, deleted, renamed, type changed, unmerged, unknown) files and directories.", "description": "Github action to retrieve all (added, copied, modified, deleted, renamed, type changed, unmerged, unknown) files and directories.",
"main": "lib/main.js", "main": "lib/main.js",
"publishConfig": { "publishConfig": {

View File

@@ -4,7 +4,7 @@ import type {RestEndpointMethodTypes} from '@octokit/rest'
import flatten from 'lodash/flatten' import flatten from 'lodash/flatten'
import mm from 'micromatch' import mm from 'micromatch'
import * as path from 'path' import * as path from 'path'
import {setOutputsAndGetModifiedAndChangedFilesStatus} from './changedFilesOutput'
import {DiffResult} from './commitSha' import {DiffResult} from './commitSha'
import {Inputs} from './inputs' import {Inputs} from './inputs'
import { import {
@@ -12,12 +12,112 @@ import {
getAllChangedFiles, getAllChangedFiles,
getDirnameMaxDepth, getDirnameMaxDepth,
getDirNamesIncludeFilesPattern, getDirNamesIncludeFilesPattern,
getFilteredChangedFiles,
gitRenamedFiles, gitRenamedFiles,
gitSubmoduleDiffSHA, gitSubmoduleDiffSHA,
isWindows, isWindows,
jsonOutput jsonOutput,
setArrayOutput
} from './utils' } from './utils'
export const processChangedFiles = async ({
filePatterns,
allDiffFiles,
inputs,
yamlFilePatterns,
workingDirectory
}: {
filePatterns: string[]
allDiffFiles: ChangedFiles
inputs: Inputs
yamlFilePatterns: Record<string, string[]>
workingDirectory?: 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,
workingDirectory
})
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,
workingDirectory
})
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,
workingDirectory
})
core.info('All Done!')
core.endGroup()
}
}
export const getRenamedFiles = async ({ export const getRenamedFiles = async ({
inputs, inputs,
workingDirectory, workingDirectory,

View File

@@ -1,4 +1,5 @@
import * as core from '@actions/core' import * as core from '@actions/core'
import path from 'path'
import { import {
ChangedFiles, ChangedFiles,
ChangeTypeEnum, ChangeTypeEnum,
@@ -6,11 +7,7 @@ import {
getChangeTypeFiles getChangeTypeFiles
} from './changedFiles' } from './changedFiles'
import {Inputs} from './inputs' import {Inputs} from './inputs'
import {setOutput} from './utils' import {getOutputKey, setArrayOutput, setOutput, exists} from './utils'
const getOutputKey = (key: string, outputPrefix: string): string => {
return outputPrefix ? `${outputPrefix}_${key}` : key
}
const getArrayFromPaths = ( const getArrayFromPaths = (
paths: string | string[], paths: string | string[],
@@ -19,19 +16,21 @@ const getArrayFromPaths = (
return Array.isArray(paths) ? paths : paths.split(inputs.separator) return Array.isArray(paths) ? paths : paths.split(inputs.separator)
} }
export const setChangedFilesOutput = async ({ export const setOutputsAndGetModifiedAndChangedFilesStatus = async ({
allDiffFiles, allDiffFiles,
allFilteredDiffFiles, allFilteredDiffFiles,
inputs, inputs,
filePatterns = [], filePatterns = [],
outputPrefix = '' outputPrefix = '',
workingDirectory
}: { }: {
allDiffFiles: ChangedFiles allDiffFiles: ChangedFiles
allFilteredDiffFiles: ChangedFiles allFilteredDiffFiles: ChangedFiles
inputs: Inputs inputs: Inputs
filePatterns?: string[] filePatterns?: string[]
outputPrefix?: string outputPrefix?: string
}): Promise<void> => { workingDirectory?: string
}): Promise<{anyModified: boolean; anyChanged: boolean}> => {
const addedFiles = await getChangeTypeFiles({ const addedFiles = await getChangeTypeFiles({
inputs, inputs,
changedFiles: allFilteredDiffFiles, changedFiles: allFilteredDiffFiles,
@@ -283,15 +282,11 @@ export const setChangedFilesOutput = async ({
json: inputs.json json: inputs.json
}) })
await setOutput({ await setArrayOutput({
key: getOutputKey('other_changed_files', outputPrefix), key: 'other_changed_files',
value: inputs.json inputs,
? otherChangedFiles value: otherChangedFiles,
: otherChangedFiles.join(inputs.separator), outputPrefix
writeOutputFiles: inputs.writeOutputFiles,
outputDir: inputs.outputDir,
json: inputs.json,
shouldEscape: inputs.escapeJson
}) })
await setOutput({ await setOutput({
@@ -376,15 +371,11 @@ export const setChangedFilesOutput = async ({
json: inputs.json json: inputs.json
}) })
await setOutput({ await setArrayOutput({
key: getOutputKey('other_modified_files', outputPrefix), key: 'other_modified_files',
value: inputs.json inputs,
? otherModifiedFiles value: otherModifiedFiles,
: otherModifiedFiles.join(inputs.separator), outputPrefix
writeOutputFiles: inputs.writeOutputFiles,
outputDir: inputs.outputDir,
json: inputs.json,
shouldEscape: inputs.escapeJson
}) })
await setOutput({ await setOutput({
@@ -400,6 +391,28 @@ export const setChangedFilesOutput = async ({
changeTypes: [ChangeTypeEnum.Deleted] changeTypes: [ChangeTypeEnum.Deleted]
}) })
core.debug(`Deleted files: ${JSON.stringify(deletedFiles)}`) core.debug(`Deleted files: ${JSON.stringify(deletedFiles)}`)
if (
inputs.dirNamesDeletedFilesIncludeOnlyDeletedDirs &&
inputs.dirNames &&
workingDirectory
) {
const newDeletedFilesPaths: string[] = []
for (const deletedPath of getArrayFromPaths(deletedFiles.paths, inputs)) {
const dirPath = path.join(workingDirectory, deletedPath)
core.debug(`Checking if directory exists: ${dirPath}`)
if (!(await exists(dirPath))) {
core.debug(`Directory not found: ${dirPath}`)
newDeletedFilesPaths.push(deletedPath)
}
}
deletedFiles.paths = inputs.json
? newDeletedFilesPaths
: newDeletedFilesPaths.join(inputs.separator)
deletedFiles.count = newDeletedFilesPaths.length.toString()
core.debug(`New deleted files: ${JSON.stringify(deletedFiles)}`)
}
await setOutput({ await setOutput({
key: getOutputKey('deleted_files', outputPrefix), key: getOutputKey('deleted_files', outputPrefix),
value: deletedFiles.paths, value: deletedFiles.paths,
@@ -457,15 +470,11 @@ export const setChangedFilesOutput = async ({
json: inputs.json json: inputs.json
}) })
await setOutput({ await setArrayOutput({
key: getOutputKey('other_deleted_files', outputPrefix), key: 'other_deleted_files',
value: inputs.json inputs,
? otherDeletedFiles value: otherDeletedFiles,
: otherDeletedFiles.join(inputs.separator), outputPrefix
writeOutputFiles: inputs.writeOutputFiles,
outputDir: inputs.outputDir,
json: inputs.json,
shouldEscape: inputs.escapeJson
}) })
await setOutput({ await setOutput({
@@ -474,4 +483,9 @@ export const setChangedFilesOutput = async ({
writeOutputFiles: inputs.writeOutputFiles, writeOutputFiles: inputs.writeOutputFiles,
outputDir: inputs.outputDir 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 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( throw new Error(
`Unable to determine a difference between ${previousSha}${diff}${currentSha}` `Unable to determine a difference between ${previousSha}${diff}${currentSha}`
) )

View File

@@ -31,6 +31,7 @@ export type Inputs = {
dirNamesExcludeCurrentDir: boolean dirNamesExcludeCurrentDir: boolean
dirNamesIncludeFiles: string dirNamesIncludeFiles: string
dirNamesIncludeFilesSeparator: string dirNamesIncludeFilesSeparator: string
dirNamesDeletedFilesIncludeOnlyDeletedDirs: boolean
json: boolean json: boolean
escapeJson: boolean escapeJson: boolean
fetchDepth?: number fetchDepth?: number
@@ -210,6 +211,12 @@ export const getInputs = (): Inputs => {
required: false required: false
} }
) )
const dirNamesDeletedFilesIncludeOnlyDeletedDirs = core.getBooleanInput(
'dir_names_deleted_files_include_only_deleted_dirs',
{
required: false
}
)
const inputs: Inputs = { const inputs: Inputs = {
files, files,
@@ -254,6 +261,7 @@ export const getInputs = (): Inputs => {
dirNamesExcludeCurrentDir, dirNamesExcludeCurrentDir,
dirNamesIncludeFiles, dirNamesIncludeFiles,
dirNamesIncludeFilesSeparator, dirNamesIncludeFilesSeparator,
dirNamesDeletedFilesIncludeOnlyDeletedDirs,
json, json,
escapeJson, escapeJson,
writeOutputFiles, writeOutputFiles,

View File

@@ -2,13 +2,12 @@ import * as core from '@actions/core'
import * as github from '@actions/github' import * as github from '@actions/github'
import path from 'path' import path from 'path'
import { import {
ChangedFiles, processChangedFiles,
ChangeTypeEnum, ChangeTypeEnum,
getAllDiffFiles, getAllDiffFiles,
getChangedFilesFromGithubAPI, getChangedFilesFromGithubAPI,
getRenamedFiles getRenamedFiles
} from './changedFiles' } from './changedFiles'
import {setChangedFilesOutput} from './changedFilesOutput'
import { import {
DiffResult, DiffResult,
getSHAForNonPullRequestEvent, getSHAForNonPullRequestEvent,
@@ -18,7 +17,6 @@ import {Env, getEnv} from './env'
import {getInputs, Inputs} from './inputs' import {getInputs, Inputs} from './inputs'
import { import {
getFilePatterns, getFilePatterns,
getFilteredChangedFiles,
getRecoverFilePatterns, getRecoverFilePatterns,
getSubmodulePath, getSubmodulePath,
getYamlFilePatterns, getYamlFilePatterns,
@@ -31,73 +29,7 @@ import {
verifyMinimumGitVersion verifyMinimumGitVersion
} from './utils' } from './utils'
const changedFilesOutput = async ({ const getChangedFilesFromLocalGitHistory = 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 ({
inputs, inputs,
env, env,
workingDirectory, workingDirectory,
@@ -216,11 +148,12 @@ const getChangedFilesFromLocalGit = async ({
}) })
} }
await changedFilesOutput({ await processChangedFiles({
filePatterns, filePatterns,
allDiffFiles, allDiffFiles,
inputs, inputs,
yamlFilePatterns yamlFilePatterns,
workingDirectory
}) })
if (inputs.includeAllOldNewRenamedFiles) { if (inputs.includeAllOldNewRenamedFiles) {
@@ -267,7 +200,7 @@ const getChangedFilesFromRESTAPI = async ({
core.debug(`All diff files: ${JSON.stringify(allDiffFiles)}`) core.debug(`All diff files: ${JSON.stringify(allDiffFiles)}`)
core.info('All Done!') core.info('All Done!')
await changedFilesOutput({ await processChangedFiles({
filePatterns, filePatterns,
allDiffFiles, allDiffFiles,
inputs, inputs,
@@ -349,7 +282,7 @@ export async function run(): Promise<void> {
} }
core.info('Using local .git directory') core.info('Using local .git directory')
await getChangedFilesFromLocalGit({ await getChangedFilesFromLocalGitHistory({
inputs, inputs,
env, env,
workingDirectory, workingDirectory,

View File

@@ -9,7 +9,6 @@ import * as path from 'path'
import {createInterface} from 'readline' import {createInterface} from 'readline'
import {parseDocument} from 'yaml' import {parseDocument} from 'yaml'
import {ChangedFiles, ChangeTypeEnum} from './changedFiles' import {ChangedFiles, ChangeTypeEnum} from './changedFiles'
import {Inputs} from './inputs' import {Inputs} from './inputs'
const MINIMUM_GIT_VERSION = '2.18.0' const MINIMUM_GIT_VERSION = '2.18.0'
@@ -140,7 +139,7 @@ export const verifyMinimumGitVersion = async (): Promise<void> => {
* @param filePath - path to check * @param filePath - path to check
* @returns path exists * @returns path exists
*/ */
const exists = async (filePath: string): Promise<boolean> => { export const exists = async (filePath: string): Promise<boolean> => {
try { try {
await fs.access(filePath) await fs.access(filePath)
return true return true
@@ -1223,6 +1222,32 @@ export const getRecoverFilePatterns = ({
return filePatterns.filter(Boolean) 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 ({ export const setOutput = async ({
key, key,
value, value,

901
yarn.lock

File diff suppressed because it is too large Load Diff