Compare commits

...

89 Commits

Author SHA1 Message Date
tj-actions[bot]
39283171ce Updated README.md (#1391)
Co-authored-by: repo-ranger[bot] <repo-ranger[bot]@users.noreply.github.com>
2023-07-19 01:53:16 -06:00
Tonye Jack
33288d37e7 feat: add support for restricting recoverable deleted files via patterns (#1390)
Co-authored-by: GitHub Action <action@github.com>
2023-07-19 07:50:59 +00:00
tj-actions[bot]
b60277dde9 Upgraded to v37.2.0 (#1389)
Co-authored-by: jackton1 <jackton1@users.noreply.github.com>
2023-07-19 05:43:20 +00:00
renovate[bot]
68b429ddc6 chore(deps): update dependency eslint-plugin-github to v4.9.2 (#1388)
Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>
2023-07-18 17:41:01 +00:00
Tonye Jack
ec0b6d0e4c chore: switch to use the github context (#1386)
Co-authored-by: GitHub Action <action@github.com>
2023-07-18 03:44:59 -06:00
Tonye Jack
e3ea6b7948 Update README.md 2023-07-18 02:56:15 -06:00
renovate[bot]
8c8be234b2 chore(deps): update dependency eslint-plugin-github to v4.9.1 (#1387)
Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>
2023-07-18 01:31:59 +00:00
renovate[bot]
029d6cd6b8 chore(deps): update typescript-eslint monorepo to v6.1.0 (#1385)
Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>
2023-07-17 17:56:41 +00:00
renovate[bot]
8fc95ea175 chore(deps): lock file maintenance (#1383)
Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>
2023-07-17 01:32:34 +00:00
renovate[bot]
3e2a2ce2d0 chore(deps): lock file maintenance (#1382)
Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>
2023-07-15 06:46:23 +00:00
renovate[bot]
4aebdafc0b chore(deps): update dependency eslint to v8.45.0 (#1381)
Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>
2023-07-14 18:05:35 +00:00
tj-actions[bot]
2aadab2297 Upgraded to v37.1.2 (#1378)
Co-authored-by: jackton1 <jackton1@users.noreply.github.com>
2023-07-13 13:04:06 -06:00
Tonye Jack
2a968ff601 fix: excluding current dir with max depth less than 2 (#1375)
Co-authored-by: tj-actions[bot] <109116665+tj-actions-bot@users.noreply.github.com>
Co-authored-by: GitHub Action <action@github.com>
2023-07-13 13:01:23 -06:00
renovate[bot]
ef327f98b5 chore(deps): update dependency eslint-plugin-github to v4.9.0 (#1377)
Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>
2023-07-13 16:58:52 +00:00
renovate[bot]
5c1cab8429 chore(deps): update dependency eslint-plugin-jest to v27.2.3 (#1376)
Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>
2023-07-13 16:42:50 +00:00
renovate[bot]
60e7ac7c28 chore(deps): update dependency @types/node to v20.4.2 (#1372)
Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>
Co-authored-by: repo-ranger[bot] <39074581+repo-ranger[bot]@users.noreply.github.com>
2023-07-13 00:54:16 +00:00
tj-actions[bot]
fe91ab72f6 Updated README.md (#1373)
Co-authored-by: jackton1 <jackton1@users.noreply.github.com>
2023-07-13 00:36:36 +00:00
Tonye Jack
cc23ede837 Update README.md 2023-07-12 18:03:18 -06:00
Tonye Jack
76dc7bcd3f chore: Update README.md (#1371) 2023-07-12 16:30:41 -06:00
Tonye Jack
c7072f0969 chore: improve test coverage (#1369) 2023-07-12 13:09:45 +00:00
tj-actions[bot]
032079bf7f Updated README.md (#1368)
Co-authored-by: jackton1 <jackton1@users.noreply.github.com>
2023-07-11 18:49:00 -06:00
Tonye Jack
21ccb43669 Update action.yml 2023-07-11 18:40:13 -06:00
tj-actions[bot]
038a51af80 Updated README.md (#1367)
Co-authored-by: jackton1 <jackton1@users.noreply.github.com>
2023-07-11 18:35:24 -06:00
Tonye Jack
a5f4b54b5f chore: update readme to include downsides of skipping the initial fetch 2023-07-11 18:34:10 -06:00
renovate[bot]
61e9ed7dab chore(deps): update dependency eslint-plugin-prettier to v5.0.0 (#1364)
Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>
2023-07-11 11:10:04 +00:00
Tonye Jack
c6c396f2fe Update README.md 2023-07-10 21:40:47 -06:00
Tonye Jack
7f05b89187 Update README.md 2023-07-10 21:39:12 -06:00
tj-actions[bot]
139cb86a77 Upgraded to v37.1.1 (#1363)
Co-authored-by: jackton1 <jackton1@users.noreply.github.com>
2023-07-10 20:16:00 -06:00
Tonye Jack
97365f6cd2 Update README.md 2023-07-10 20:15:23 -06:00
dependabot[bot]
1f20fb83f0 chore(deps): bump semver from 6.3.0 to 6.3.1 (#1362)
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2023-07-10 20:05:24 -06:00
renovate[bot]
51647add79 chore(deps): update typescript-eslint monorepo to v6 (major) (#1360)
Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>
2023-07-10 22:39:33 +00:00
renovate[bot]
6c6532459a chore(deps): update typescript-eslint monorepo to v5.62.0 (#1359)
Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>
Co-authored-by: repo-ranger[bot] <39074581+repo-ranger[bot]@users.noreply.github.com>
2023-07-10 21:50:50 +00:00
tj-actions[bot]
f53b75ef58 Updated README.md (#1361)
Co-authored-by: jackton1 <jackton1@users.noreply.github.com>
2023-07-10 14:45:11 -06:00
Tonye Jack
732c1a14e7 Update README.md 2023-07-10 14:25:04 -06:00
renovate[bot]
3ab0d43f2c chore(deps): update dependency @types/jest to v29.5.3 (#1358)
Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>
2023-07-10 20:18:09 +00:00
Tonye Jack
de17e6cdf2 Update README.md 2023-07-09 20:31:01 -06:00
renovate[bot]
c7bb50a40c chore(deps): lock file maintenance (#1356)
Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>
2023-07-10 01:07:00 +00:00
tj-actions[bot]
fe12e8f13f Upgraded to v37.1.0 (#1355)
Co-authored-by: jackton1 <jackton1@users.noreply.github.com>
2023-07-09 14:08:19 +00:00
tj-actions[bot]
87e23c4c79 Updated README.md (#1354)
Co-authored-by: repo-ranger[bot] <repo-ranger[bot]@users.noreply.github.com>
2023-07-09 09:35:22 +00:00
Tonye Jack
2f49eb9ee1 feat: add support for skipping initial fetch (#1353)
Co-authored-by: GitHub Action <action@github.com>
2023-07-09 09:19:14 +00:00
Tonye Jack
00b3d3d9e7 Update README.md 2023-07-09 02:54:05 -06:00
dependabot[bot]
19193bdb26 chore(deps-dev): bump prettier from 2.8.8 to 3.0.0 (#1345)
Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
Co-authored-by: Tonye Jack <jtonye@ymail.com>
2023-07-09 08:46:27 +00:00
renovate[bot]
d12b5fc2ab chore(deps): update dependency @types/node to v20.4.1 (#1351)
Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>
2023-07-08 01:31:42 +00:00
renovate[bot]
338f354106 chore(deps): update dependency jest to v29.6.1 (#1350)
Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>
2023-07-06 16:06:00 +00:00
Tonye Jack
626a6b7213 Update README.md 2023-07-06 09:34:48 -06:00
renovate[bot]
090f90127a chore(deps): lock file maintenance (#1349)
Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>
2023-07-06 00:54:01 +00:00
dependabot[bot]
598640f3be chore(deps-dev): bump @types/node from 20.3.3 to 20.4.0 (#1348)
Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2023-07-05 23:47:02 +00:00
Tonye Jack
7ee3290f25 Update dependabot.yml 2023-07-05 17:12:18 -06:00
Tonye Jack
e9eccdd473 Updated renovate.json 2023-07-05 12:20:56 -06:00
Tonye Jack
6dc8c796c9 Update dependabot.yml 2023-07-05 12:00:16 -06:00
Tonye Jack
d1028b2eb8 Deleted .github/workflows/auto-merge.yml 2023-07-05 11:57:34 -06:00
renovate[bot]
0e24cebad0 chore(deps): update actions/setup-node action to v3.7.0 (#1344)
Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>
2023-07-05 17:07:42 +00:00
renovate[bot]
d8f8ad9a74 chore(deps): lock file maintenance (#1342)
Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>
2023-07-05 01:22:00 +00:00
renovate[bot]
47a703e935 chore(deps): update dependency jest to v29.6.0 (#1341)
Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>
2023-07-04 17:30:37 +00:00
Tonye Jack
742b6417b4 chore: update filter pattern (#1340) 2023-07-03 15:30:44 -06:00
renovate[bot]
af9376f801 chore(deps): update typescript-eslint monorepo to v5.61.0 (#1339)
Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>
2023-07-03 19:47:32 +00:00
renovate[bot]
adaff22ded chore(deps): lock file maintenance (#1338)
Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>
2023-07-03 00:32:10 +00:00
renovate[bot]
2cd4de3431 chore(deps): update dependency eslint to v8.44.0 (#1337)
Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>
2023-07-01 05:44:33 +00:00
renovate[bot]
b199521773 chore(deps): update dependency @types/node to v20.3.3 (#1336)
Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>
2023-07-01 05:19:19 +00:00
renovate[bot]
aecc5ebeee chore(deps): update dependency ts-jest to v29.1.1 (#1333)
Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>
2023-06-30 11:08:45 +00:00
tj-actions[bot]
630aa37bbd Upgraded to v37.0.5 (#1332)
Co-authored-by: jackton1 <jackton1@users.noreply.github.com>
Co-authored-by: repo-ranger[bot] <39074581+repo-ranger[bot]@users.noreply.github.com>
2023-06-29 21:21:56 +00:00
renovate[bot]
c060576a37 chore(deps): lock file maintenance (#1331)
Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>
Co-authored-by: GitHub Action <action@github.com>
2023-06-29 21:06:16 +00:00
renovate[bot]
54849deb96 chore(deps): lock file maintenance (#1330)
Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>
2023-06-29 16:14:26 +00:00
Tonye Jack
034e423c9c Update README.md 2023-06-29 09:51:19 -06:00
tj-actions[bot]
89c31817b2 Updated README.md (#1329)
Co-authored-by: jackton1 <jackton1@users.noreply.github.com>
2023-06-28 19:33:09 -06:00
Tonye Jack
e42f43b67b Update README.md 2023-06-28 19:31:20 -06:00
Tonye Jack
6fdb8b53b3 chore: update README.md 2023-06-28 19:29:52 -06:00
renovate[bot]
3323f78bb4 chore(deps): update dependency typescript to v5.1.6 (#1328)
Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>
2023-06-29 00:37:25 +00:00
Tonye Jack
fe20777b56 Update README.md 2023-06-28 01:28:09 -06:00
Tonye Jack
89890d6f77 Update README.md 2023-06-28 01:24:42 -06:00
renovate[bot]
927a8c5ba3 chore(deps): update dependency typescript to v5.1.5 (#1324)
Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>
2023-06-27 23:40:51 +00:00
tj-actions[bot]
5e7542fc4b Upgraded to v37.0.4 (#1323)
Co-authored-by: jackton1 <jackton1@users.noreply.github.com>
2023-06-27 17:15:01 +00:00
renovate[bot]
bb3376162b chore(deps): lock file maintenance (#1320)
Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>
Co-authored-by: GitHub Action <action@github.com>
2023-06-27 06:05:28 +00:00
dependabot[bot]
6d350523ea chore(deps): bump lodash from 4.17.15 to 4.17.21 (#1322)
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2023-06-26 20:21:48 -06:00
Tonye Jack
8838901b21 chore: Update package.json 2023-06-26 20:19:20 -06:00
renovate[bot]
eb59803836 fix(deps): update dependency @octokit/rest to v19.0.13 (#1318)
Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>
2023-06-26 20:16:37 -06:00
Tonye Jack
bdf73bf6ae chore: update package version requirements (#1317)
Co-authored-by: GitHub Action <action@github.com>
2023-06-26 19:25:05 -06:00
renovate[bot]
4cddd28d4b chore(deps): update dependency @types/node to v20.3.2 (#1315)
Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>
2023-06-26 19:23:02 -06:00
Tonye Jack
89f014aed9 chore: increase fetch-depth to resolve error with test (#1316) 2023-06-26 18:27:09 -06:00
tj-actions[bot]
4904bb2843 Updated README.md (#1314)
Co-authored-by: jackton1 <jackton1@users.noreply.github.com>
2023-06-26 19:43:46 +00:00
Tonye Jack
13e016d7c4 Update README.md 2023-06-26 13:28:37 -06:00
renovate[bot]
709c71af5f chore(deps): update typescript-eslint monorepo to v5.60.1 (#1313)
Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>
2023-06-26 19:14:21 +00:00
Tonye Jack
8c58d60f5b chore: update debug message (#1311)
Co-authored-by: GitHub Action <action@github.com>
2023-06-25 23:10:22 -06:00
tj-actions[bot]
e6e128a1c4 Updated submodule (#1307)
Co-authored-by: jackton1 <jackton1@users.noreply.github.com>
Co-authored-by: repo-ranger[bot] <39074581+repo-ranger[bot]@users.noreply.github.com>
2023-06-25 20:26:54 -06:00
tj-actions[bot]
358ff4f347 Upgraded to v37.0.3 (#1310)
Co-authored-by: jackton1 <jackton1@users.noreply.github.com>
2023-06-25 20:26:42 -06:00
renovate[bot]
ec1e14cf27 chore(deps): lock file maintenance (#1309)
Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>
2023-06-26 02:11:53 +00:00
Tonye Jack
7d7c69556b fix: bug listing submodule paths (#1308) 2023-06-26 01:41:25 +00:00
renovate[bot]
cb82bb7325 chore(deps): lock file maintenance (#1306)
Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>
2023-06-25 19:01:41 +00:00
tj-actions[bot]
07e161e47f Upgraded to v37.0.2 (#1305)
Co-authored-by: jackton1 <jackton1@users.noreply.github.com>
2023-06-25 18:20:04 +00:00
20 changed files with 1826 additions and 1225 deletions

View File

@@ -1,7 +1,8 @@
{
"plugins": [
"jest",
"@typescript-eslint"
"@typescript-eslint",
"github"
],
"extends": [
"plugin:github/recommended"

View File

@@ -1,7 +1,17 @@
version: 2
updates:
- package-ecosystem: npm
directory: "/"
schedule:
interval: daily
open-pull-requests-limit: 10
versioning-strategy: widen
labels:
- "merge when passing"
- package-ecosystem: github-actions
directory: "/"
schedule:
interval: daily
open-pull-requests-limit: 10
labels:
- "merge when passing"

View File

@@ -1,26 +0,0 @@
name: automerge
on:
check_suite:
types:
- completed
jobs:
automerge:
runs-on: ubuntu-latest
if: |
github.actor == 'dependabot[bot]' ||
github.actor == 'dependabot' ||
github.actor == 'dependabot-preview[bot]' ||
github.actor == 'dependabot-preview' ||
github.actor == 'renovate[bot]' ||
github.actor == 'renovate'
steps:
- name: automerge
uses: pascalgn/automerge-action@v0.15.6
env:
GITHUB_TOKEN: ${{ secrets.PAT_TOKEN }}
MERGE_METHOD: "rebase"
UPDATE_METHOD: "rebase"
MERGE_RETRIES: "6"
MERGE_RETRY_SLEEP: "100000"
MERGE_LABELS: ""

View File

@@ -51,7 +51,7 @@ jobs:
repository: ${{ github.event.pull_request.head.repo.full_name }}
- name: Use Node.js 16.x
uses: actions/setup-node@v3.6.0
uses: actions/setup-node@v3.7.0
with:
cache: 'yarn'
node-version: '16.x'
@@ -321,8 +321,8 @@ jobs:
fail-fast: false
max-parallel: 4
matrix:
fetch-depth: [1, 2]
input-fetch_depth: [1, 50]
fetch-depth: [1, 2, 50]
input-fetch_depth: [1, 2, 50]
steps:
- name: Checkout branch
@@ -339,8 +339,10 @@ jobs:
- name: Run changed-files
id: changed-files
uses: ./
continue-on-error: ${{ matrix.input-skip_initial_fetch == true && matrix.fetch-depth < 10 }}
with:
fetch_depth: ${{ matrix.input-fetch_depth }}
skip_initial_fetch: ${{ github.event_name == 'push' }}
- name: Show output
run: |
@@ -640,7 +642,7 @@ jobs:
shell:
bash
test_recover_deleted_file:
test-recover-deleted-file:
name: Test changed-files recover deleted file
runs-on: ubuntu-latest
needs: build
@@ -670,6 +672,7 @@ jobs:
base_sha: "fcdeb5b3d797752d95f6dbe98552a95c29dad338"
sha: "432e0c810c60ef1332850a971c5ec39022034b4c"
recover_deleted_files: true
fetch_depth: 60000
- name: Show output
run: |
@@ -702,6 +705,7 @@ jobs:
files: |
test
recover_deleted_files: true
fetch_depth: 60000
- name: Show output
run: |
@@ -736,6 +740,7 @@ jobs:
- test/**.txt
- test/**.md
recover_deleted_files: true
fetch_depth: 60000
- name: Show output
run: |
@@ -767,6 +772,7 @@ jobs:
sha: "432e0c810c60ef1332850a971c5ec39022034b4c"
recover_deleted_files: true
recover_deleted_files_to_destination: "deleted_files"
fetch_depth: 60000
- name: Show output
run: |
@@ -908,6 +914,7 @@ jobs:
fetch_depth: 60000
dir_names: "true"
dir_names_max_depth: 3
dir_names_exclude_current_dir: "true"
- name: Show output
run: |
echo '${{ toJSON(steps.changed-files-dir-names-max-depth.outputs) }}'

View File

@@ -1,5 +1,229 @@
# Changelog
# [37.2.0](https://github.com/tj-actions/changed-files/compare/v37.1.2...v37.2.0) - (2023-07-18)
## <!-- 26 -->🔄 Update
- Update README.md ([e3ea6b7](https://github.com/tj-actions/changed-files/commit/e3ea6b7948826820cfd616fda2d9c974a4ead314)) - (Tonye Jack)
## <!-- 7 -->⚙️ Miscellaneous Tasks
- **deps:** Update dependency eslint-plugin-github to v4.9.2 ([#1388](https://github.com/tj-actions/changed-files/issues/1388)) ([68b429d](https://github.com/tj-actions/changed-files/commit/68b429ddc666ea0dba46309e1ee45e06bb408df8)) - (renovate[bot])
- Switch to use the github context ([#1386](https://github.com/tj-actions/changed-files/issues/1386)) ([ec0b6d0](https://github.com/tj-actions/changed-files/commit/ec0b6d0e4c2965e4073849cbd0ab0e6fd3b42d50)) - (Tonye Jack)
- **deps:** Update dependency eslint-plugin-github to v4.9.1 ([#1387](https://github.com/tj-actions/changed-files/issues/1387)) ([8c8be23](https://github.com/tj-actions/changed-files/commit/8c8be234b2ced36de48c003dd2b2b0cd3448985f)) - (renovate[bot])
- **deps:** Update typescript-eslint monorepo to v6.1.0 ([#1385](https://github.com/tj-actions/changed-files/issues/1385)) ([029d6cd](https://github.com/tj-actions/changed-files/commit/029d6cd6b8191709b7e3d2bff0207a58a0c9c272)) - (renovate[bot])
- **deps:** Lock file maintenance ([#1383](https://github.com/tj-actions/changed-files/issues/1383)) ([8fc95ea](https://github.com/tj-actions/changed-files/commit/8fc95ea17520d70ecf9d3141ec0a0d8443780a48)) - (renovate[bot])
- **deps:** Lock file maintenance ([#1382](https://github.com/tj-actions/changed-files/issues/1382)) ([3e2a2ce](https://github.com/tj-actions/changed-files/commit/3e2a2ce2d08798ebef6a1b3b7fd8782820484ea4)) - (renovate[bot])
- **deps:** Update dependency eslint to v8.45.0 ([#1381](https://github.com/tj-actions/changed-files/issues/1381)) ([4aebdaf](https://github.com/tj-actions/changed-files/commit/4aebdafc0bbe1a3beffb6e7f6278d3323c6aabcb)) - (renovate[bot])
## <!-- 9 -->⬆️ Upgrades
- Upgraded to v37.1.2 ([#1378](https://github.com/tj-actions/changed-files/issues/1378))
Co-authored-by: jackton1 <jackton1@users.noreply.github.com> ([2aadab2](https://github.com/tj-actions/changed-files/commit/2aadab2297933ef2a8eaa3a3316ae458aafe4964)) - (tj-actions[bot])
# [37.1.2](https://github.com/tj-actions/changed-files/compare/v37.1.1...v37.1.2) - (2023-07-13)
## <!-- 1 -->🐛 Bug Fixes
- Excluding current dir with max depth less than 2 ([#1375](https://github.com/tj-actions/changed-files/issues/1375)) ([2a968ff](https://github.com/tj-actions/changed-files/commit/2a968ff601949c81b47d9c1fdb789b0d25ddeea2)) - (Tonye Jack)
## <!-- 26 -->🔄 Update
- Updated README.md ([#1373](https://github.com/tj-actions/changed-files/issues/1373))
Co-authored-by: jackton1 <jackton1@users.noreply.github.com> ([fe91ab7](https://github.com/tj-actions/changed-files/commit/fe91ab72f6a9ecb02a0242c01b58685d5680fd4e)) - (tj-actions[bot])
- Update README.md ([cc23ede](https://github.com/tj-actions/changed-files/commit/cc23ede8379d7798f2cd63082882472ae1add438)) - (Tonye Jack)
- Updated README.md ([#1368](https://github.com/tj-actions/changed-files/issues/1368))
Co-authored-by: jackton1 <jackton1@users.noreply.github.com> ([032079b](https://github.com/tj-actions/changed-files/commit/032079bf7feccea4cc0b271962986e7770e345b3)) - (tj-actions[bot])
- Update action.yml ([21ccb43](https://github.com/tj-actions/changed-files/commit/21ccb43669e77a07efac5f011bd4ee8b73128ef6)) - (Tonye Jack)
- Updated README.md ([#1367](https://github.com/tj-actions/changed-files/issues/1367))
Co-authored-by: jackton1 <jackton1@users.noreply.github.com> ([038a51a](https://github.com/tj-actions/changed-files/commit/038a51af80a6a09ec582702adc3df051791f9db0)) - (tj-actions[bot])
- Update README.md ([c6c396f](https://github.com/tj-actions/changed-files/commit/c6c396f2fe271cc83e7e0f9d536c3d86ec4c26ba)) - (Tonye Jack)
- Update README.md ([7f05b89](https://github.com/tj-actions/changed-files/commit/7f05b891876669d2c7c19a0d297f6a3b856e0a74)) - (Tonye Jack)
- Update README.md ([97365f6](https://github.com/tj-actions/changed-files/commit/97365f6cd24ea353a8eb76ec7882677c79f73b7e)) - (Tonye Jack)
## <!-- 7 -->⚙️ Miscellaneous Tasks
- **deps:** Update dependency eslint-plugin-github to v4.9.0 ([#1377](https://github.com/tj-actions/changed-files/issues/1377)) ([ef327f9](https://github.com/tj-actions/changed-files/commit/ef327f98b5f31e95aad0ae00e29a83a72294910a)) - (renovate[bot])
- **deps:** Update dependency eslint-plugin-jest to v27.2.3 ([#1376](https://github.com/tj-actions/changed-files/issues/1376)) ([5c1cab8](https://github.com/tj-actions/changed-files/commit/5c1cab842919e3c5e2c9385b01039715b7f81382)) - (renovate[bot])
- **deps:** Update dependency @types/node to v20.4.2 ([#1372](https://github.com/tj-actions/changed-files/issues/1372)) ([60e7ac7](https://github.com/tj-actions/changed-files/commit/60e7ac7c28a8e1f8d0dca3a5b0b2c558c38526d1)) - (renovate[bot])
- Update README.md ([#1371](https://github.com/tj-actions/changed-files/issues/1371)) ([76dc7bc](https://github.com/tj-actions/changed-files/commit/76dc7bcd3f1236de1b72ce30d0b98b19cea5ab9d)) - (Tonye Jack)
- Improve test coverage ([#1369](https://github.com/tj-actions/changed-files/issues/1369)) ([c7072f0](https://github.com/tj-actions/changed-files/commit/c7072f096921517be8c12059fdcdfaa3c27f8ee3)) - (Tonye Jack)
- Update readme to include downsides of skipping the initial fetch ([a5f4b54](https://github.com/tj-actions/changed-files/commit/a5f4b54b5f4e834abbbe77a9f9f94af0b3d93ab0)) - (Tonye Jack)
- **deps:** Update dependency eslint-plugin-prettier to v5.0.0 ([#1364](https://github.com/tj-actions/changed-files/issues/1364)) ([61e9ed7](https://github.com/tj-actions/changed-files/commit/61e9ed7dab363242491581aca47219f0201eb362)) - (renovate[bot])
## <!-- 9 -->⬆️ Upgrades
- Upgraded to v37.1.1 ([#1363](https://github.com/tj-actions/changed-files/issues/1363))
Co-authored-by: jackton1 <jackton1@users.noreply.github.com> ([139cb86](https://github.com/tj-actions/changed-files/commit/139cb86a771ba8b366563c29e123d7bd97ece0c2)) - (tj-actions[bot])
# [37.1.1](https://github.com/tj-actions/changed-files/compare/v37.1.0...v37.1.1) - (2023-07-11)
## <!-- 26 -->🔄 Update
- Updated README.md ([#1361](https://github.com/tj-actions/changed-files/issues/1361))
Co-authored-by: jackton1 <jackton1@users.noreply.github.com> ([f53b75e](https://github.com/tj-actions/changed-files/commit/f53b75ef587410b544b17c73677519d76ebe5775)) - (tj-actions[bot])
- Update README.md ([732c1a1](https://github.com/tj-actions/changed-files/commit/732c1a14e7c752fc78b781de8975c102ad26dc5f)) - (Tonye Jack)
- Update README.md ([de17e6c](https://github.com/tj-actions/changed-files/commit/de17e6cdf222c98c8d2caefef10216bbd23c557e)) - (Tonye Jack)
## <!-- 7 -->⚙️ Miscellaneous Tasks
- **deps:** Bump semver from 6.3.0 to 6.3.1 ([#1362](https://github.com/tj-actions/changed-files/issues/1362)) ([1f20fb8](https://github.com/tj-actions/changed-files/commit/1f20fb83f05eabed6e12ba0329edac8b6ec8e207)) - (dependabot[bot])
- **deps:** Update typescript-eslint monorepo to v6 (major) ([#1360](https://github.com/tj-actions/changed-files/issues/1360)) ([51647ad](https://github.com/tj-actions/changed-files/commit/51647add79ed3e9ed311efd543bc342abc2db9e9)) - (renovate[bot])
- **deps:** Update typescript-eslint monorepo to v5.62.0 ([#1359](https://github.com/tj-actions/changed-files/issues/1359)) ([6c65324](https://github.com/tj-actions/changed-files/commit/6c6532459ab0ab44938aabe62c8e665b5fd97aad)) - (renovate[bot])
- **deps:** Update dependency @types/jest to v29.5.3 ([#1358](https://github.com/tj-actions/changed-files/issues/1358)) ([3ab0d43](https://github.com/tj-actions/changed-files/commit/3ab0d43f2c66ea0f1eb64b6f17ea2471c0f60711)) - (renovate[bot])
- **deps:** Lock file maintenance ([#1356](https://github.com/tj-actions/changed-files/issues/1356)) ([c7bb50a](https://github.com/tj-actions/changed-files/commit/c7bb50a40c6695f3cf2a5e98f77abcd3b8c1775f)) - (renovate[bot])
## <!-- 9 -->⬆️ Upgrades
- Upgraded to v37.1.0 ([#1355](https://github.com/tj-actions/changed-files/issues/1355))
Co-authored-by: jackton1 <jackton1@users.noreply.github.com> ([fe12e8f](https://github.com/tj-actions/changed-files/commit/fe12e8f13fd61b4b3acc6a385f31a0c804b71f31)) - (tj-actions[bot])
# [37.1.0](https://github.com/tj-actions/changed-files/compare/v37.0.5...v37.1.0) - (2023-07-09)
## <!-- 0 -->🚀 Features
- Add support for skipping initial fetch ([#1353](https://github.com/tj-actions/changed-files/issues/1353)) ([2f49eb9](https://github.com/tj-actions/changed-files/commit/2f49eb9ee1f1dc38d9f070ebecf12b59c9436e0e)) - (Tonye Jack)
## <!-- 17 --> Remove
- Deleted .github/workflows/auto-merge.yml ([d1028b2](https://github.com/tj-actions/changed-files/commit/d1028b2eb89e46a93cc618ef283598da9e43a860)) - (Tonye Jack)
## <!-- 26 -->🔄 Update
- Updated README.md ([#1354](https://github.com/tj-actions/changed-files/issues/1354))
Co-authored-by: repo-ranger[bot] <repo-ranger[bot]@users.noreply.github.com> ([87e23c4](https://github.com/tj-actions/changed-files/commit/87e23c4c79a603288642711155953c7da34b11ac)) - (tj-actions[bot])
- Update README.md ([00b3d3d](https://github.com/tj-actions/changed-files/commit/00b3d3d9e7d0efa856785fc5586fefd61cbf9e92)) - (Tonye Jack)
- Update README.md ([626a6b7](https://github.com/tj-actions/changed-files/commit/626a6b7213d3d54c32b7f8afae6251494453ded6)) - (Tonye Jack)
- Update dependabot.yml ([7ee3290](https://github.com/tj-actions/changed-files/commit/7ee3290f25f5a3f42d74b3399dd2106a7f7ce2f3)) - (Tonye Jack)
- Updated renovate.json ([e9eccdd](https://github.com/tj-actions/changed-files/commit/e9eccdd473f87222a6a8393f849d7c945568b842)) - (Tonye Jack)
- Update dependabot.yml ([6dc8c79](https://github.com/tj-actions/changed-files/commit/6dc8c796c9b6810ee03d89669f5f7edf09069788)) - (Tonye Jack)
## <!-- 7 -->⚙️ Miscellaneous Tasks
- **deps-dev:** Bump prettier from 2.8.8 to 3.0.0 ([#1345](https://github.com/tj-actions/changed-files/issues/1345)) ([19193bd](https://github.com/tj-actions/changed-files/commit/19193bdb2634c8529d7b25642f3436f76eae0b45)) - (dependabot[bot])
- **deps:** Update dependency @types/node to v20.4.1 ([#1351](https://github.com/tj-actions/changed-files/issues/1351)) ([d12b5fc](https://github.com/tj-actions/changed-files/commit/d12b5fc2ab2546513a4be53b41218c928fd70b99)) - (renovate[bot])
- **deps:** Update dependency jest to v29.6.1 ([#1350](https://github.com/tj-actions/changed-files/issues/1350)) ([338f354](https://github.com/tj-actions/changed-files/commit/338f3541063a272dd7dcf8ed531daa483ca95762)) - (renovate[bot])
- **deps:** Lock file maintenance ([#1349](https://github.com/tj-actions/changed-files/issues/1349)) ([090f901](https://github.com/tj-actions/changed-files/commit/090f90127a77657c1531f97f8f22a7ec1fbeeb1c)) - (renovate[bot])
- **deps-dev:** Bump @types/node from 20.3.3 to 20.4.0 ([#1348](https://github.com/tj-actions/changed-files/issues/1348)) ([598640f](https://github.com/tj-actions/changed-files/commit/598640f3beb83bd8c85ef43b7df70d8fca22dca6)) - (dependabot[bot])
- **deps:** Update actions/setup-node action to v3.7.0 ([#1344](https://github.com/tj-actions/changed-files/issues/1344)) ([0e24ceb](https://github.com/tj-actions/changed-files/commit/0e24cebad03e8080e8912d6a4a9a200b06ebd261)) - (renovate[bot])
- **deps:** Lock file maintenance ([#1342](https://github.com/tj-actions/changed-files/issues/1342)) ([d8f8ad9](https://github.com/tj-actions/changed-files/commit/d8f8ad9a74cda2e39386f4cebf232f27f4099887)) - (renovate[bot])
- **deps:** Update dependency jest to v29.6.0 ([#1341](https://github.com/tj-actions/changed-files/issues/1341)) ([47a703e](https://github.com/tj-actions/changed-files/commit/47a703e935c9dd0ecb0421d5656df3f8700d3a0c)) - (renovate[bot])
- Update filter pattern ([#1340](https://github.com/tj-actions/changed-files/issues/1340)) ([742b641](https://github.com/tj-actions/changed-files/commit/742b6417b4068dac99221f71a1466631de290ebb)) - (Tonye Jack)
- **deps:** Update typescript-eslint monorepo to v5.61.0 ([#1339](https://github.com/tj-actions/changed-files/issues/1339)) ([af9376f](https://github.com/tj-actions/changed-files/commit/af9376f80142244248805dc85f751b19e5875fbf)) - (renovate[bot])
- **deps:** Lock file maintenance ([#1338](https://github.com/tj-actions/changed-files/issues/1338)) ([adaff22](https://github.com/tj-actions/changed-files/commit/adaff22dedce1452500712c7d1445f1ae776739a)) - (renovate[bot])
- **deps:** Update dependency eslint to v8.44.0 ([#1337](https://github.com/tj-actions/changed-files/issues/1337)) ([2cd4de3](https://github.com/tj-actions/changed-files/commit/2cd4de3431b86792632cb629f30e5743924edb0a)) - (renovate[bot])
- **deps:** Update dependency @types/node to v20.3.3 ([#1336](https://github.com/tj-actions/changed-files/issues/1336)) ([b199521](https://github.com/tj-actions/changed-files/commit/b1995217737c4c6b644dfee6b73e35063eff6591)) - (renovate[bot])
- **deps:** Update dependency ts-jest to v29.1.1 ([#1333](https://github.com/tj-actions/changed-files/issues/1333)) ([aecc5eb](https://github.com/tj-actions/changed-files/commit/aecc5ebeee84c2358e83fc9101ef1a70bd0581ac)) - (renovate[bot])
- **deps:** Lock file maintenance ([#1331](https://github.com/tj-actions/changed-files/issues/1331)) ([c060576](https://github.com/tj-actions/changed-files/commit/c060576a37b64111bff7727c21c1c91948fd88b2)) - (renovate[bot])
## <!-- 9 -->⬆️ Upgrades
- Upgraded to v37.0.5 ([#1332](https://github.com/tj-actions/changed-files/issues/1332))
Co-authored-by: jackton1 <jackton1@users.noreply.github.com>
Co-authored-by: repo-ranger[bot] <39074581+repo-ranger[bot]@users.noreply.github.com> ([630aa37](https://github.com/tj-actions/changed-files/commit/630aa37bbd533646936247a99e24e04efeb41602)) - (tj-actions[bot])
# [37.0.5](https://github.com/tj-actions/changed-files/compare/v37.0.4...v37.0.5) - (2023-06-29)
## <!-- 26 -->🔄 Update
- Update README.md ([034e423](https://github.com/tj-actions/changed-files/commit/034e423c9c8101a65e1da676ac29a3423ff442f7)) - (Tonye Jack)
- Updated README.md ([#1329](https://github.com/tj-actions/changed-files/issues/1329))
Co-authored-by: jackton1 <jackton1@users.noreply.github.com> ([89c3181](https://github.com/tj-actions/changed-files/commit/89c31817b274e258fb873b539a68e467a4a385b0)) - (tj-actions[bot])
- Update README.md ([e42f43b](https://github.com/tj-actions/changed-files/commit/e42f43b67b2ca0d726dec681aa34e4b875ddd284)) - (Tonye Jack)
- Update README.md ([fe20777](https://github.com/tj-actions/changed-files/commit/fe20777b56dffa2faca8f02f32ba42ae644b5a7b)) - (Tonye Jack)
- Update README.md ([89890d6](https://github.com/tj-actions/changed-files/commit/89890d6f77a064cdbf5c475517dca8d39228f154)) - (Tonye Jack)
## <!-- 7 -->⚙️ Miscellaneous Tasks
- **deps:** Lock file maintenance ([#1330](https://github.com/tj-actions/changed-files/issues/1330)) ([54849de](https://github.com/tj-actions/changed-files/commit/54849deb963ca9f24185fb5de2965e002d066e6b)) - (renovate[bot])
- Update README.md ([6fdb8b5](https://github.com/tj-actions/changed-files/commit/6fdb8b53b33f2cf5a6a6969836ebfd774e05ff87)) - (Tonye Jack)
- **deps:** Update dependency typescript to v5.1.6 ([#1328](https://github.com/tj-actions/changed-files/issues/1328)) ([3323f78](https://github.com/tj-actions/changed-files/commit/3323f78bb45033e3f3bb7d9cbc125d3f0833c243)) - (renovate[bot])
- **deps:** Update dependency typescript to v5.1.5 ([#1324](https://github.com/tj-actions/changed-files/issues/1324)) ([927a8c5](https://github.com/tj-actions/changed-files/commit/927a8c5ba3f01280932398e5ce47d64bada31e32)) - (renovate[bot])
## <!-- 9 -->⬆️ Upgrades
- Upgraded to v37.0.4 ([#1323](https://github.com/tj-actions/changed-files/issues/1323))
Co-authored-by: jackton1 <jackton1@users.noreply.github.com> ([5e7542f](https://github.com/tj-actions/changed-files/commit/5e7542fc4bfffb67ec6f613fb57d17364b602f57)) - (tj-actions[bot])
# [37.0.4](https://github.com/tj-actions/changed-files/compare/v37.0.3...v37.0.4) - (2023-06-27)
## <!-- 1 -->🐛 Bug Fixes
- **deps:** Update dependency @octokit/rest to v19.0.13 ([#1318](https://github.com/tj-actions/changed-files/issues/1318)) ([eb59803](https://github.com/tj-actions/changed-files/commit/eb598038365111ee2d653fed71db39c68d8a5ca6)) - (renovate[bot])
## <!-- 26 -->🔄 Update
- Updated README.md ([#1314](https://github.com/tj-actions/changed-files/issues/1314))
Co-authored-by: jackton1 <jackton1@users.noreply.github.com> ([4904bb2](https://github.com/tj-actions/changed-files/commit/4904bb2843fce2a1cec977be83ccda6c1605ff9c)) - (tj-actions[bot])
- Update README.md ([13e016d](https://github.com/tj-actions/changed-files/commit/13e016d7c459ba0b877df6680a5543e9f8890ef9)) - (Tonye Jack)
- Updated submodule ([#1307](https://github.com/tj-actions/changed-files/issues/1307))
Co-authored-by: jackton1 <jackton1@users.noreply.github.com>
Co-authored-by: repo-ranger[bot] <39074581+repo-ranger[bot]@users.noreply.github.com> ([e6e128a](https://github.com/tj-actions/changed-files/commit/e6e128a1c4b816aabb14c127146e2371749458c0)) - (tj-actions[bot])
## <!-- 7 -->⚙️ Miscellaneous Tasks
- **deps:** Lock file maintenance ([#1320](https://github.com/tj-actions/changed-files/issues/1320)) ([bb33761](https://github.com/tj-actions/changed-files/commit/bb3376162b179308a79fc4450262a15a8e1d6888)) - (renovate[bot])
- **deps:** Bump lodash from 4.17.15 to 4.17.21 ([#1322](https://github.com/tj-actions/changed-files/issues/1322)) ([6d35052](https://github.com/tj-actions/changed-files/commit/6d350523ea913b29cd86acff803c50fcbd829ffc)) - (dependabot[bot])
- Update package.json ([8838901](https://github.com/tj-actions/changed-files/commit/8838901b21e20574f67a02954a585a5ba579809e)) - (Tonye Jack)
- Update package version requirements ([#1317](https://github.com/tj-actions/changed-files/issues/1317)) ([bdf73bf](https://github.com/tj-actions/changed-files/commit/bdf73bf6aec3938ce64ef74eb6b86af0271804a2)) - (Tonye Jack)
- **deps:** Update dependency @types/node to v20.3.2 ([#1315](https://github.com/tj-actions/changed-files/issues/1315)) ([4cddd28](https://github.com/tj-actions/changed-files/commit/4cddd28d4b8f3c05636331fdba69336f95c127a2)) - (renovate[bot])
- Increase fetch-depth to resolve error with test ([#1316](https://github.com/tj-actions/changed-files/issues/1316)) ([89f014a](https://github.com/tj-actions/changed-files/commit/89f014aed90c84e49f2d9c972ad1b3b43f6e10d8)) - (Tonye Jack)
- **deps:** Update typescript-eslint monorepo to v5.60.1 ([#1313](https://github.com/tj-actions/changed-files/issues/1313)) ([709c71a](https://github.com/tj-actions/changed-files/commit/709c71af5fefd98c04ccbfb9e588784850d867cd)) - (renovate[bot])
- Update debug message ([#1311](https://github.com/tj-actions/changed-files/issues/1311)) ([8c58d60](https://github.com/tj-actions/changed-files/commit/8c58d60f5bd07539ff823a0ed6eb66262bd89c70)) - (Tonye Jack)
## <!-- 9 -->⬆️ Upgrades
- Upgraded to v37.0.3 ([#1310](https://github.com/tj-actions/changed-files/issues/1310))
Co-authored-by: jackton1 <jackton1@users.noreply.github.com> ([358ff4f](https://github.com/tj-actions/changed-files/commit/358ff4f347713d6c6eb579a95b43955158857ac1)) - (tj-actions[bot])
# [37.0.3](https://github.com/tj-actions/changed-files/compare/v37.0.2...v37.0.3) - (2023-06-26)
## <!-- 1 -->🐛 Bug Fixes
- Bug listing submodule paths ([#1308](https://github.com/tj-actions/changed-files/issues/1308)) ([7d7c695](https://github.com/tj-actions/changed-files/commit/7d7c69556b242d112e52d307ae14ba770a52af47)) - (Tonye Jack)
## <!-- 7 -->⚙️ Miscellaneous Tasks
- **deps:** Lock file maintenance ([#1309](https://github.com/tj-actions/changed-files/issues/1309)) ([ec1e14c](https://github.com/tj-actions/changed-files/commit/ec1e14cf27f4585783f463070881b2c499349a8a)) - (renovate[bot])
- **deps:** Lock file maintenance ([#1306](https://github.com/tj-actions/changed-files/issues/1306)) ([cb82bb7](https://github.com/tj-actions/changed-files/commit/cb82bb73255fe3d708c0da15a592f93d820e3499)) - (renovate[bot])
## <!-- 9 -->⬆️ Upgrades
- Upgraded to v37.0.2 ([#1305](https://github.com/tj-actions/changed-files/issues/1305))
Co-authored-by: jackton1 <jackton1@users.noreply.github.com> ([07e161e](https://github.com/tj-actions/changed-files/commit/07e161e47fa182e1cc2cb37c80f4e3b175124385)) - (tj-actions[bot])
# [37.0.2](https://github.com/tj-actions/changed-files/compare/v37.0.1...v37.0.2) - (2023-06-25)
## <!-- 1 -->🐛 Bug Fixes
- Add warning message when unable to list submodules ([#1304](https://github.com/tj-actions/changed-files/issues/1304)) ([2106eb4](https://github.com/tj-actions/changed-files/commit/2106eb4457dd2aba4d37c8cdd16acba5d18739b9)) - (Tonye Jack)
## <!-- 7 -->⚙️ Miscellaneous Tasks
- **deps:** Update dependency @types/node to v20.3.1 ([#1303](https://github.com/tj-actions/changed-files/issues/1303)) ([4afe0ab](https://github.com/tj-actions/changed-files/commit/4afe0ab671c36efef1ae5e3e27d8286c3f797f03)) - (renovate[bot])
- **deps:** Update tj-actions/eslint-changed-files action to v20 ([#1301](https://github.com/tj-actions/changed-files/issues/1301)) ([5768dd7](https://github.com/tj-actions/changed-files/commit/5768dd7d22ef79603ef768047c6d91ea034d0cdc)) - (renovate[bot])
## <!-- 9 -->⬆️ Upgrades
- Upgraded to v37.0.1 ([#1300](https://github.com/tj-actions/changed-files/issues/1300))
Co-authored-by: jackton1 <jackton1@users.noreply.github.com> ([648f9c1](https://github.com/tj-actions/changed-files/commit/648f9c1aaf717f92ac2b503be6694ef804b8a49e)) - (tj-actions[bot])
# [37.0.1](https://github.com/tj-actions/changed-files/compare/v37.0.0...v37.0.1) - (2023-06-24)
## <!-- 1 -->🐛 Bug Fixes

310
README.md
View File

@@ -19,18 +19,22 @@
## changed-files
Effortlessly track all changed files and directories relative to a target branch, preceding commit or the last remote commit returning **relative paths** from the project root.
Effortlessly track all changed files and directories relative to a target branch, preceding commit or the last remote commit returning **relative paths** from the project root using this GitHub action.
## Table of contents
* [Features](#features)
* [Usage](#usage)
* [On `pull_request`](#on-pull_request)
* [Using local .git history](#using-local-git-history)
* [Using Github's API](#using-githubs-api)
* [On `push`](#on-push)
* [Useful Acronyms](#useful-acronyms)
* [Outputs](#outputs)
* [Inputs](#inputs)
* [Versioning](#versioning)
* [Examples](#examples)
* [Real world usage](#real-world-usage)
* [Real-world usage](#real-world-usage)
* [Known Limitation](#known-limitation)
* [Migration guide](#migration-guide)
* [Credits](#credits)
@@ -39,14 +43,14 @@ Effortlessly track all changed files and directories relative to a target branch
## Features
* Provides fast execution, averaging 0-10 seconds.
* Fast execution, averaging 0-10 seconds.
* Leverages either [Github's REST API](https://docs.github.com/en/rest/reference/repos#list-commits) or [Git's native diff](https://git-scm.com/docs/git-diff) to determine changed files.
* Facilitates easy debugging.
* Scales to handle large repositories.
* Supports Git submodules.
* Generates escaped JSON output for running matrix jobs based on changed files.
* Lists changed directories.
* Allows limiting the matching changed directories to a specified maximum depth.
* Limits matching changed directories to a specified maximum depth.
* Optionally excludes the current directory.
* Writes outputs to a designated `.txt` or `.json` file for further processing.
* Restores deleted files to their previous location or a newly specified location.
@@ -81,53 +85,31 @@ And many more.
> * Ensure that `persist-credentials` is set to `true` when configuring [`actions/checkout`](https://github.com/actions/checkout#usage) if `fetch-depth` isn't set to `0`.
> * For repositories that have PRs generated from forks when configuring [`actions/checkout`](https://github.com/actions/checkout#usage) set the `repository` 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)
### On `pull_request`
#### Using local .git history
```yaml
name: CI
on:
push:
branches:
- main
pull_request:
branches:
- main
jobs:
# -------------------------------------------------------------
# Event `pull_request`: Returns all changed pull request files.
# --------------------------------------------------------------
job1: # Example 1 - Using GitHub's API
# NOTE:
# - This is limited to pull_request* events and would raise an error for other events.
# - A maximum of 3000 files can be returned.
runs-on: ubuntu-latest # windows-latest | macos-latest
name: Test changed-files
if: github.event_name != 'push'
permissions:
pull-requests: read
steps:
- name: Get changed files
id: changed-files
uses: tj-actions/changed-files@v37
- name: List all changed files
run: |
for file in ${{ steps.changed-files.outputs.all_changed_files }}; do
echo "$file was changed"
done
# ------------------------------------------------------------------------------------------------------------
# Event `push`: Compare the preceding commit -> to the current commit of the main branch.
# Event `pull_request`: Compare the last commit of main -> to the current commit of a Pull Request branch.
# ------------------------------------------------------------------------------------------------------------
job2: # Example 2 - Using local .git directory
runs-on: ubuntu-latest # windows-latest | macos-latest
# ------------------------------------------------------------------------------------------------------------------------------------------------
# Event `pull_request`: Compare the last commit of the main branch or last remote commit of the PR branch -> to the current commit of a PR branch.
# ------------------------------------------------------------------------------------------------------------------------------------------------
changed_files:
runs-on: ubuntu-latest # windows-latest || macos-latest
name: Test changed-files
steps:
- uses: actions/checkout@v3
with:
fetch-depth: 0 # OR "2" -> To retrieve the preceding commit.
# Example 1
- name: Get changed files
id: changed-files
uses: tj-actions/changed-files@v37
@@ -142,19 +124,13 @@ jobs:
echo "$file was changed"
done
job3: # Example 3 - Using local .git directory
runs-on: ubuntu-latest # windows-latest | macos-latest
name: Test changed-files
steps:
- uses: actions/checkout@v3
with:
fetch-depth: 0 # OR "2" -> To retrieve the preceding commit.
# Example 2
- name: Get changed files in the docs folder
id: changed-files-specific
uses: tj-actions/changed-files@v37
with:
files: docs/*.{js,html} # Alternatively using: `docs/**` or `docs`
files_ignore: docs/static.js
- name: Run step if any file(s) in the docs folder change
if: steps.changed-files-specific.outputs.any_changed == 'true'
@@ -162,44 +138,14 @@ jobs:
echo "One or more files in the docs folder has changed."
echo "List all the files that have changed: ${{ steps.changed-files-specific.outputs.all_changed_files }}"
job4: # Example 4 - Using local .git directory
runs-on: ubuntu-latest # windows-latest | macos-latest
name: Test changed-files
steps:
- uses: actions/checkout@v3
with:
fetch-depth: 0 # OR "2" -> To retrieve the preceding commit.
- name: Get all changed .js file(s) or any file in the static folder excluding the docs folder
id: changed-files-excluded
uses: tj-actions/changed-files@v37
with:
files: |
**.js
static
files_ignore: docs
- name: Run step if any .js file(s) or any file in the static folder change
if: steps.changed-files-excluded.outputs.any_changed == 'true'
run: |
echo "One or more .js file(s) or any file in the static folder but not in the doc folder has changed."
echo "List all the files that have changed: ${{ steps.changed-files-excluded.outputs.all_changed_files }}"
job5: # Example 5 - Using local .git directory
runs-on: ubuntu-latest # windows-latest | macos-latest
name: Test changed-files
steps:
- uses: actions/checkout@v3
with:
fetch-depth: 0 # OR "2" -> To retrieve the preceding commit.
# Example 3
- name: Get all test, doc and src files that have changed
id: changed-files-yaml
uses: tj-actions/changed-files@v37
with:
files_yaml: |
doc:
- *.md
- **.md
- docs/**
- !docs/README.md
test:
@@ -222,6 +168,107 @@ jobs:
echo "List all the files that have changed: ${{ steps.changed-files-yaml.outputs.doc_all_changed_files }}"
```
#### Using Github's API
```yaml
name: CI
on:
pull_request:
branches:
- main
jobs:
# -------------------------------------------------------------
# Event `pull_request`: Returns all changed pull request files.
# --------------------------------------------------------------
changed_files:
# NOTE:
# - This is limited to pull_request* events and would raise an error for other events.
# - A maximum of 3000 files can be returned.
# - For more flexibility and no limitations see "Using local .git history" above.
runs-on: ubuntu-latest # windows-latest || macos-latest
name: Test changed-files
permissions:
pull-requests: read
steps:
- name: Get changed files
id: changed-files
uses: tj-actions/changed-files@v37
- name: List all changed files
run: |
for file in ${{ steps.changed-files.outputs.all_changed_files }}; do
echo "$file was changed"
done
```
### On `push`
```yaml
name: CI
on:
push:
branches:
- main
# -------------------------------
# Optionally run on other events
# -------------------------------
# schedule:
# - cron: '0 0 * * *'
#
# release:
# types: [published]
#
# push:
# tags:
# - '**'
#
# ...and many more
jobs:
# -------------------------------------------------------------
# Using GitHub's API is not supported for push events
# -------------------------------------------------------------
#
# ----------------------------------------------------------------------------------------------
# Using local .git history
# ----------------------------------------------------------------------------------------------
# Event `push`: Compare the preceding remote commit -> to the current commit of the main branch
# ----------------------------------------------------------------------------------------------
changed_files:
runs-on: ubuntu-latest # windows-latest || macos-latest
name: Test changed-files
steps:
- uses: actions/checkout@v3
with:
fetch-depth: 0 # OR "2" -> To retrieve the preceding commit.
# Example 1
- name: Get changed files
id: changed-files
uses: tj-actions/changed-files@v37
# NOTE: `since_last_remote_commit: true` is implied by default and falls back to the previous local commit.
- name: List all changed files
run: |
for file in ${{ steps.changed-files.outputs.all_changed_files }}; do
echo "$file was changed"
done
# Example 2: See above
...
# Example 3: See above
...
```
To access more examples, navigate to the [Examples](#examples) section.
If you feel generous and want to show some extra appreciation:
@@ -296,47 +343,52 @@ Support this project with a :star:
<!-- AUTO-DOC-INPUT:START - Do not remove or modify this section -->
| INPUT | TYPE | REQUIRED | DEFAULT | DESCRIPTION |
|----------------------------------------------|--------|----------|---------------------------|---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|
| api\_url | string | false | `"${{ github.api_url }}"` | Github API URL. |
| base\_sha | string | false | | Specify a different base commit <br>SHA used for comparing changes |
| 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. |
| 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`. |
| 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`. |
| dir\_names\_max\_depth | string | false | | Limit the directory output to <br>a maximum depth e.g `test/test1/test2` <br>with max depth of `2` <br>returns `test/test1`. |
| escape\_json | string | false | `"true"` | Escape JSON output. |
| fetch\_depth | string | false | `"50"` | Depth of additional branch history <br>fetched. **NOTE**: This can be <br>adjusted to resolve errors with <br>insufficient history. |
| files | string | false | | File and directory patterns used <br>to detect changes (Defaults to the entire repo if unset) **NOTE:** <br>Multiline file/directory patterns should not <br>include quotes. |
| files\_from\_source\_file | string | false | | Source file(s) used to populate <br>the `files` input. |
| files\_from\_source\_file\_separator | string | false | `"\n"` | Separator used to split the <br>`files_from_source_file` input |
| files\_ignore | string | false | | Ignore changes to these file(s) <br>**NOTE:** Multiline file/directory patterns should <br>not include quotes. |
| files\_ignore\_from\_source\_file | string | false | | Source file(s) used to populate <br>the `files_ignore` input |
| files\_ignore\_from\_source\_file\_separator | string | false | `"\n"` | Separator used to split the <br>`files_ignore_from_source_file` input |
| files\_ignore\_separator | string | false | `"\n"` | Separator used to split the <br>`files_ignore` input |
| files\_ignore\_yaml | string | false | | YAML used to define a <br>set of file patterns to <br>ignore changes |
| files\_ignore\_yaml\_from\_source\_file | string | false | | Source file(s) used to populate <br>the `files_ignore_yaml` input. [Example](https://github.com/tj-actions/changed-files/blob/main/test/changed-files.yml) |
| files\_ignore\_yaml\_from\_source\_file\_separator | string | false | `"\n"` | Separator used to split the <br>`files_ignore_yaml_from_source_file` input |
| files\_separator | string | false | `"\n"` | Separator used to split the <br>`files` input |
| files\_yaml | string | false | | YAML used to define a <br>set of file patterns to <br>detect changes |
| files\_yaml\_from\_source\_file | string | false | | Source file(s) used to populate <br>the `files_yaml` input. [Example](https://github.com/tj-actions/changed-files/blob/main/test/changed-files.yml) |
| files\_yaml\_from\_source\_file\_separator | string | false | `"\n"` | Separator used to split the <br>`files_yaml_from_source_file` input |
| include\_all\_old\_new\_renamed\_files | string | false | `"false"` | Include `all_old_new_renamed_files` output. Note this <br>can generate a large output <br>See: [#501](https://github.com/tj-actions/changed-files/issues/501). |
| json | string | false | `"false"` | Output list of changed files <br>in a JSON formatted string <br>which can be used for <br>matrix jobs. |
| old\_new\_files\_separator | string | false | `" "` | Split character for old and <br>new renamed filename pairs. |
| old\_new\_separator | string | false | `","` | Split character for old and <br>new filename pairs. |
| output\_dir | string | false | `".github/outputs"` | Directory to store output files. |
| output\_renamed\_files\_as\_deleted\_and\_added | string | false | `"false"` | Output renamed files as deleted <br>and added files. |
| path | string | false | `"."` | Specify a relative path under <br>`$GITHUB_WORKSPACE` to locate the repository. |
| quotepath | string | false | `"true"` | Use non-ascii characters to match <br>files and output the filenames <br>completely verbatim by setting this <br>to `false` |
| recover\_deleted\_files | string | false | `"false"` | Recover deleted files. |
| recover\_deleted\_files\_to\_destination | string | false | | Recover deleted files to a <br>new destination directory, defaults to <br>the original location. |
| separator | string | false | `" "` | Split character for output strings |
| sha | string | false | | Specify a different commit SHA <br>used for comparing changes |
| since | string | false | | Get changed files for commits <br>whose timestamp is older than <br>the given time. |
| since\_last\_remote\_commit | string | false | `"false"` | Use the last commit on <br>the remote branch as the <br>`base_sha`. Defaults to the last <br>non-merge commit on the target <br>branch for pull request events <br>and the previous remote commit <br>of the current branch for <br>push events. |
| token | string | false | `"${{ github.token }}"` | Github token used to fetch <br>changed files from Github's API. |
| until | string | false | | Get changed files for commits <br>whose timestamp is earlier than <br>the given time. |
| write\_output\_files | string | false | `"false"` | Write outputs to the `output_dir` <br>defaults to `.github/outputs` folder. **NOTE:** <br>This creates a `.txt` file <br>by default and a `.json` <br>file if `json` is set <br>to `true`. |
| INPUT | TYPE | REQUIRED | DEFAULT | DESCRIPTION |
|----------------------------------------------|--------|----------|---------------------------|-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|
| api\_url | string | false | `"${{ github.api_url }}"` | Github API URL. |
| base\_sha | string | false | | Specify a different base commit <br>SHA used for comparing changes |
| 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. |
| 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`. |
| 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`. |
| dir\_names\_max\_depth | string | false | | Limit the directory output to <br>a maximum depth e.g `test/test1/test2` <br>with max depth of `2` <br>returns `test/test1`. |
| escape\_json | string | false | `"true"` | Escape JSON output. |
| fetch\_depth | string | false | `"50"` | Depth of additional branch history <br>fetched. **NOTE**: This can be <br>adjusted to resolve errors with <br>insufficient history. |
| files | string | false | | File and directory patterns used <br>to detect changes (Defaults to the entire repo if unset) **NOTE:** <br>Multiline file/directory patterns should not <br>include quotes. |
| files\_from\_source\_file | string | false | | Source file(s) used to populate <br>the `files` input. |
| files\_from\_source\_file\_separator | string | false | `"\n"` | Separator used to split the <br>`files_from_source_file` input |
| files\_ignore | string | false | | Ignore changes to these file(s) <br>**NOTE:** Multiline file/directory patterns should <br>not include quotes. |
| files\_ignore\_from\_source\_file | string | false | | Source file(s) used to populate <br>the `files_ignore` input |
| files\_ignore\_from\_source\_file\_separator | string | false | `"\n"` | Separator used to split the <br>`files_ignore_from_source_file` input |
| files\_ignore\_separator | string | false | `"\n"` | Separator used to split the <br>`files_ignore` input |
| files\_ignore\_yaml | string | false | | YAML used to define a <br>set of file patterns to <br>ignore changes |
| files\_ignore\_yaml\_from\_source\_file | string | false | | Source file(s) used to populate <br>the `files_ignore_yaml` input. [Example](https://github.com/tj-actions/changed-files/blob/main/test/changed-files.yml) |
| files\_ignore\_yaml\_from\_source\_file\_separator | string | false | `"\n"` | Separator used to split the <br>`files_ignore_yaml_from_source_file` input |
| files\_separator | string | false | `"\n"` | Separator used to split the <br>`files` input |
| files\_yaml | string | false | | YAML used to define a <br>set of file patterns to <br>detect changes |
| files\_yaml\_from\_source\_file | string | false | | Source file(s) used to populate <br>the `files_yaml` input. [Example](https://github.com/tj-actions/changed-files/blob/main/test/changed-files.yml) |
| files\_yaml\_from\_source\_file\_separator | string | false | `"\n"` | Separator used to split the <br>`files_yaml_from_source_file` input |
| include\_all\_old\_new\_renamed\_files | string | false | `"false"` | Include `all_old_new_renamed_files` output. Note this <br>can generate a large output <br>See: [#501](https://github.com/tj-actions/changed-files/issues/501). |
| json | string | false | `"false"` | Output list of changed files <br>in a JSON formatted string <br>which can be used for <br>matrix jobs. |
| old\_new\_files\_separator | string | false | `" "` | Split character for old and <br>new renamed filename pairs. |
| old\_new\_separator | string | false | `","` | Split character for old and <br>new filename pairs. |
| output\_dir | string | false | `".github/outputs"` | Directory to store output files. |
| output\_renamed\_files\_as\_deleted\_and\_added | string | false | `"false"` | Output renamed files as deleted <br>and added files. |
| path | string | false | `"."` | Specify a relative path under <br>`$GITHUB_WORKSPACE` to locate the repository. |
| quotepath | string | false | `"true"` | Use non-ascii characters to match <br>files and output the filenames <br>completely verbatim by setting this <br>to `false` |
| recover\_deleted\_files | string | false | `"false"` | Recover deleted files. |
| recover\_deleted\_files\_to\_destination | string | false | | Recover deleted files to a <br>new destination directory, defaults to <br>the original location. |
| recover\_files | string | false | | File and directory patterns used <br>to recover deleted files. |
| recover\_files\_ignore | string | false | | File and directory patterns to <br>ignore when recovering deleted files. |
| recover\_files\_ignore\_separator | string | false | `"\n"` | Separator used to split the <br>`recover_files_ignore` input |
| recover\_files\_separator | string | false | `"\n"` | Separator used to split the <br>`recover_files` input |
| separator | string | false | `" "` | Split character for output strings |
| sha | string | false | | Specify a different commit SHA <br>used for comparing changes |
| since | string | false | | Get changed files for commits <br>whose timestamp is older than <br>the given time. |
| since\_last\_remote\_commit | string | false | `"false"` | Use the last commit on <br>the remote branch as the <br>`base_sha`. Defaults to the last <br>non-merge commit on the target <br>branch for pull request events <br>and the previous remote commit <br>of the current branch for <br>push events. |
| skip\_initial\_fetch | string | false | `"false"` | Skip the initial fetch to <br>improve performance for shallow repositories. <br>**NOTE**: This could lead to <br>errors with missing history and <br>the intended use is limited <br>to when you've fetched the <br>history necessary to perform the <br>diff. |
| token | string | false | `"${{ github.token }}"` | Github token used to fetch <br>changed files from Github's API. |
| until | string | false | | Get changed files for commits <br>whose timestamp is earlier than <br>the given time. |
| write\_output\_files | string | false | `"false"` | Write outputs to the `output_dir` <br>defaults to `.github/outputs` folder. **NOTE:** <br>This creates a `.txt` file <br>by default and a `.json` <br>file if `json` is set <br>to `true`. |
<!-- AUTO-DOC-INPUT:END -->
@@ -368,7 +420,7 @@ The format of the version string is as follows:
</details>
<details>
<summary>Get all changed files and using a comma separator</summary>
<summary>Get all changed files and use a comma separator</summary>
```yaml
...
@@ -431,7 +483,7 @@ See [outputs](#outputs) for a list of all available outputs.
```yaml
...
- name: Get changed files and write the outputs to a txt file
- name: Get changed files and write the outputs to a Txt file
id: changed-files-write-output-files-txt
uses: ./
with:
@@ -450,7 +502,7 @@ See [outputs](#outputs) for a list of all available outputs.
```yaml
...
- name: Get changed files and write the outputs to a json file
- name: Get changed files and write the outputs to a JSON file
id: changed-files-write-output-files-json
uses: ./
with:
@@ -480,7 +532,7 @@ See [outputs](#outputs) for a list of all available outputs.
*.png
!*.md
test_directory
**/*.sql
**.sql
...
```
@@ -503,7 +555,7 @@ See [inputs](#inputs) for more information.
*.png
!*.md
test_directory
**/*.sql
**.sql
- name: Run step if any of the listed files above change
if: steps.changed-files-specific.outputs.any_changed == 'true'
@@ -680,7 +732,7 @@ See [inputs](#inputs) for more information.
</details>
<details>
<summary>Get all changed files with non äšćįí characters i.e (Filename in other languages)</summary>
<summary>Get all changed files with non-äšćįí characters i.e (Filename in other languages)</summary>
```yaml
...
@@ -747,10 +799,10 @@ See [inputs](#inputs) for more information.
- uses: nrwl/nx-set-shas@v3
id: last_successful_commit_pull_request
with:
main-branch-name: ${{ steps.branch-name.outputs.base_ref_branch }} # Get the last successful commit on master or main branch
main-branch-name: ${{ steps.branch-name.outputs.base_ref_branch }} # Get the last successful commit on the master or main branch
workflow_id: 'test.yml'
- name: Run changed-files with the commit of the last successful test workflow run on main
- name: Run changed-files with the commit of the last successful test workflow run on the main branch
id: changed-files-base-sha-pull-request
uses: tj-actions/changed-files@v37
with:
@@ -791,7 +843,7 @@ See [inputs](#inputs) for more information.
```yaml
...
- name: Run changed-files with json output
- name: Run changed-files with JSON output
id: changed-files-json
uses: tj-actions/changed-files@v37
with:
@@ -826,7 +878,7 @@ See [inputs](#inputs) for more information.
</details>
## Real world usage
## Real-world usage
* [vitejs/vite: uses tj-actions/changed-files to automate testing](https://github.com/vitejs/vite/blob/8da04227d6f818a8ad9efc0056101968037c2e36/.github/workflows/ci.yml#L61)
@@ -842,6 +894,8 @@ See [inputs](#inputs) for more information.
* [aws-doc-sdk-examples: uses tj-actions/changed-files to automate testing](https://github.com/awsdocs/aws-doc-sdk-examples/blob/2393723ef6b0cad9502f4852f5c72f7be58ca89d/.github/workflows/javascript.yml#L22)
* [nhost: uses tj-actions/changed-files to automate testing based on changes detected](https://github.com/nhost/nhost/blob/main/.github/workflows/ci.yaml#L44-L48)
![image](https://github.com/tj-actions/changed-files/assets/17484350/23767413-4c51-42fb-ab1c-39ef72c44904)
And many more...
@@ -851,7 +905,7 @@ And many more...
> **Warning**:
>
> * Spaces in file names can introduce bugs when using bash loops. See: [#216](https://github.com/tj-actions/changed-files/issues/216)
> However, this action will handle spaces in file names, with a recommendation of using a separator to prevent hidden issues.
> However, this action will handle spaces in file names, with a recommendation of using a separator to prevent any hidden issues.
>
> ![Screen Shot 2021-10-23 at 9 37 34 AM](https://user-images.githubusercontent.com/17484350/138558767-b13c90bf-a1ae-4e86-9520-70a6a4624f41.png)

View File

@@ -124,6 +124,10 @@ inputs:
description: "Depth of additional branch history fetched. **NOTE**: This can be adjusted to resolve errors with insufficient history."
required: false
default: "50"
skip_initial_fetch:
description: "Skip the initial fetch to improve performance for shallow repositories. **NOTE**: This could lead to errors with missing history and the intended use is limited to when you've fetched the history necessary to perform the diff."
required: false
default: "false"
since_last_remote_commit:
description: "Use the last commit on the remote branch as the `base_sha`. Defaults to the last non-merge commit on the target branch for pull request events and the previous remote commit of the current branch for push events."
required: false
@@ -148,6 +152,22 @@ inputs:
description: "Recover deleted files to a new destination directory, defaults to the original location."
required: false
default: ""
recover_files:
description: "File and directory patterns used to recover deleted files."
required: false
default: ""
recover_files_separator:
description: "Separator used to split the `recover_files` input"
default: "\n"
required: false
recover_files_ignore:
description: "File and directory patterns to ignore when recovering deleted files."
required: false
default: ""
recover_files_ignore_separator:
description: "Separator used to split the `recover_files_ignore` input"
default: "\n"
required: false
token:
description: "Github token used to fetch changed files from Github's API."
required: false

405
dist/index.js generated vendored
View File

@@ -52,9 +52,9 @@ Object.defineProperty(exports, "__esModule", ({ value: true }));
exports.getChangedFilesFromGithubAPI = exports.getAllChangeTypeFiles = exports.getChangeTypeFiles = exports.getAllDiffFiles = exports.ChangeTypeEnum = exports.getRenamedFiles = void 0;
const core = __importStar(__nccwpck_require__(2186));
const github = __importStar(__nccwpck_require__(5438));
const flatten_1 = __importDefault(__nccwpck_require__(2394));
const path = __importStar(__nccwpck_require__(1017));
const utils_1 = __nccwpck_require__(918);
const flatten_1 = __importDefault(__nccwpck_require__(2394));
const getRenamedFiles = ({ inputs, workingDirectory, hasSubmodule, diffResult, submodulePaths }) => __awaiter(void 0, void 0, void 0, function* () {
const renamedFiles = yield (0, utils_1.gitRenamedFiles)({
cwd: workingDirectory,
@@ -170,7 +170,7 @@ function* getChangeTypeFilesGenerator({ inputs, changedFiles, changeTypes }) {
const getChangeTypeFiles = ({ inputs, changedFiles, changeTypes }) => __awaiter(void 0, void 0, void 0, function* () {
const files = [
...new Set(getChangeTypeFilesGenerator({ inputs, changedFiles, changeTypes }))
];
].filter(Boolean);
if (inputs.json) {
return {
paths: (0, utils_1.jsonOutput)({ value: files, shouldEscape: inputs.escapeJson }),
@@ -200,7 +200,7 @@ function* getAllChangeTypeFilesGenerator({ inputs, changedFiles }) {
const getAllChangeTypeFiles = ({ inputs, changedFiles }) => __awaiter(void 0, void 0, void 0, function* () {
const files = [
...new Set(getAllChangeTypeFilesGenerator({ inputs, changedFiles }))
];
].filter(Boolean);
if (inputs.json) {
return {
paths: (0, utils_1.jsonOutput)({ value: files, shouldEscape: inputs.escapeJson }),
@@ -213,8 +213,9 @@ const getAllChangeTypeFiles = ({ inputs, changedFiles }) => __awaiter(void 0, vo
};
});
exports.getAllChangeTypeFiles = getAllChangeTypeFiles;
const getChangedFilesFromGithubAPI = ({ inputs, env }) => __awaiter(void 0, void 0, void 0, function* () {
const getChangedFilesFromGithubAPI = ({ inputs }) => __awaiter(void 0, void 0, void 0, function* () {
var _a, e_1, _b, _c;
var _d;
const octokit = github.getOctokit(inputs.token, {
baseUrl: inputs.apiUrl
});
@@ -232,7 +233,7 @@ const getChangedFilesFromGithubAPI = ({ inputs, env }) => __awaiter(void 0, void
const options = octokit.rest.pulls.listFiles.endpoint.merge({
owner: github.context.repo.owner,
repo: github.context.repo.repo,
pull_number: env.GITHUB_EVENT_PULL_REQUEST_NUMBER,
pull_number: (_d = github.context.payload.pull_request) === null || _d === void 0 ? void 0 : _d.number,
per_page: 100
});
const paginatedResponse = yield octokit.paginate(options);
@@ -247,9 +248,9 @@ const getChangedFilesFromGithubAPI = ({ inputs, env }) => __awaiter(void 0, void
unchanged: ChangeTypeEnum.Unmerged
};
try {
for (var _d = true, paginatedResponse_1 = __asyncValues(paginatedResponse), paginatedResponse_1_1; paginatedResponse_1_1 = yield paginatedResponse_1.next(), _a = paginatedResponse_1_1.done, !_a; _d = true) {
for (var _e = true, paginatedResponse_1 = __asyncValues(paginatedResponse), paginatedResponse_1_1; paginatedResponse_1_1 = yield paginatedResponse_1.next(), _a = paginatedResponse_1_1.done, !_a; _e = true) {
_c = paginatedResponse_1_1.value;
_d = false;
_e = false;
const item = _c;
const changeType = statusMap[item.status] || ChangeTypeEnum.Unknown;
if (changeType === ChangeTypeEnum.Renamed) {
@@ -269,7 +270,7 @@ const getChangedFilesFromGithubAPI = ({ inputs, env }) => __awaiter(void 0, void
catch (e_1_1) { e_1 = { error: e_1_1 }; }
finally {
try {
if (!_d && !_a && (_b = paginatedResponse_1.return)) yield _b.call(paginatedResponse_1);
if (!_e && !_a && (_b = paginatedResponse_1.return)) yield _b.call(paginatedResponse_1);
}
finally { if (e_1) throw e_1.error; }
}
@@ -325,26 +326,18 @@ const utils_1 = __nccwpck_require__(918);
const getOutputKey = (key, outputPrefix) => {
return outputPrefix ? `${outputPrefix}_${key}` : key;
};
const setChangedFilesOutput = ({ allDiffFiles, inputs, workingDirectory, diffResult, filePatterns = [], outputPrefix = '' }) => __awaiter(void 0, void 0, void 0, function* () {
const setChangedFilesOutput = ({ allDiffFiles, inputs, filePatterns = [], outputPrefix = '' }) => __awaiter(void 0, void 0, void 0, function* () {
const allFilteredDiffFiles = yield (0, utils_1.getFilteredChangedFiles)({
allDiffFiles,
filePatterns
});
core.debug(`All filtered diff files: ${JSON.stringify(allFilteredDiffFiles)}`);
if (diffResult) {
yield (0, utils_1.recoverDeletedFiles)({
inputs,
workingDirectory,
deletedFiles: allFilteredDiffFiles[changedFiles_1.ChangeTypeEnum.Deleted],
sha: diffResult.previousSha
});
}
const addedFiles = yield (0, changedFiles_1.getChangeTypeFiles)({
inputs,
changedFiles: allFilteredDiffFiles,
changeTypes: [changedFiles_1.ChangeTypeEnum.Added]
});
core.debug(`Added files: ${addedFiles}`);
core.debug(`Added files: ${JSON.stringify(addedFiles)}`);
yield (0, utils_1.setOutput)({
key: getOutputKey('added_files', outputPrefix),
value: addedFiles.paths,
@@ -360,7 +353,7 @@ const setChangedFilesOutput = ({ allDiffFiles, inputs, workingDirectory, diffRes
changedFiles: allFilteredDiffFiles,
changeTypes: [changedFiles_1.ChangeTypeEnum.Copied]
});
core.debug(`Copied files: ${copiedFiles}`);
core.debug(`Copied files: ${JSON.stringify(copiedFiles)}`);
yield (0, utils_1.setOutput)({
key: getOutputKey('copied_files', outputPrefix),
value: copiedFiles.paths,
@@ -376,7 +369,7 @@ const setChangedFilesOutput = ({ allDiffFiles, inputs, workingDirectory, diffRes
changedFiles: allFilteredDiffFiles,
changeTypes: [changedFiles_1.ChangeTypeEnum.Modified]
});
core.debug(`Modified files: ${modifiedFiles}`);
core.debug(`Modified files: ${JSON.stringify(modifiedFiles)}`);
yield (0, utils_1.setOutput)({
key: getOutputKey('modified_files', outputPrefix),
value: modifiedFiles.paths,
@@ -392,7 +385,7 @@ const setChangedFilesOutput = ({ allDiffFiles, inputs, workingDirectory, diffRes
changedFiles: allFilteredDiffFiles,
changeTypes: [changedFiles_1.ChangeTypeEnum.Renamed]
});
core.debug(`Renamed files: ${renamedFiles}`);
core.debug(`Renamed files: ${JSON.stringify(renamedFiles)}`);
yield (0, utils_1.setOutput)({
key: getOutputKey('renamed_files', outputPrefix),
value: renamedFiles.paths,
@@ -408,7 +401,7 @@ const setChangedFilesOutput = ({ allDiffFiles, inputs, workingDirectory, diffRes
changedFiles: allFilteredDiffFiles,
changeTypes: [changedFiles_1.ChangeTypeEnum.TypeChanged]
});
core.debug(`Type changed files: ${typeChangedFiles}`);
core.debug(`Type changed files: ${JSON.stringify(typeChangedFiles)}`);
yield (0, utils_1.setOutput)({
key: getOutputKey('type_changed_files', outputPrefix),
value: typeChangedFiles.paths,
@@ -424,7 +417,7 @@ const setChangedFilesOutput = ({ allDiffFiles, inputs, workingDirectory, diffRes
changedFiles: allFilteredDiffFiles,
changeTypes: [changedFiles_1.ChangeTypeEnum.Unmerged]
});
core.debug(`Unmerged files: ${unmergedFiles}`);
core.debug(`Unmerged files: ${JSON.stringify(unmergedFiles)}`);
yield (0, utils_1.setOutput)({
key: getOutputKey('unmerged_files', outputPrefix),
value: unmergedFiles.paths,
@@ -440,7 +433,7 @@ const setChangedFilesOutput = ({ allDiffFiles, inputs, workingDirectory, diffRes
changedFiles: allFilteredDiffFiles,
changeTypes: [changedFiles_1.ChangeTypeEnum.Unknown]
});
core.debug(`Unknown files: ${unknownFiles}`);
core.debug(`Unknown files: ${JSON.stringify(unknownFiles)}`);
yield (0, utils_1.setOutput)({
key: getOutputKey('unknown_files', outputPrefix),
value: unknownFiles.paths,
@@ -455,7 +448,7 @@ const setChangedFilesOutput = ({ allDiffFiles, inputs, workingDirectory, diffRes
inputs,
changedFiles: allFilteredDiffFiles
});
core.debug(`All changed and modified files: ${allChangedAndModifiedFiles}`);
core.debug(`All changed and modified files: ${JSON.stringify(allChangedAndModifiedFiles)}`);
yield (0, utils_1.setOutput)({
key: getOutputKey('all_changed_and_modified_files', outputPrefix),
value: allChangedAndModifiedFiles.paths,
@@ -476,7 +469,7 @@ const setChangedFilesOutput = ({ allDiffFiles, inputs, workingDirectory, diffRes
changedFiles_1.ChangeTypeEnum.Renamed
]
});
core.debug(`All changed files: ${allChangedFiles}`);
core.debug(`All changed files: ${JSON.stringify(allChangedFiles)}`);
yield (0, utils_1.setOutput)({
key: getOutputKey('all_changed_files', outputPrefix),
value: allChangedFiles.paths,
@@ -502,7 +495,7 @@ const setChangedFilesOutput = ({ allDiffFiles, inputs, workingDirectory, diffRes
changedFiles_1.ChangeTypeEnum.Renamed
]
});
core.debug(`All other changed files: ${allOtherChangedFiles}`);
core.debug(`All other changed files: ${JSON.stringify(allOtherChangedFiles)}`);
const otherChangedFiles = allOtherChangedFiles.paths
.split(inputs.separator)
.filter((filePath) => !allChangedFiles.paths.split(inputs.separator).includes(filePath));
@@ -535,7 +528,7 @@ const setChangedFilesOutput = ({ allDiffFiles, inputs, workingDirectory, diffRes
changedFiles_1.ChangeTypeEnum.Deleted
]
});
core.debug(`All modified files: ${allModifiedFiles}`);
core.debug(`All modified files: ${JSON.stringify(allModifiedFiles)}`);
yield (0, utils_1.setOutput)({
key: getOutputKey('all_modified_files', outputPrefix),
value: allModifiedFiles.paths,
@@ -588,7 +581,7 @@ const setChangedFilesOutput = ({ allDiffFiles, inputs, workingDirectory, diffRes
changedFiles: allFilteredDiffFiles,
changeTypes: [changedFiles_1.ChangeTypeEnum.Deleted]
});
core.debug(`Deleted files: ${deletedFiles}`);
core.debug(`Deleted files: ${JSON.stringify(deletedFiles)}`);
yield (0, utils_1.setOutput)({
key: getOutputKey('deleted_files', outputPrefix),
value: deletedFiles.paths,
@@ -676,8 +669,10 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge
Object.defineProperty(exports, "__esModule", ({ value: true }));
exports.getSHAForPullRequestEvent = exports.getSHAForPushEvent = void 0;
const core = __importStar(__nccwpck_require__(2186));
const github = __importStar(__nccwpck_require__(5438));
const utils_1 = __nccwpck_require__(918);
const getCurrentSHA = ({ env, inputs, workingDirectory }) => __awaiter(void 0, void 0, void 0, function* () {
const getCurrentSHA = ({ inputs, workingDirectory }) => __awaiter(void 0, void 0, void 0, function* () {
var _a, _b, _c, _d, _e, _f;
let currentSha = inputs.sha;
core.debug('Getting current SHA...');
if (inputs.until) {
@@ -703,13 +698,13 @@ const getCurrentSHA = ({ env, inputs, workingDirectory }) => __awaiter(void 0, v
}
else {
if (!currentSha) {
if (env.GITHUB_EVENT_PULL_REQUEST_HEAD_SHA &&
if (((_b = (_a = github.context.payload.pull_request) === null || _a === void 0 ? void 0 : _a.head) === null || _b === void 0 ? void 0 : _b.sha) &&
(yield (0, utils_1.verifyCommitSha)({
sha: env.GITHUB_EVENT_PULL_REQUEST_HEAD_SHA,
sha: (_d = (_c = github.context.payload.pull_request) === null || _c === void 0 ? void 0 : _c.head) === null || _d === void 0 ? void 0 : _d.sha,
cwd: workingDirectory,
showAsErrorMessage: false
})) === 0) {
currentSha = env.GITHUB_EVENT_PULL_REQUEST_HEAD_SHA;
currentSha = (_f = (_e = github.context.payload.pull_request) === null || _e === void 0 ? void 0 : _e.head) === null || _f === void 0 ? void 0 : _f.sha;
}
else {
currentSha = yield (0, utils_1.getHeadSha)({ cwd: workingDirectory });
@@ -721,14 +716,15 @@ const getCurrentSHA = ({ env, inputs, workingDirectory }) => __awaiter(void 0, v
return currentSha;
});
const getSHAForPushEvent = (inputs, env, workingDirectory, isShallow, hasSubmodule, gitFetchExtraArgs, isTag) => __awaiter(void 0, void 0, void 0, function* () {
var _g;
let targetBranch = env.GITHUB_REF_NAME;
const currentBranch = targetBranch;
let initialCommit = false;
if (isShallow) {
if (isShallow && !inputs.skipInitialFetch) {
core.info('Repository is shallow, fetching more history...');
if (isTag) {
const sourceBranch = env.GITHUB_EVENT_BASE_REF.replace('refs/heads/', '') ||
env.GITHUB_EVENT_RELEASE_TARGET_COMMITISH;
const sourceBranch = github.context.payload.base_ref.replace('refs/heads/', '') ||
((_g = github.context.payload.release) === null || _g === void 0 ? void 0 : _g.target_commitish);
yield (0, utils_1.gitFetch)({
cwd: workingDirectory,
args: [
@@ -766,7 +762,7 @@ const getSHAForPushEvent = (inputs, env, workingDirectory, isShallow, hasSubmodu
});
}
}
const currentSha = yield getCurrentSHA({ env, inputs, workingDirectory });
const currentSha = yield getCurrentSHA({ inputs, workingDirectory });
let previousSha = inputs.baseSha;
const diff = '..';
if (previousSha && currentSha && currentBranch && targetBranch) {
@@ -812,8 +808,9 @@ const getSHAForPushEvent = (inputs, env, workingDirectory, isShallow, hasSubmodu
}
else {
core.debug('Getting previous SHA for last remote commit...');
if (env.GITHUB_EVENT_FORCED === 'false' || !env.GITHUB_EVENT_FORCED) {
previousSha = env.GITHUB_EVENT_BEFORE;
if (github.context.payload.forced === 'false' ||
!github.context.payload.forced) {
previousSha = github.context.payload.before;
}
if (!previousSha ||
previousSha === '0000000000000000000000000000000000000000') {
@@ -863,12 +860,13 @@ const getSHAForPushEvent = (inputs, env, workingDirectory, isShallow, hasSubmodu
});
exports.getSHAForPushEvent = getSHAForPushEvent;
const getSHAForPullRequestEvent = (inputs, env, workingDirectory, isShallow, hasSubmodule, gitFetchExtraArgs) => __awaiter(void 0, void 0, void 0, function* () {
let targetBranch = env.GITHUB_EVENT_PULL_REQUEST_BASE_REF;
const currentBranch = env.GITHUB_EVENT_PULL_REQUEST_HEAD_REF;
var _h, _j, _k, _l, _m, _o, _p, _q, _r, _s, _t, _u, _v, _w, _x;
let targetBranch = (_j = (_h = github.context.payload.pull_request) === null || _h === void 0 ? void 0 : _h.base) === null || _j === void 0 ? void 0 : _j.ref;
const currentBranch = (_l = (_k = github.context.payload.pull_request) === null || _k === void 0 ? void 0 : _k.head) === null || _l === void 0 ? void 0 : _l.ref;
if (inputs.sinceLastRemoteCommit) {
targetBranch = currentBranch;
}
if (isShallow) {
if (isShallow && !inputs.skipInitialFetch) {
core.info('Repository is shallow, fetching more history...');
let prFetchExitCode = yield (0, utils_1.gitFetch)({
cwd: workingDirectory,
@@ -877,7 +875,7 @@ const getSHAForPullRequestEvent = (inputs, env, workingDirectory, isShallow, has
'-u',
'--progress',
'origin',
`pull/${env.GITHUB_EVENT_PULL_REQUEST_NUMBER}/head:${currentBranch}`
`pull/${(_m = github.context.payload.pull_request) === null || _m === void 0 ? void 0 : _m.number}/head:${currentBranch}`
]
});
if (prFetchExitCode !== 0) {
@@ -923,7 +921,7 @@ const getSHAForPullRequestEvent = (inputs, env, workingDirectory, isShallow, has
}
core.info('Completed fetching more history.');
}
const currentSha = yield getCurrentSHA({ env, inputs, workingDirectory });
const currentSha = yield getCurrentSHA({ inputs, workingDirectory });
let previousSha = inputs.baseSha;
let diff = '...';
if (previousSha && currentSha && currentBranch && targetBranch) {
@@ -942,13 +940,13 @@ const getSHAForPullRequestEvent = (inputs, env, workingDirectory, isShallow, has
diff
};
}
if (!env.GITHUB_EVENT_PULL_REQUEST_BASE_REF ||
env.GITHUB_EVENT_HEAD_REPO_FORK === 'true') {
if (!((_p = (_o = github.context.payload.pull_request) === null || _o === void 0 ? void 0 : _o.base) === null || _p === void 0 ? void 0 : _p.ref) ||
((_r = (_q = github.context.payload.head) === null || _q === void 0 ? void 0 : _q.repo) === null || _r === void 0 ? void 0 : _r.fork) === 'true') {
diff = '..';
}
if (!previousSha) {
if (inputs.sinceLastRemoteCommit) {
previousSha = env.GITHUB_EVENT_BEFORE;
previousSha = github.context.payload.before;
if (!previousSha ||
(previousSha &&
(yield (0, utils_1.verifyCommitSha)({ sha: previousSha, cwd: workingDirectory })) !==
@@ -959,7 +957,7 @@ const getSHAForPullRequestEvent = (inputs, env, workingDirectory, isShallow, has
});
if (!previousSha) {
core.warning('Unable to locate the previous commit in the local history. Falling back to the pull request base sha.');
previousSha = env.GITHUB_EVENT_PULL_REQUEST_BASE_SHA;
previousSha = (_t = (_s = github.context.payload.pull_request) === null || _s === void 0 ? void 0 : _s.base) === null || _t === void 0 ? void 0 : _t.sha;
}
}
}
@@ -969,7 +967,7 @@ const getSHAForPullRequestEvent = (inputs, env, workingDirectory, isShallow, has
branch: targetBranch
});
if (!previousSha) {
previousSha = env.GITHUB_EVENT_PULL_REQUEST_BASE_SHA;
previousSha = (_v = (_u = github.context.payload.pull_request) === null || _u === void 0 ? void 0 : _u.base) === null || _v === void 0 ? void 0 : _v.sha;
}
if (isShallow) {
if (!(yield (0, utils_1.canDiffCommits)({
@@ -978,7 +976,7 @@ const getSHAForPullRequestEvent = (inputs, env, workingDirectory, isShallow, has
sha2: currentSha,
diff
}))) {
core.debug('Merge base is not in the local history, fetching remote target branch...');
core.info('Merge base is not in the local history, fetching remote target branch...');
for (let i = 1; i <= 10; i++) {
yield (0, utils_1.gitFetch)({
cwd: workingDirectory,
@@ -999,14 +997,14 @@ const getSHAForPullRequestEvent = (inputs, env, workingDirectory, isShallow, has
})) {
break;
}
core.debug('Merge base is not in the local history, fetching remote target branch again...');
core.debug(`Attempt ${i}/10`);
core.info('Merge base is not in the local history, fetching remote target branch again...');
core.info(`Attempt ${i}/10`);
}
}
}
}
if (!previousSha || previousSha === currentSha) {
previousSha = env.GITHUB_EVENT_PULL_REQUEST_BASE_SHA;
previousSha = (_x = (_w = github.context.payload.pull_request) === null || _w === void 0 ? void 0 : _w.base) === null || _x === void 0 ? void 0 : _x.sha;
}
}
if (!(yield (0, utils_1.canDiffCommits)({
@@ -1039,7 +1037,7 @@ const getSHAForPullRequestEvent = (inputs, env, workingDirectory, isShallow, has
// uses: actions/checkout@v3
// with:
// repository: ${{ github.event.pull_request.head.repo.full_name }}
if (env.GITHUB_EVENT_NAME === 'pull_request_target') {
if (github.context.eventName === 'pull_request_target') {
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 }}');
}
@@ -1100,35 +1098,13 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge
};
Object.defineProperty(exports, "__esModule", ({ value: true }));
exports.getEnv = void 0;
const fs_1 = __nccwpck_require__(7147);
const core = __importStar(__nccwpck_require__(2186));
const getEnv = () => __awaiter(void 0, void 0, void 0, function* () {
var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m;
const eventPath = process.env.GITHUB_EVENT_PATH;
let eventJson = {};
if (eventPath) {
eventJson = JSON.parse(yield fs_1.promises.readFile(eventPath, { encoding: 'utf8' }));
}
core.debug(`Env: ${JSON.stringify(process.env, null, 2)}`);
core.debug(`Event: ${JSON.stringify(eventJson, null, 2)}`);
core.debug(`Process Env: ${JSON.stringify(process.env, null, 2)}`);
return {
GITHUB_EVENT_PULL_REQUEST_HEAD_REF: ((_b = (_a = eventJson.pull_request) === null || _a === void 0 ? void 0 : _a.head) === null || _b === void 0 ? void 0 : _b.ref) || '',
GITHUB_EVENT_PULL_REQUEST_BASE_REF: ((_d = (_c = eventJson.pull_request) === null || _c === void 0 ? void 0 : _c.base) === null || _d === void 0 ? void 0 : _d.ref) || '',
GITHUB_EVENT_BEFORE: eventJson.before || '',
GITHUB_EVENT_BASE_REF: eventJson.base_ref || '',
GITHUB_EVENT_RELEASE_TARGET_COMMITISH: ((_e = eventJson.release) === null || _e === void 0 ? void 0 : _e.target_commitish) || '',
GITHUB_EVENT_HEAD_REPO_FORK: ((_g = (_f = eventJson.head) === null || _f === void 0 ? void 0 : _f.repo) === null || _g === void 0 ? void 0 : _g.fork) || '',
GITHUB_EVENT_PULL_REQUEST_NUMBER: ((_h = eventJson.pull_request) === null || _h === void 0 ? void 0 : _h.number) || '',
GITHUB_EVENT_PULL_REQUEST_BASE_SHA: ((_k = (_j = eventJson.pull_request) === null || _j === void 0 ? void 0 : _j.base) === null || _k === void 0 ? void 0 : _k.sha) || '',
GITHUB_EVENT_PULL_REQUEST_HEAD_SHA: ((_m = (_l = eventJson.pull_request) === null || _l === void 0 ? void 0 : _l.head) === null || _m === void 0 ? void 0 : _m.sha) || '',
GITHUB_EVENT_FORCED: eventJson.forced || '',
GITHUB_EVENT_ACTION: eventJson.action || '',
GITHUB_REF_NAME: process.env.GITHUB_REF_NAME || '',
GITHUB_REF: process.env.GITHUB_REF || '',
GITHUB_WORKSPACE: process.env.GITHUB_WORKSPACE || '',
GITHUB_EVENT_NAME: process.env.GITHUB_EVENT_NAME || '',
GITHUB_REPOSITORY_OWNER: process.env.GITHUB_REPOSITORY_OWNER || '',
GITHUB_REPOSITORY: process.env.GITHUB_REPOSITORY || ''
GITHUB_WORKSPACE: process.env.GITHUB_WORKSPACE || ''
};
});
exports.getEnv = getEnv;
@@ -1244,8 +1220,23 @@ const getInputs = () => {
required: false
});
const recoverDeletedFilesToDestination = core.getInput('recover_deleted_files_to_destination', { required: false });
const recoverFiles = core.getInput('recover_files', { required: false });
const recoverFilesSeparator = core.getInput('recover_files_separator', {
required: false,
trimWhitespace: false
});
const recoverFilesIgnore = core.getInput('recover_files_ignore', {
required: false
});
const recoverFilesIgnoreSeparator = core.getInput('recover_files_ignore_separator', {
required: false,
trimWhitespace: false
});
const token = core.getInput('token', { required: false });
const apiUrl = core.getInput('api_url', { required: false });
const skipInitialFetch = core.getBooleanInput('skip_initial_fetch', {
required: false
});
const inputs = {
files,
filesSeparator,
@@ -1273,6 +1264,10 @@ const getInputs = () => {
sinceLastRemoteCommit,
recoverDeletedFiles,
recoverDeletedFilesToDestination,
recoverFiles,
recoverFilesSeparator,
recoverFilesIgnore,
recoverFilesIgnoreSeparator,
includeAllOldNewRenamedFiles,
oldNewSeparator,
oldNewFilesSeparator,
@@ -1285,7 +1280,8 @@ const getInputs = () => {
outputDir,
outputRenamedFilesAsDeletedAndAdded,
token,
apiUrl
apiUrl,
skipInitialFetch
};
if (fetchDepth) {
inputs.fetchDepth = Math.max(parseInt(fetchDepth, 10), 2);
@@ -1343,6 +1339,7 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
Object.defineProperty(exports, "__esModule", ({ value: true }));
exports.run = void 0;
const core = __importStar(__nccwpck_require__(2186));
const github = __importStar(__nccwpck_require__(5438));
const path_1 = __importDefault(__nccwpck_require__(1017));
const changedFiles_1 = __nccwpck_require__(7358);
const changedFilesOutput_1 = __nccwpck_require__(8930);
@@ -1350,8 +1347,42 @@ const commitSha_1 = __nccwpck_require__(8613);
const env_1 = __nccwpck_require__(9763);
const inputs_1 = __nccwpck_require__(6180);
const utils_1 = __nccwpck_require__(918);
const getChangedFilesFromLocalGit = ({ inputs, env, workingDirectory }) => __awaiter(void 0, void 0, void 0, function* () {
var _a;
const changedFilesOutput = ({ filePatterns, allDiffFiles, inputs, yamlFilePatterns }) => __awaiter(void 0, void 0, void 0, function* () {
if (filePatterns.length > 0) {
core.startGroup('changed-files-patterns');
yield (0, changedFilesOutput_1.setChangedFilesOutput)({
allDiffFiles,
filePatterns,
inputs
});
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}`);
yield (0, changedFilesOutput_1.setChangedFilesOutput)({
allDiffFiles,
filePatterns: yamlFilePatterns[key],
outputPrefix: key,
inputs
});
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,
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;
yield (0, utils_1.verifyMinimumGitVersion)();
let quotePathValue = 'on';
if (!inputs.quotePath) {
@@ -1380,12 +1411,12 @@ const getChangedFilesFromLocalGit = ({ inputs, env, workingDirectory }) => __awa
gitFetchExtraArgs = ['--prune', '--no-recurse-submodules'];
}
let diffResult;
if (!env.GITHUB_EVENT_PULL_REQUEST_BASE_REF) {
core.info(`Running on a ${env.GITHUB_EVENT_NAME || 'push'} event...`);
if (!((_c = (_b = github.context.payload.pull_request) === null || _b === void 0 ? void 0 : _b.base) === null || _c === void 0 ? void 0 : _c.ref)) {
core.info(`Running on a ${github.context.eventName || 'push'} event...`);
diffResult = yield (0, commitSha_1.getSHAForPushEvent)(inputs, env, workingDirectory, isShallow, hasSubmodule, gitFetchExtraArgs, isTag);
}
else {
core.info(`Running on a ${env.GITHUB_EVENT_NAME || 'pull_request'} (${env.GITHUB_EVENT_ACTION}) event...`);
core.info(`Running on a ${github.context.eventName || 'pull_request'} (${github.context.payload.action}) event...`);
diffResult = yield (0, commitSha_1.getSHAForPullRequestEvent)(inputs, env, workingDirectory, isShallow, hasSubmodule, gitFetchExtraArgs);
}
if (diffResult.initialCommit) {
@@ -1404,54 +1435,26 @@ const getChangedFilesFromLocalGit = ({ inputs, env, workingDirectory }) => __awa
core.debug(`All diff files: ${JSON.stringify(allDiffFiles)}`);
core.info('All Done!');
core.endGroup();
const filePatterns = yield (0, utils_1.getFilePatterns)({
inputs,
workingDirectory
});
core.debug(`File patterns: ${filePatterns}`);
if (filePatterns.length > 0) {
core.startGroup('changed-files-patterns');
yield (0, changedFilesOutput_1.setChangedFilesOutput)({
allDiffFiles,
filePatterns,
inputs,
workingDirectory,
diffResult
});
core.info('All Done!');
core.endGroup();
}
const yamlFilePatterns = yield (0, utils_1.getYamlFilePatterns)({
inputs,
workingDirectory
});
core.debug(`Yaml file patterns: ${JSON.stringify(yamlFilePatterns)}`);
if (Object.keys(yamlFilePatterns).length > 0) {
for (const key of Object.keys(yamlFilePatterns)) {
core.startGroup(`changed-files-yaml-${key}`);
yield (0, changedFilesOutput_1.setChangedFilesOutput)({
allDiffFiles,
filePatterns: yamlFilePatterns[key],
outputPrefix: key,
inputs,
workingDirectory,
diffResult
});
core.info('All Done!');
core.endGroup();
if (inputs.recoverDeletedFiles) {
let recoverPatterns = (0, utils_1.getRecoverFilePatterns)({ inputs });
if (recoverPatterns.length > 0 && filePatterns.length > 0) {
core.info('No recover patterns found; defaulting to file patterns');
recoverPatterns = filePatterns;
}
}
if (filePatterns.length === 0 && Object.keys(yamlFilePatterns).length === 0) {
core.startGroup('changed-files-all');
yield (0, changedFilesOutput_1.setChangedFilesOutput)({
allDiffFiles,
yield (0, utils_1.recoverDeletedFiles)({
inputs,
workingDirectory,
diffResult
deletedFiles: allDiffFiles[changedFiles_1.ChangeTypeEnum.Deleted],
recoverPatterns,
sha: diffResult.previousSha
});
core.info('All Done!');
core.endGroup();
}
yield changedFilesOutput({
filePatterns,
allDiffFiles,
inputs,
yamlFilePatterns
});
if (inputs.includeAllOldNewRenamedFiles) {
core.startGroup('changed-files-all-old-new-renamed-files');
const allOldNewRenamedFiles = yield (0, changedFiles_1.getRenamedFiles)({
@@ -1476,70 +1479,44 @@ const getChangedFilesFromLocalGit = ({ inputs, env, workingDirectory }) => __awa
core.endGroup();
}
});
const getChangedFilesFromRESTAPI = ({ inputs, env, workingDirectory }) => __awaiter(void 0, void 0, void 0, function* () {
const getChangedFilesFromRESTAPI = ({ inputs, filePatterns, yamlFilePatterns }) => __awaiter(void 0, void 0, void 0, function* () {
const allDiffFiles = yield (0, changedFiles_1.getChangedFilesFromGithubAPI)({
inputs,
env
inputs
});
core.debug(`All diff files: ${JSON.stringify(allDiffFiles)}`);
core.info('All Done!');
const filePatterns = yield (0, utils_1.getFilePatterns)({
yield changedFilesOutput({
filePatterns,
allDiffFiles,
inputs,
workingDirectory
yamlFilePatterns
});
core.debug(`File patterns: ${filePatterns}`);
if (filePatterns.length > 0) {
core.startGroup('changed-files-patterns');
yield (0, changedFilesOutput_1.setChangedFilesOutput)({
allDiffFiles,
filePatterns,
inputs,
workingDirectory
});
core.info('All Done!');
core.endGroup();
}
const yamlFilePatterns = yield (0, utils_1.getYamlFilePatterns)({
inputs,
workingDirectory
});
core.debug(`Yaml file patterns: ${JSON.stringify(yamlFilePatterns)}`);
if (Object.keys(yamlFilePatterns).length > 0) {
for (const key of Object.keys(yamlFilePatterns)) {
core.startGroup(`changed-files-yaml-${key}`);
yield (0, changedFilesOutput_1.setChangedFilesOutput)({
allDiffFiles,
filePatterns: yamlFilePatterns[key],
outputPrefix: key,
inputs,
workingDirectory
});
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,
inputs,
workingDirectory
});
core.info('All Done!');
core.endGroup();
}
});
function run() {
var _a;
return __awaiter(this, void 0, void 0, function* () {
core.startGroup('changed-files');
const env = yield (0, env_1.getEnv)();
core.debug(`Env: ${JSON.stringify(env, null, 2)}`);
const inputs = (0, inputs_1.getInputs)();
core.debug(`Inputs: ${JSON.stringify(inputs, null, 2)}`);
core.debug(`Github Context: ${JSON.stringify(github.context, null, 2)}`);
const workingDirectory = path_1.default.resolve(env.GITHUB_WORKSPACE || process.cwd(), inputs.path);
core.debug(`Working directory: ${workingDirectory}`);
const hasGitDirectory = yield (0, utils_1.hasLocalGitDirectory)({ workingDirectory });
core.debug(`Has git directory: ${hasGitDirectory}`);
const filePatterns = yield (0, utils_1.getFilePatterns)({
inputs,
workingDirectory
});
core.debug(`File patterns: ${filePatterns}`);
const yamlFilePatterns = yield (0, utils_1.getYamlFilePatterns)({
inputs,
workingDirectory
});
core.debug(`Yaml file patterns: ${JSON.stringify(yamlFilePatterns)}`);
if (inputs.token &&
env.GITHUB_EVENT_PULL_REQUEST_NUMBER &&
((_a = github.context.payload.pull_request) === null || _a === void 0 ? void 0 : _a.number) &&
!hasGitDirectory) {
core.info("Using GitHub's REST API to get changed files");
const unsupportedInputs = [
@@ -1557,7 +1534,11 @@ function run() {
core.warning(`Input "${input}" is not supported when using GitHub's REST API to get changed files`);
}
}
yield getChangedFilesFromRESTAPI({ inputs, env, workingDirectory });
yield getChangedFilesFromRESTAPI({
inputs,
filePatterns,
yamlFilePatterns
});
}
else {
if (!hasGitDirectory) {
@@ -1565,7 +1546,13 @@ function run() {
return;
}
core.info('Using local .git directory');
yield getChangedFilesFromLocalGit({ inputs, env, workingDirectory });
yield getChangedFilesFromLocalGit({
inputs,
env,
workingDirectory,
filePatterns,
yamlFilePatterns
});
}
});
}
@@ -1641,7 +1628,7 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
return (mod && mod.__esModule) ? mod : { "default": mod };
};
Object.defineProperty(exports, "__esModule", ({ value: true }));
exports.hasLocalGitDirectory = exports.recoverDeletedFiles = exports.setOutput = exports.getYamlFilePatterns = exports.getFilePatterns = 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 = void 0;
exports.hasLocalGitDirectory = exports.recoverDeletedFiles = exports.setOutput = exports.getRecoverFilePatterns = exports.getYamlFilePatterns = exports.getFilePatterns = 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 = void 0;
/*global AsyncIterableIterator*/
const core = __importStar(__nccwpck_require__(2186));
const exec = __importStar(__nccwpck_require__(1514));
@@ -1870,7 +1857,7 @@ const getSubmodulePath = ({ cwd }) => __awaiter(void 0, void 0, void 0, function
return stdout
.trim()
.split('\n')
.map((line) => normalizePath(line.split(' ')[1]));
.map((line) => normalizePath(line.trim().split(' ')[1]));
});
exports.getSubmodulePath = getSubmodulePath;
const gitSubmoduleDiffSHA = ({ cwd, parentSha1, parentSha2, submodulePath, diff }) => __awaiter(void 0, void 0, void 0, function* () {
@@ -2309,6 +2296,23 @@ const getYamlFilePatterns = ({ inputs, workingDirectory }) => __awaiter(void 0,
return filePatterns;
});
exports.getYamlFilePatterns = getYamlFilePatterns;
const getRecoverFilePatterns = ({ inputs }) => {
let filePatterns = inputs.recoverFiles.split(inputs.recoverFilesSeparator);
if (inputs.recoverFilesIgnore) {
const ignoreFilePatterns = inputs.recoverFilesIgnore.split(inputs.recoverFilesSeparator);
filePatterns = filePatterns.concat(ignoreFilePatterns.map(p => {
if (p.startsWith('!')) {
return p;
}
else {
return `!${p}`;
}
}));
}
core.debug(`recover file patterns: ${filePatterns}`);
return filePatterns.filter(Boolean);
};
exports.getRecoverFilePatterns = getRecoverFilePatterns;
const setOutput = ({ key, value, inputs }) => __awaiter(void 0, void 0, void 0, function* () {
const cleanedValue = value.toString().trim();
core.setOutput(key, cleanedValue);
@@ -2334,23 +2338,31 @@ const getDeletedFileContents = ({ cwd, filePath, sha }) => __awaiter(void 0, voi
}
return stdout;
});
const recoverDeletedFiles = ({ inputs, workingDirectory, deletedFiles, sha }) => __awaiter(void 0, void 0, void 0, function* () {
if (inputs.recoverDeletedFiles) {
for (const deletedFile of deletedFiles) {
let target = path.join(workingDirectory, deletedFile);
if (inputs.recoverDeletedFilesToDestination) {
target = path.join(workingDirectory, inputs.recoverDeletedFilesToDestination, deletedFile);
}
const deletedFileContents = yield getDeletedFileContents({
cwd: workingDirectory,
filePath: deletedFile,
sha
});
if (!(yield exists(path.dirname(target)))) {
yield fs_1.promises.mkdir(path.dirname(target), { recursive: true });
}
yield fs_1.promises.writeFile(target, deletedFileContents);
const recoverDeletedFiles = ({ inputs, workingDirectory, deletedFiles, recoverPatterns, sha }) => __awaiter(void 0, void 0, void 0, function* () {
let recoverableDeletedFiles = deletedFiles;
core.debug(`recoverable deleted files: ${recoverableDeletedFiles}`);
if (recoverPatterns.length > 0) {
recoverableDeletedFiles = (0, micromatch_1.default)(deletedFiles, recoverPatterns, {
dot: true,
windows: IS_WINDOWS,
noext: true
});
core.debug(`filtered recoverable deleted files: ${recoverableDeletedFiles}`);
}
for (const deletedFile of recoverableDeletedFiles) {
let target = path.join(workingDirectory, deletedFile);
if (inputs.recoverDeletedFilesToDestination) {
target = path.join(workingDirectory, inputs.recoverDeletedFilesToDestination, deletedFile);
}
const deletedFileContents = yield getDeletedFileContents({
cwd: workingDirectory,
filePath: deletedFile,
sha
});
if (!(yield exists(path.dirname(target)))) {
yield fs_1.promises.mkdir(path.dirname(target), { recursive: true });
}
yield fs_1.promises.writeFile(target, deletedFileContents);
}
});
exports.recoverDeletedFiles = recoverDeletedFiles;
@@ -29284,8 +29296,11 @@ function fixResponseChunkedTransferBadEnding(request, errorCallback) {
if (headers['transfer-encoding'] === 'chunked' && !headers['content-length']) {
response.once('close', function (hadError) {
// tests for socket presence, as in some situations the
// the 'socket' event is not triggered for the request
// (happens in deno), avoids `TypeError`
// if a data listener is still present we didn't end cleanly
const hasDataListener = socket.listenerCount('data') > 0;
const hasDataListener = socket && socket.listenerCount('data') > 0;
if (hasDataListener && !hadError) {
const err = new Error('Premature close');

2
dist/index.js.map generated vendored

File diff suppressed because one or more lines are too long

View File

@@ -32,30 +32,30 @@
},
"homepage": "https://github.com/tj-actions/glob#readme",
"dependencies": {
"@actions/core": "1.10.0",
"@actions/exec": "1.1.1",
"@actions/github": "5.1.1",
"lodash": "^4.17.15",
"@actions/core": "^1.10.0",
"@actions/exec": "^1.1.1",
"@actions/github": "^5.1.1",
"@octokit/rest": "^19.0.13",
"lodash": "^4.17.21",
"micromatch": "^4.0.5",
"yaml": "^2.3.1",
"@octokit/rest": "^19.0.7"
"yaml": "^2.3.1"
},
"devDependencies": {
"@types/jest": "29.5.2",
"@types/jest": "^29.5.2",
"@types/lodash": "^4.14.195",
"@types/micromatch": "^4.0.2",
"@types/node": "20.3.1",
"@types/uuid": "9.0.2",
"@typescript-eslint/eslint-plugin": "5.60.0",
"@typescript-eslint/parser": "5.60.0",
"@vercel/ncc": "0.36.1",
"eslint": "8.43.0",
"eslint-plugin-github": "4.8.0",
"eslint-plugin-jest": "27.2.2",
"eslint-plugin-prettier": "^4.2.1",
"jest": "29.5.0",
"prettier": "2.8.8",
"ts-jest": "29.1.0",
"typescript": "5.1.3"
"@types/node": "^20.3.2",
"@types/uuid": "^9.0.2",
"@typescript-eslint/eslint-plugin": "^6.0.0",
"@typescript-eslint/parser": "^6.0.0",
"@vercel/ncc": "^0.36.1",
"eslint": "^8.43.0",
"eslint-plugin-github": "^4.8.0",
"eslint-plugin-jest": "^27.2.2",
"eslint-plugin-prettier": "^5.0.0-alpha.2",
"jest": "^29.5.0",
"prettier": "^3.0.0",
"ts-jest": "^29.1.0",
"typescript": "^5.1.3"
}
}

View File

@@ -3,8 +3,8 @@
"config:base"
],
"enabled": true,
"prHourlyLimit": 30,
"prConcurrentLimit": 10,
"prHourlyLimit": 10,
"prConcurrentLimit": 5,
"rebaseWhen": "behind-base-branch",
"addLabels": [
"dependencies",
@@ -20,13 +20,21 @@
"enabled": true,
"automerge": true
},
"nvm": {
"enabled": false
},
"packageRules": [
{
"matchUpdateTypes": ["minor", "patch", "pin", "digest"],
"matchUpdateTypes": [
"minor",
"patch",
"pin",
"digest"
],
"automerge": true,
"rebaseWhen": "behind-base-branch",
"addLabels": [
"automerge"
"merge when passing"
]
},
{
@@ -34,10 +42,15 @@
"matchLanguages": [
"docker"
],
"matchUpdateTypes": ["minor", "patch", "pin", "digest"],
"matchUpdateTypes": [
"minor",
"patch",
"pin",
"digest"
],
"rebaseWhen": "behind-base-branch",
"addLabels": [
"automerge"
"merge when passing"
],
"automerge": true
}

View File

@@ -1,19 +1,18 @@
import * as core from '@actions/core'
import * as github from '@actions/github'
import type {RestEndpointMethodTypes} from '@octokit/rest'
import flatten from 'lodash/flatten'
import * as path from 'path'
import {DiffResult} from './commitSha'
import {Env} from './env'
import {Inputs} from './inputs'
import {
getAllChangedFiles,
getDirnameMaxDepth,
gitRenamedFiles,
gitSubmoduleDiffSHA,
jsonOutput,
getAllChangedFiles
jsonOutput
} from './utils'
import flatten from 'lodash/flatten'
export const getRenamedFiles = async ({
inputs,
@@ -192,7 +191,7 @@ export const getChangeTypeFiles = async ({
}): Promise<{paths: string; count: string}> => {
const files = [
...new Set(getChangeTypeFilesGenerator({inputs, changedFiles, changeTypes}))
]
].filter(Boolean)
if (inputs.json) {
return {
@@ -236,7 +235,7 @@ export const getAllChangeTypeFiles = async ({
}): Promise<{paths: string; count: string}> => {
const files = [
...new Set(getAllChangeTypeFilesGenerator({inputs, changedFiles}))
]
].filter(Boolean)
if (inputs.json) {
return {
@@ -252,11 +251,9 @@ export const getAllChangeTypeFiles = async ({
}
export const getChangedFilesFromGithubAPI = async ({
inputs,
env
inputs
}: {
inputs: Inputs
env: Env
}): Promise<ChangedFiles> => {
const octokit = github.getOctokit(inputs.token, {
baseUrl: inputs.apiUrl
@@ -277,7 +274,7 @@ export const getChangedFilesFromGithubAPI = async ({
const options = octokit.rest.pulls.listFiles.endpoint.merge({
owner: github.context.repo.owner,
repo: github.context.repo.repo,
pull_number: env.GITHUB_EVENT_PULL_REQUEST_NUMBER,
pull_number: github.context.payload.pull_request?.number,
per_page: 100
})

View File

@@ -5,9 +5,8 @@ import {
getAllChangeTypeFiles,
getChangeTypeFiles
} from './changedFiles'
import {DiffResult} from './commitSha'
import {Inputs} from './inputs'
import {getFilteredChangedFiles, recoverDeletedFiles, setOutput} from './utils'
import {getFilteredChangedFiles, setOutput} from './utils'
const getOutputKey = (key: string, outputPrefix: string): string => {
return outputPrefix ? `${outputPrefix}_${key}` : key
@@ -16,15 +15,11 @@ const getOutputKey = (key: string, outputPrefix: string): string => {
export const setChangedFilesOutput = async ({
allDiffFiles,
inputs,
workingDirectory,
diffResult,
filePatterns = [],
outputPrefix = ''
}: {
allDiffFiles: ChangedFiles
inputs: Inputs
workingDirectory: string
diffResult?: DiffResult
filePatterns?: string[]
outputPrefix?: string
}): Promise<void> => {
@@ -34,21 +29,12 @@ export const setChangedFilesOutput = async ({
})
core.debug(`All filtered diff files: ${JSON.stringify(allFilteredDiffFiles)}`)
if (diffResult) {
await recoverDeletedFiles({
inputs,
workingDirectory,
deletedFiles: allFilteredDiffFiles[ChangeTypeEnum.Deleted],
sha: diffResult.previousSha
})
}
const addedFiles = await getChangeTypeFiles({
inputs,
changedFiles: allFilteredDiffFiles,
changeTypes: [ChangeTypeEnum.Added]
})
core.debug(`Added files: ${addedFiles}`)
core.debug(`Added files: ${JSON.stringify(addedFiles)}`)
await setOutput({
key: getOutputKey('added_files', outputPrefix),
value: addedFiles.paths,
@@ -65,7 +51,7 @@ export const setChangedFilesOutput = async ({
changedFiles: allFilteredDiffFiles,
changeTypes: [ChangeTypeEnum.Copied]
})
core.debug(`Copied files: ${copiedFiles}`)
core.debug(`Copied files: ${JSON.stringify(copiedFiles)}`)
await setOutput({
key: getOutputKey('copied_files', outputPrefix),
value: copiedFiles.paths,
@@ -83,7 +69,7 @@ export const setChangedFilesOutput = async ({
changedFiles: allFilteredDiffFiles,
changeTypes: [ChangeTypeEnum.Modified]
})
core.debug(`Modified files: ${modifiedFiles}`)
core.debug(`Modified files: ${JSON.stringify(modifiedFiles)}`)
await setOutput({
key: getOutputKey('modified_files', outputPrefix),
value: modifiedFiles.paths,
@@ -101,7 +87,7 @@ export const setChangedFilesOutput = async ({
changedFiles: allFilteredDiffFiles,
changeTypes: [ChangeTypeEnum.Renamed]
})
core.debug(`Renamed files: ${renamedFiles}`)
core.debug(`Renamed files: ${JSON.stringify(renamedFiles)}`)
await setOutput({
key: getOutputKey('renamed_files', outputPrefix),
value: renamedFiles.paths,
@@ -119,7 +105,7 @@ export const setChangedFilesOutput = async ({
changedFiles: allFilteredDiffFiles,
changeTypes: [ChangeTypeEnum.TypeChanged]
})
core.debug(`Type changed files: ${typeChangedFiles}`)
core.debug(`Type changed files: ${JSON.stringify(typeChangedFiles)}`)
await setOutput({
key: getOutputKey('type_changed_files', outputPrefix),
value: typeChangedFiles.paths,
@@ -137,7 +123,7 @@ export const setChangedFilesOutput = async ({
changedFiles: allFilteredDiffFiles,
changeTypes: [ChangeTypeEnum.Unmerged]
})
core.debug(`Unmerged files: ${unmergedFiles}`)
core.debug(`Unmerged files: ${JSON.stringify(unmergedFiles)}`)
await setOutput({
key: getOutputKey('unmerged_files', outputPrefix),
value: unmergedFiles.paths,
@@ -155,7 +141,7 @@ export const setChangedFilesOutput = async ({
changedFiles: allFilteredDiffFiles,
changeTypes: [ChangeTypeEnum.Unknown]
})
core.debug(`Unknown files: ${unknownFiles}`)
core.debug(`Unknown files: ${JSON.stringify(unknownFiles)}`)
await setOutput({
key: getOutputKey('unknown_files', outputPrefix),
value: unknownFiles.paths,
@@ -172,7 +158,11 @@ export const setChangedFilesOutput = async ({
inputs,
changedFiles: allFilteredDiffFiles
})
core.debug(`All changed and modified files: ${allChangedAndModifiedFiles}`)
core.debug(
`All changed and modified files: ${JSON.stringify(
allChangedAndModifiedFiles
)}`
)
await setOutput({
key: getOutputKey('all_changed_and_modified_files', outputPrefix),
value: allChangedAndModifiedFiles.paths,
@@ -195,7 +185,7 @@ export const setChangedFilesOutput = async ({
ChangeTypeEnum.Renamed
]
})
core.debug(`All changed files: ${allChangedFiles}`)
core.debug(`All changed files: ${JSON.stringify(allChangedFiles)}`)
await setOutput({
key: getOutputKey('all_changed_files', outputPrefix),
value: allChangedFiles.paths,
@@ -224,7 +214,7 @@ export const setChangedFilesOutput = async ({
ChangeTypeEnum.Renamed
]
})
core.debug(`All other changed files: ${allOtherChangedFiles}`)
core.debug(`All other changed files: ${JSON.stringify(allOtherChangedFiles)}`)
const otherChangedFiles = allOtherChangedFiles.paths
.split(inputs.separator)
@@ -267,7 +257,7 @@ export const setChangedFilesOutput = async ({
ChangeTypeEnum.Deleted
]
})
core.debug(`All modified files: ${allModifiedFiles}`)
core.debug(`All modified files: ${JSON.stringify(allModifiedFiles)}`)
await setOutput({
key: getOutputKey('all_modified_files', outputPrefix),
value: allModifiedFiles.paths,
@@ -333,7 +323,7 @@ export const setChangedFilesOutput = async ({
changedFiles: allFilteredDiffFiles,
changeTypes: [ChangeTypeEnum.Deleted]
})
core.debug(`Deleted files: ${deletedFiles}`)
core.debug(`Deleted files: ${JSON.stringify(deletedFiles)}`)
await setOutput({
key: getOutputKey('deleted_files', outputPrefix),
value: deletedFiles.paths,

View File

@@ -1,4 +1,5 @@
import * as core from '@actions/core'
import * as github from '@actions/github'
import {Env} from './env'
import {Inputs} from './inputs'
@@ -15,11 +16,9 @@ import {
} from './utils'
const getCurrentSHA = async ({
env,
inputs,
workingDirectory
}: {
env: Env
inputs: Inputs
workingDirectory: string
}): Promise<string> => {
@@ -50,14 +49,14 @@ const getCurrentSHA = async ({
} else {
if (!currentSha) {
if (
env.GITHUB_EVENT_PULL_REQUEST_HEAD_SHA &&
github.context.payload.pull_request?.head?.sha &&
(await verifyCommitSha({
sha: env.GITHUB_EVENT_PULL_REQUEST_HEAD_SHA,
sha: github.context.payload.pull_request?.head?.sha,
cwd: workingDirectory,
showAsErrorMessage: false
})) === 0
) {
currentSha = env.GITHUB_EVENT_PULL_REQUEST_HEAD_SHA
currentSha = github.context.payload.pull_request?.head?.sha
} else {
currentSha = await getHeadSha({cwd: workingDirectory})
}
@@ -92,13 +91,13 @@ export const getSHAForPushEvent = async (
const currentBranch = targetBranch
let initialCommit = false
if (isShallow) {
if (isShallow && !inputs.skipInitialFetch) {
core.info('Repository is shallow, fetching more history...')
if (isTag) {
const sourceBranch =
env.GITHUB_EVENT_BASE_REF.replace('refs/heads/', '') ||
env.GITHUB_EVENT_RELEASE_TARGET_COMMITISH
github.context.payload.base_ref.replace('refs/heads/', '') ||
github.context.payload.release?.target_commitish
await gitFetch({
cwd: workingDirectory,
args: [
@@ -137,7 +136,7 @@ export const getSHAForPushEvent = async (
}
}
const currentSha = await getCurrentSHA({env, inputs, workingDirectory})
const currentSha = await getCurrentSHA({inputs, workingDirectory})
let previousSha = inputs.baseSha
const diff = '..'
@@ -191,8 +190,11 @@ export const getSHAForPushEvent = async (
targetBranch = tag
} else {
core.debug('Getting previous SHA for last remote commit...')
if (env.GITHUB_EVENT_FORCED === 'false' || !env.GITHUB_EVENT_FORCED) {
previousSha = env.GITHUB_EVENT_BEFORE
if (
github.context.payload.forced === 'false' ||
!github.context.payload.forced
) {
previousSha = github.context.payload.before
}
if (
@@ -265,13 +267,13 @@ export const getSHAForPullRequestEvent = async (
hasSubmodule: boolean,
gitFetchExtraArgs: string[]
): Promise<DiffResult> => {
let targetBranch = env.GITHUB_EVENT_PULL_REQUEST_BASE_REF
const currentBranch = env.GITHUB_EVENT_PULL_REQUEST_HEAD_REF
let targetBranch = github.context.payload.pull_request?.base?.ref
const currentBranch = github.context.payload.pull_request?.head?.ref
if (inputs.sinceLastRemoteCommit) {
targetBranch = currentBranch
}
if (isShallow) {
if (isShallow && !inputs.skipInitialFetch) {
core.info('Repository is shallow, fetching more history...')
let prFetchExitCode = await gitFetch({
@@ -281,7 +283,7 @@ export const getSHAForPullRequestEvent = async (
'-u',
'--progress',
'origin',
`pull/${env.GITHUB_EVENT_PULL_REQUEST_NUMBER}/head:${currentBranch}`
`pull/${github.context.payload.pull_request?.number}/head:${currentBranch}`
]
})
@@ -334,7 +336,7 @@ export const getSHAForPullRequestEvent = async (
core.info('Completed fetching more history.')
}
const currentSha = await getCurrentSHA({env, inputs, workingDirectory})
const currentSha = await getCurrentSHA({inputs, workingDirectory})
let previousSha = inputs.baseSha
let diff = '...'
@@ -362,15 +364,15 @@ export const getSHAForPullRequestEvent = async (
}
if (
!env.GITHUB_EVENT_PULL_REQUEST_BASE_REF ||
env.GITHUB_EVENT_HEAD_REPO_FORK === 'true'
!github.context.payload.pull_request?.base?.ref ||
github.context.payload.head?.repo?.fork === 'true'
) {
diff = '..'
}
if (!previousSha) {
if (inputs.sinceLastRemoteCommit) {
previousSha = env.GITHUB_EVENT_BEFORE
previousSha = github.context.payload.before
if (
!previousSha ||
@@ -389,7 +391,7 @@ export const getSHAForPullRequestEvent = async (
core.warning(
'Unable to locate the previous commit in the local history. Falling back to the pull request base sha.'
)
previousSha = env.GITHUB_EVENT_PULL_REQUEST_BASE_SHA
previousSha = github.context.payload.pull_request?.base?.sha
}
}
} else {
@@ -399,7 +401,7 @@ export const getSHAForPullRequestEvent = async (
})
if (!previousSha) {
previousSha = env.GITHUB_EVENT_PULL_REQUEST_BASE_SHA
previousSha = github.context.payload.pull_request?.base?.sha
}
if (isShallow) {
@@ -411,7 +413,7 @@ export const getSHAForPullRequestEvent = async (
diff
}))
) {
core.debug(
core.info(
'Merge base is not in the local history, fetching remote target branch...'
)
@@ -439,17 +441,17 @@ export const getSHAForPullRequestEvent = async (
break
}
core.debug(
core.info(
'Merge base is not in the local history, fetching remote target branch again...'
)
core.debug(`Attempt ${i}/10`)
core.info(`Attempt ${i}/10`)
}
}
}
}
if (!previousSha || previousSha === currentSha) {
previousSha = env.GITHUB_EVENT_PULL_REQUEST_BASE_SHA
previousSha = github.context.payload.pull_request?.base?.sha
}
}
@@ -494,7 +496,7 @@ export const getSHAForPullRequestEvent = async (
// uses: actions/checkout@v3
// with:
// repository: ${{ github.event.pull_request.head.repo.full_name }}
if (env.GITHUB_EVENT_NAME === 'pull_request_target') {
if (github.context.eventName === 'pull_request_target') {
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.'
)

View File

@@ -1,80 +1,16 @@
import {promises as fs} from 'fs'
import * as core from '@actions/core'
export type Env = {
GITHUB_REF_NAME: string
GITHUB_REF: string
GITHUB_WORKSPACE: string
GITHUB_EVENT_ACTION: string
GITHUB_EVENT_NAME: string
GITHUB_EVENT_FORCED: string
GITHUB_EVENT_BEFORE: string
GITHUB_EVENT_BASE_REF: string
GITHUB_EVENT_RELEASE_TARGET_COMMITISH: string
GITHUB_EVENT_HEAD_REPO_FORK: string
GITHUB_EVENT_PULL_REQUEST_NUMBER: string
GITHUB_EVENT_PULL_REQUEST_BASE_SHA: string
GITHUB_EVENT_PULL_REQUEST_HEAD_SHA: string
GITHUB_EVENT_PULL_REQUEST_HEAD_REF: string
GITHUB_EVENT_PULL_REQUEST_BASE_REF: string
GITHUB_REPOSITORY_OWNER: string
GITHUB_REPOSITORY: string
}
type GithubEvent = {
action?: string
forced?: string
pull_request?: {
head: {
ref: string
sha: string
}
base: {
ref: string
sha: string
}
number: string
}
release?: {
target_commitish: string
}
before?: string
base_ref?: string
head?: {
repo?: {
fork: string
}
}
}
export const getEnv = async (): Promise<Env> => {
const eventPath = process.env.GITHUB_EVENT_PATH
let eventJson: GithubEvent = {}
if (eventPath) {
eventJson = JSON.parse(await fs.readFile(eventPath, {encoding: 'utf8'}))
}
core.debug(`Env: ${JSON.stringify(process.env, null, 2)}`)
core.debug(`Event: ${JSON.stringify(eventJson, null, 2)}`)
core.debug(`Process Env: ${JSON.stringify(process.env, null, 2)}`)
return {
GITHUB_EVENT_PULL_REQUEST_HEAD_REF: eventJson.pull_request?.head?.ref || '',
GITHUB_EVENT_PULL_REQUEST_BASE_REF: eventJson.pull_request?.base?.ref || '',
GITHUB_EVENT_BEFORE: eventJson.before || '',
GITHUB_EVENT_BASE_REF: eventJson.base_ref || '',
GITHUB_EVENT_RELEASE_TARGET_COMMITISH:
eventJson.release?.target_commitish || '',
GITHUB_EVENT_HEAD_REPO_FORK: eventJson.head?.repo?.fork || '',
GITHUB_EVENT_PULL_REQUEST_NUMBER: eventJson.pull_request?.number || '',
GITHUB_EVENT_PULL_REQUEST_BASE_SHA: eventJson.pull_request?.base?.sha || '',
GITHUB_EVENT_PULL_REQUEST_HEAD_SHA: eventJson.pull_request?.head?.sha || '',
GITHUB_EVENT_FORCED: eventJson.forced || '',
GITHUB_EVENT_ACTION: eventJson.action || '',
GITHUB_REF_NAME: process.env.GITHUB_REF_NAME || '',
GITHUB_REF: process.env.GITHUB_REF || '',
GITHUB_WORKSPACE: process.env.GITHUB_WORKSPACE || '',
GITHUB_EVENT_NAME: process.env.GITHUB_EVENT_NAME || '',
GITHUB_REPOSITORY_OWNER: process.env.GITHUB_REPOSITORY_OWNER || '',
GITHUB_REPOSITORY: process.env.GITHUB_REPOSITORY || ''
GITHUB_WORKSPACE: process.env.GITHUB_WORKSPACE || ''
}
}

View File

@@ -38,8 +38,13 @@ export type Inputs = {
outputRenamedFilesAsDeletedAndAdded: boolean
recoverDeletedFiles: boolean
recoverDeletedFilesToDestination: string
recoverFiles: string
recoverFilesSeparator: string
recoverFilesIgnore: string
recoverFilesIgnoreSeparator: string
token: string
apiUrl: string
skipInitialFetch: boolean
}
export const getInputs = (): Inputs => {
@@ -152,8 +157,26 @@ export const getInputs = (): Inputs => {
'recover_deleted_files_to_destination',
{required: false}
)
const recoverFiles = core.getInput('recover_files', {required: false})
const recoverFilesSeparator = core.getInput('recover_files_separator', {
required: false,
trimWhitespace: false
})
const recoverFilesIgnore = core.getInput('recover_files_ignore', {
required: false
})
const recoverFilesIgnoreSeparator = core.getInput(
'recover_files_ignore_separator',
{
required: false,
trimWhitespace: false
}
)
const token = core.getInput('token', {required: false})
const apiUrl = core.getInput('api_url', {required: false})
const skipInitialFetch = core.getBooleanInput('skip_initial_fetch', {
required: false
})
const inputs: Inputs = {
files,
@@ -182,6 +205,10 @@ export const getInputs = (): Inputs => {
sinceLastRemoteCommit,
recoverDeletedFiles,
recoverDeletedFilesToDestination,
recoverFiles,
recoverFilesSeparator,
recoverFilesIgnore,
recoverFilesIgnoreSeparator,
includeAllOldNewRenamedFiles,
oldNewSeparator,
oldNewFilesSeparator,
@@ -194,7 +221,8 @@ export const getInputs = (): Inputs => {
outputDir,
outputRenamedFilesAsDeletedAndAdded,
token,
apiUrl
apiUrl,
skipInitialFetch
}
if (fetchDepth) {

View File

@@ -1,6 +1,9 @@
import * as core from '@actions/core'
import * as github from '@actions/github'
import path from 'path'
import {
ChangedFiles,
ChangeTypeEnum,
getAllDiffFiles,
getChangedFilesFromGithubAPI,
getRenamedFiles
@@ -15,24 +18,77 @@ import {Env, getEnv} from './env'
import {getInputs, Inputs} from './inputs'
import {
getFilePatterns,
getRecoverFilePatterns,
getSubmodulePath,
getYamlFilePatterns,
hasLocalGitDirectory,
isRepoShallow,
recoverDeletedFiles,
setOutput,
submoduleExists,
updateGitGlobalConfig,
verifyMinimumGitVersion
} from './utils'
const changedFilesOutput = async ({
filePatterns,
allDiffFiles,
inputs,
yamlFilePatterns
}: {
filePatterns: string[]
allDiffFiles: ChangedFiles
inputs: Inputs
yamlFilePatterns: Record<string, string[]>
}): Promise<void> => {
if (filePatterns.length > 0) {
core.startGroup('changed-files-patterns')
await setChangedFilesOutput({
allDiffFiles,
filePatterns,
inputs
})
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}`)
await setChangedFilesOutput({
allDiffFiles,
filePatterns: yamlFilePatterns[key],
outputPrefix: key,
inputs
})
core.info('All Done!')
core.endGroup()
}
}
if (filePatterns.length === 0 && Object.keys(yamlFilePatterns).length === 0) {
core.startGroup('changed-files-all')
await setChangedFilesOutput({
allDiffFiles,
inputs
})
core.info('All Done!')
core.endGroup()
}
}
const getChangedFilesFromLocalGit = async ({
inputs,
env,
workingDirectory
workingDirectory,
filePatterns,
yamlFilePatterns
}: {
inputs: Inputs
env: Env
workingDirectory: string
filePatterns: string[]
yamlFilePatterns: Record<string, string[]>
}): Promise<void> => {
await verifyMinimumGitVersion()
@@ -72,8 +128,8 @@ const getChangedFilesFromLocalGit = async ({
let diffResult: DiffResult
if (!env.GITHUB_EVENT_PULL_REQUEST_BASE_REF) {
core.info(`Running on a ${env.GITHUB_EVENT_NAME || 'push'} event...`)
if (!github.context.payload.pull_request?.base?.ref) {
core.info(`Running on a ${github.context.eventName || 'push'} event...`)
diffResult = await getSHAForPushEvent(
inputs,
env,
@@ -85,8 +141,8 @@ const getChangedFilesFromLocalGit = async ({
)
} else {
core.info(
`Running on a ${env.GITHUB_EVENT_NAME || 'pull_request'} (${
env.GITHUB_EVENT_ACTION
`Running on a ${github.context.eventName || 'pull_request'} (${
github.context.payload.action
}) event...`
)
diffResult = await getSHAForPullRequestEvent(
@@ -120,59 +176,30 @@ const getChangedFilesFromLocalGit = async ({
core.info('All Done!')
core.endGroup()
const filePatterns = await getFilePatterns({
inputs,
workingDirectory
})
core.debug(`File patterns: ${filePatterns}`)
if (inputs.recoverDeletedFiles) {
let recoverPatterns = getRecoverFilePatterns({inputs})
if (filePatterns.length > 0) {
core.startGroup('changed-files-patterns')
await setChangedFilesOutput({
allDiffFiles,
filePatterns,
inputs,
workingDirectory,
diffResult
})
core.info('All Done!')
core.endGroup()
}
const yamlFilePatterns = await getYamlFilePatterns({
inputs,
workingDirectory
})
core.debug(`Yaml file patterns: ${JSON.stringify(yamlFilePatterns)}`)
if (Object.keys(yamlFilePatterns).length > 0) {
for (const key of Object.keys(yamlFilePatterns)) {
core.startGroup(`changed-files-yaml-${key}`)
await setChangedFilesOutput({
allDiffFiles,
filePatterns: yamlFilePatterns[key],
outputPrefix: key,
inputs,
workingDirectory,
diffResult
})
core.info('All Done!')
core.endGroup()
if (recoverPatterns.length > 0 && filePatterns.length > 0) {
core.info('No recover patterns found; defaulting to file patterns')
recoverPatterns = filePatterns
}
}
if (filePatterns.length === 0 && Object.keys(yamlFilePatterns).length === 0) {
core.startGroup('changed-files-all')
await setChangedFilesOutput({
allDiffFiles,
await recoverDeletedFiles({
inputs,
workingDirectory,
diffResult
deletedFiles: allDiffFiles[ChangeTypeEnum.Deleted],
recoverPatterns,
sha: diffResult.previousSha
})
core.info('All Done!')
core.endGroup()
}
await changedFilesOutput({
filePatterns,
allDiffFiles,
inputs,
yamlFilePatterns
})
if (inputs.includeAllOldNewRenamedFiles) {
core.startGroup('changed-files-all-old-new-renamed-files')
const allOldNewRenamedFiles = await getRenamedFiles({
@@ -200,69 +227,25 @@ const getChangedFilesFromLocalGit = async ({
const getChangedFilesFromRESTAPI = async ({
inputs,
env,
workingDirectory
filePatterns,
yamlFilePatterns
}: {
inputs: Inputs
env: Env
workingDirectory: string
filePatterns: string[]
yamlFilePatterns: Record<string, string[]>
}): Promise<void> => {
const allDiffFiles = await getChangedFilesFromGithubAPI({
inputs,
env
inputs
})
core.debug(`All diff files: ${JSON.stringify(allDiffFiles)}`)
core.info('All Done!')
const filePatterns = await getFilePatterns({
await changedFilesOutput({
filePatterns,
allDiffFiles,
inputs,
workingDirectory
yamlFilePatterns
})
core.debug(`File patterns: ${filePatterns}`)
if (filePatterns.length > 0) {
core.startGroup('changed-files-patterns')
await setChangedFilesOutput({
allDiffFiles,
filePatterns,
inputs,
workingDirectory
})
core.info('All Done!')
core.endGroup()
}
const yamlFilePatterns = await getYamlFilePatterns({
inputs,
workingDirectory
})
core.debug(`Yaml file patterns: ${JSON.stringify(yamlFilePatterns)}`)
if (Object.keys(yamlFilePatterns).length > 0) {
for (const key of Object.keys(yamlFilePatterns)) {
core.startGroup(`changed-files-yaml-${key}`)
await setChangedFilesOutput({
allDiffFiles,
filePatterns: yamlFilePatterns[key],
outputPrefix: key,
inputs,
workingDirectory
})
core.info('All Done!')
core.endGroup()
}
}
if (filePatterns.length === 0 && Object.keys(yamlFilePatterns).length === 0) {
core.startGroup('changed-files-all')
await setChangedFilesOutput({
allDiffFiles,
inputs,
workingDirectory
})
core.info('All Done!')
core.endGroup()
}
}
export async function run(): Promise<void> {
@@ -270,17 +253,36 @@ export async function run(): Promise<void> {
const env = await getEnv()
core.debug(`Env: ${JSON.stringify(env, null, 2)}`)
const inputs = getInputs()
core.debug(`Inputs: ${JSON.stringify(inputs, null, 2)}`)
core.debug(`Github Context: ${JSON.stringify(github.context, null, 2)}`)
const workingDirectory = path.resolve(
env.GITHUB_WORKSPACE || process.cwd(),
inputs.path
)
core.debug(`Working directory: ${workingDirectory}`)
const hasGitDirectory = await hasLocalGitDirectory({workingDirectory})
core.debug(`Has git directory: ${hasGitDirectory}`)
const filePatterns = await getFilePatterns({
inputs,
workingDirectory
})
core.debug(`File patterns: ${filePatterns}`)
const yamlFilePatterns = await getYamlFilePatterns({
inputs,
workingDirectory
})
core.debug(`Yaml file patterns: ${JSON.stringify(yamlFilePatterns)}`)
if (
inputs.token &&
env.GITHUB_EVENT_PULL_REQUEST_NUMBER &&
github.context.payload.pull_request?.number &&
!hasGitDirectory
) {
core.info("Using GitHub's REST API to get changed files")
@@ -302,7 +304,11 @@ export async function run(): Promise<void> {
)
}
}
await getChangedFilesFromRESTAPI({inputs, env, workingDirectory})
await getChangedFilesFromRESTAPI({
inputs,
filePatterns,
yamlFilePatterns
})
} else {
if (!hasGitDirectory) {
core.setFailed(
@@ -312,7 +318,13 @@ export async function run(): Promise<void> {
}
core.info('Using local .git directory')
await getChangedFilesFromLocalGit({inputs, env, workingDirectory})
await getChangedFilesFromLocalGit({
inputs,
env,
workingDirectory,
filePatterns,
yamlFilePatterns
})
}
}

View File

@@ -293,7 +293,7 @@ export const getSubmodulePath = async ({
return stdout
.trim()
.split('\n')
.map((line: string) => normalizePath(line.split(' ')[1]))
.map((line: string) => normalizePath(line.trim().split(' ')[1]))
}
export const gitSubmoduleDiffSHA = async ({
@@ -1028,6 +1028,36 @@ export const getYamlFilePatterns = async ({
return filePatterns
}
export const getRecoverFilePatterns = ({
inputs
}: {
inputs: Inputs
}): string[] => {
let filePatterns: string[] = inputs.recoverFiles.split(
inputs.recoverFilesSeparator
)
if (inputs.recoverFilesIgnore) {
const ignoreFilePatterns = inputs.recoverFilesIgnore.split(
inputs.recoverFilesSeparator
)
filePatterns = filePatterns.concat(
ignoreFilePatterns.map(p => {
if (p.startsWith('!')) {
return p
} else {
return `!${p}`
}
})
)
}
core.debug(`recover file patterns: ${filePatterns}`)
return filePatterns.filter(Boolean)
}
export const setOutput = async ({
key,
value,
@@ -1084,36 +1114,48 @@ export const recoverDeletedFiles = async ({
inputs,
workingDirectory,
deletedFiles,
recoverPatterns,
sha
}: {
inputs: Inputs
workingDirectory: string
deletedFiles: string[]
recoverPatterns: string[]
sha: string
}): Promise<void> => {
if (inputs.recoverDeletedFiles) {
for (const deletedFile of deletedFiles) {
let target = path.join(workingDirectory, deletedFile)
let recoverableDeletedFiles = deletedFiles
core.debug(`recoverable deleted files: ${recoverableDeletedFiles}`)
if (inputs.recoverDeletedFilesToDestination) {
target = path.join(
workingDirectory,
inputs.recoverDeletedFilesToDestination,
deletedFile
)
}
if (recoverPatterns.length > 0) {
recoverableDeletedFiles = mm(deletedFiles, recoverPatterns, {
dot: true,
windows: IS_WINDOWS,
noext: true
})
core.debug(`filtered recoverable deleted files: ${recoverableDeletedFiles}`)
}
const deletedFileContents = await getDeletedFileContents({
cwd: workingDirectory,
filePath: deletedFile,
sha
})
for (const deletedFile of recoverableDeletedFiles) {
let target = path.join(workingDirectory, deletedFile)
if (!(await exists(path.dirname(target)))) {
await fs.mkdir(path.dirname(target), {recursive: true})
}
await fs.writeFile(target, deletedFileContents)
if (inputs.recoverDeletedFilesToDestination) {
target = path.join(
workingDirectory,
inputs.recoverDeletedFilesToDestination,
deletedFile
)
}
const deletedFileContents = await getDeletedFileContents({
cwd: workingDirectory,
filePath: deletedFile,
sha
})
if (!(await exists(path.dirname(target)))) {
await fs.mkdir(path.dirname(target), {recursive: true})
}
await fs.writeFile(target, deletedFileContents)
}
}

1450
yarn.lock

File diff suppressed because it is too large Load Diff