Compare commits

...

74 Commits

Author SHA1 Message Date
Tonye Jack
174a2a6360 feat: switch to use name status (#1230)
Co-authored-by: tj-actions[bot] <109116665+tj-actions-bot@users.noreply.github.com>
Co-authored-by: GitHub Action <action@github.com>
2023-06-14 12:45:32 -06:00
renovate[bot]
2d0b52f440 chore(deps): update peter-evans/create-pull-request action to v5.0.2 (#1256)
Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>
2023-06-14 02:19:30 +00:00
renovate[bot]
d0e3a7c3aa chore(deps): update typescript-eslint monorepo to v5.59.11 (#1253)
Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>
2023-06-13 00:45:47 +00:00
tj-actions[bot]
2c6893c21a Updated README.md (#1255)
Co-authored-by: jackton1 <jackton1@users.noreply.github.com>
2023-06-12 18:13:36 -06:00
Tonye Jack
17ca5bb3e5 Update action.yml 2023-06-12 18:07:35 -06:00
renovate[bot]
61845c2b19 chore(deps): lock file maintenance (#1252)
Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>
2023-06-12 01:50:52 +00:00
renovate[bot]
417f924dea chore(deps): update tj-actions/verify-changed-files action to v15 (#1251)
Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>
2023-06-11 06:22:47 +00:00
renovate[bot]
c51a48d4f6 chore(deps): lock file maintenance (#1250)
Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>
2023-06-11 02:36:09 +00:00
tj-actions[bot]
a625ca325f Updated README.md (#1249)
Co-authored-by: jackton1 <jackton1@users.noreply.github.com>
2023-06-10 17:31:27 +00:00
tj-actions[bot]
752970edd0 Updated README.md (#1248)
Co-authored-by: jackton1 <jackton1@users.noreply.github.com>
Co-authored-by: Tonye Jack <jtonye@ymail.com>
2023-06-10 11:02:12 -06:00
Tonye Jack
7b64c76932 Update action.yml 2023-06-10 10:57:00 -06:00
Tonye Jack
6d9ee62035 chore: Update README.md 2023-06-09 12:17:49 -06:00
Tonye Jack
b27dcc252a chore: Update README.md 2023-06-09 12:16:46 -06:00
renovate[bot]
b60e479cea chore(deps): update dependency @types/uuid to v9.0.2 (#1247)
Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>
2023-06-09 00:14:45 +00:00
tj-actions[bot]
ab8493166b Upgraded to v36.1.0 (#1245)
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-08 14:45:51 +00:00
tj-actions[bot]
9333a5cf0c Updated README.md (#1246)
Co-authored-by: repo-ranger[bot] <repo-ranger[bot]@users.noreply.github.com>
2023-06-08 14:26:50 +00:00
tj-actions[bot]
8ec721eb3b chore: Update README.md (#1237)
Co-authored-by: repo-ranger[bot] <39074581+repo-ranger[bot]@users.noreply.github.com>
2023-06-08 13:31:33 +00:00
tj-actions[bot]
7d1d4d2cce chore: Update README.md (#1240) 2023-06-08 13:30:09 +00:00
Tonye Jack
fb20f4d248 chore: fix bug with nx set shas (#1244) 2023-06-08 06:56:26 -06:00
Tonye Jack
b2a0ba40a4 chore: update test (#1243) 2023-06-08 06:25:07 -06:00
Tonye Jack
c467712045 chore: update event name (#1242)
Co-authored-by: GitHub Action <action@github.com>
2023-06-08 06:12:03 -06:00
Tonye Jack
f41e41fa3f feat: improve warning message (#1241)
Co-authored-by: GitHub Action <action@github.com>
Co-authored-by: repo-ranger[bot] <39074581+repo-ranger[bot]@users.noreply.github.com>
2023-06-08 05:20:11 -06:00
tj-actions[bot]
f490eeaa59 chore: update test.yml 2023-06-08 05:11:10 -06:00
Tonye Jack
37e5be95e2 Update test.yml 2023-06-07 19:05:54 -06:00
Tonye Jack
e208eb429a fix: bug with errors from fork prs (#1239)
Co-authored-by: repo-ranger[bot] <39074581+repo-ranger[bot]@users.noreply.github.com>
Co-authored-by: GitHub Action <action@github.com>
2023-06-08 00:29:48 +00:00
Tonye Jack
c784b6f1c4 chore: improve test coverage (#1235)
Co-authored-by: repo-ranger[bot] <39074581+repo-ranger[bot]@users.noreply.github.com>
2023-06-07 23:13:00 +00:00
Tonye Jack
6dc4095801 fix: bug with only_(changed|modified|deleted) outputs (#1238)
Co-authored-by: GitHub Action <action@github.com>
2023-06-07 22:56:42 +00:00
tj-actions[bot]
a522bdb715 Upgraded to v36.0.18 (#1234)
Co-authored-by: jackton1 <jackton1@users.noreply.github.com>
2023-06-06 14:07:38 +00:00
tj-actions[bot]
07e0177b72 Updated README.md (#1233)
Co-authored-by: jackton1 <jackton1@users.noreply.github.com>
2023-06-06 07:45:21 -06:00
tj-actions[bot]
fee9327009 Updated README.md (#1232)
Co-authored-by: jackton1 <jackton1@users.noreply.github.com>
2023-06-06 07:24:46 -06:00
Tonye Jack
f991633730 Update action.yml 2023-06-06 06:48:25 -06:00
tj-actions[bot]
1fc4377f03 Updated README.md (#1231)
Co-authored-by: jackton1 <jackton1@users.noreply.github.com>
2023-06-06 12:19:39 +00:00
Tonye Jack
353ea22e6f feat: add dir_names_exclude_current_dir input and cleaned up logic to retrieve the current sha (#1229)
Co-authored-by: GitHub Action <action@github.com>
Co-authored-by: tj-actions[bot] <109116665+tj-actions-bot@users.noreply.github.com>
Co-authored-by: jackton1 <jackton1@users.noreply.github.com>
2023-06-06 06:00:56 -06:00
tj-actions[bot]
cdf9afcec8 Updated README.md (#1228)
Co-authored-by: jackton1 <jackton1@users.noreply.github.com>
2023-06-06 00:29:02 +00:00
Tonye Jack
f58fe58af9 Update README.md 2023-06-05 18:04:41 -06:00
Tonye Jack
9ab423063b Update action.yml 2023-06-05 18:01:34 -06:00
renovate[bot]
b8dd3a1a06 chore(deps): update typescript-eslint monorepo to v5.59.9 (#1227)
Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>
2023-06-05 21:24:08 +00:00
tj-actions[bot]
6e4b6b77a3 Upgraded to v36.0.17 (#1226)
Co-authored-by: jackton1 <jackton1@users.noreply.github.com>
2023-06-05 04:13:36 +00:00
Tonye Jack
b13786805a chore: update README.md (#1225)
Co-authored-by: GitHub Action <action@github.com>
2023-06-04 21:51:28 -06:00
renovate[bot]
7c72320404 chore(deps): lock file maintenance (#1224)
Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>
Co-authored-by: Tonye Jack <jtonye@ymail.com>
Co-authored-by: GitHub Action <action@github.com>
2023-06-04 21:46:30 -06:00
Tonye Jack
763a7bfbb5 chore: Update test.yml (#1223)
Co-authored-by: tj-actions[bot] <109116665+tj-actions-bot@users.noreply.github.com>
2023-06-04 20:09:02 -06:00
tj-actions[bot]
c789aecfa6 Upgraded to v36.0.16 (#1222)
Co-authored-by: jackton1 <jackton1@users.noreply.github.com>
2023-06-04 16:48:50 +00:00
renovate[bot]
1aae16084a chore(deps): lock file maintenance (#1221)
Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>
2023-06-03 01:21:45 +00:00
renovate[bot]
a593948c90 chore(deps): update dependency eslint to v8.42.0 (#1220)
Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>
2023-06-03 01:07:36 +00:00
tj-actions[bot]
96134b7430 Upgraded to v36.0.15 (#1219)
Co-authored-by: jackton1 <jackton1@users.noreply.github.com>
2023-06-02 13:53:01 +00:00
renovate[bot]
5d2fcdb4cb chore(deps): update dependency typescript to v5.1.3 (#1215)
Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>
Co-authored-by: GitHub Action <action@github.com>
Co-authored-by: repo-ranger[bot] <39074581+repo-ranger[bot]@users.noreply.github.com>
2023-06-02 04:39:26 +00:00
renovate[bot]
c0a8bcfa6a chore(deps): update dependency eslint-plugin-github to v4.8.0 (#1218)
Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>
2023-06-02 04:19:39 +00:00
renovate[bot]
4bc117de0c chore(deps): lock file maintenance (#1217)
Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>
2023-06-02 03:47:13 +00:00
Tonye Jack
47db5bd435 fix: bug retrieving base sha for force push (#1216) 2023-06-01 21:16:31 -06:00
tj-actions[bot]
eeb5a258f5 Upgraded to v36.0.14 (#1214)
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-01 17:57:50 +00:00
Tonye Jack
5436326dcf Update README.md 2023-06-01 11:29:04 -06:00
Tonye Jack
9ecc6e7fe2 fix: bug with retrieving the base sha when since last commit is enabled (#1213)
Co-authored-by: GitHub Action <action@github.com>
2023-06-01 11:18:54 -06:00
tj-actions[bot]
72cf8893fc Upgraded to v36.0.13 (#1212)
Co-authored-by: jackton1 <jackton1@users.noreply.github.com>
Co-authored-by: Tonye Jack <jtonye@ymail.com>
2023-06-01 11:02:57 -06:00
tj-actions[bot]
28d6f2964c Upgraded to v36.0.12 (#1210)
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-01 16:53:31 +00:00
Tonye Jack
8c9ee56d01 fix: error fetching history (#1211)
Co-authored-by: GitHub Action <action@github.com>
2023-06-01 10:34:16 -06:00
Tonye Jack
5978e5a2df fix: bug retrieving diff when persist credentials is false (#1209)
Co-authored-by: GitHub Action <action@github.com>
2023-06-01 10:03:09 -06:00
tj-actions[bot]
ab45871481 Upgraded to v36.0.11 (#1208)
Co-authored-by: jackton1 <jackton1@users.noreply.github.com>
2023-05-31 21:44:30 +00:00
Tonye Jack
17c3e9e98f chore: update test to include pull request head sha checkout (#1205) 2023-05-31 21:26:08 +00:00
renovate[bot]
c9dcbc3147 chore(deps): update dependency @types/jest to v29.5.2 (#1207)
Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>
2023-05-31 17:13:16 +00:00
tj-actions[bot]
aa54931d1d Upgraded to v36.0.10 (#1202)
Co-authored-by: jackton1 <jackton1@users.noreply.github.com>
2023-05-30 21:50:01 +00:00
Tonye Jack
3f7b5c900b fix: bug with diff output (#1201)
Co-authored-by: GitHub Action <action@github.com>
2023-05-30 15:27:56 -06:00
Tonye Jack
161a189eb5 Update README.md 2023-05-30 15:22:07 -06:00
renovate[bot]
a48618a94b chore(deps): update typescript-eslint monorepo to v5.59.8 (#1199)
Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>
2023-05-29 19:13:02 +00:00
tj-actions[bot]
2bdfc0c60d Upgraded to v36.0.9 (#1198)
Co-authored-by: jackton1 <jackton1@users.noreply.github.com>
2023-05-29 16:27:49 +00:00
Tonye Jack
cf4fe8759a fix: matching all nested files with a directory name (#1197)
Co-authored-by: GitHub Action <action@github.com>
2023-05-29 16:12:36 +00:00
tj-actions[bot]
58c7ce2add Updated README.md (#1196)
Co-authored-by: jackton1 <jackton1@users.noreply.github.com>
2023-05-29 09:41:26 -06:00
Tonye Jack
61316fda76 Update README.md 2023-05-29 09:21:30 -06:00
Tonye Jack
5d38ef5289 Update README.md (#1195) 2023-05-29 09:20:14 -06:00
Tonye Jack
51330c5719 Update README.md 2023-05-29 09:19:05 -06:00
Tonye Jack
7b92155d7a Update README.md 2023-05-29 09:15:00 -06:00
Tonye Jack
3127174fab Update README.md 2023-05-28 20:26:25 -06:00
tj-actions[bot]
cfdaf8f14e Upgraded to v36.0.8 (#1192)
Co-authored-by: jackton1 <jackton1@users.noreply.github.com>
2023-05-29 02:13:51 +00:00
Tonye Jack
043929ee8f feat: add support for running on release event (#1191)
Co-authored-by: GitHub Action <action@github.com>
2023-05-28 19:56:55 -06:00
tj-actions[bot]
96fd19710a Upgraded to v36.0.7 (#1190)
Co-authored-by: jackton1 <jackton1@users.noreply.github.com>
2023-05-29 01:42:54 +00:00
20 changed files with 2340 additions and 1190 deletions

View File

@@ -60,6 +60,8 @@
"@typescript-eslint/promise-function-async": "error",
"@typescript-eslint/require-array-sort-compare": "error",
"@typescript-eslint/restrict-plus-operands": "error",
"no-shadow": "off",
"@typescript-eslint/no-shadow": "error",
"semi": "off",
"filenames/match-regex": [
"error",

View File

@@ -19,7 +19,7 @@ jobs:
git submodule update --remote --recursive
- name: Create Pull Request
uses: peter-evans/create-pull-request@v5.0.1
uses: peter-evans/create-pull-request@v5.0.2
with:
title: "Updated submodule"
labels: "merge when passing"

View File

@@ -24,7 +24,7 @@ jobs:
- name: Run git-cliff
uses: tj-actions/git-cliff@v1
- name: Create Pull Request
uses: peter-evans/create-pull-request@v5.0.1
uses: peter-evans/create-pull-request@v5.0.2
with:
base: "main"
labels: "merge when passing"

View File

@@ -4,14 +4,31 @@ on:
push:
branches:
- "**"
pull_request:
branches:
- main
- sec
pull_request_review:
types: [edited, dismissed, submitted]
pull_request_target:
pull_request:
types:
- assigned
- unassigned
- labeled
- unlabeled
- opened
- edited
- closed
- reopened
- synchronize
- converted_to_draft
- ready_for_review
- locked
- unlocked
- review_requested
- review_request_removed
- auto_merge_enabled
- auto_merge_disabled
branches:
- main
- sec
jobs:
shellcheck:
@@ -31,6 +48,7 @@ jobs:
with:
persist-credentials: false
fetch-depth: 0
repository: ${{ github.event.pull_request.head.repo.full_name }}
- name: Use Node.js 16.x
uses: actions/setup-node@v3.6.0
@@ -60,7 +78,7 @@ jobs:
yarn all
- name: Verify Changed files
uses: tj-actions/verify-changed-files@v14
uses: tj-actions/verify-changed-files@v15
id: changed_files
if: github.event_name != 'push'
with:
@@ -78,6 +96,7 @@ jobs:
- name: Push changes
if: steps.changed_files.outputs.files_changed == 'true' && github.event_name == 'pull_request'
continue-on-error: true
uses: ad-m/github-push-action@master
with:
github_token: ${{ secrets.PAT_TOKEN }}
@@ -104,6 +123,7 @@ jobs:
- name: Checkout into dir1
uses: actions/checkout@v3
with:
repository: ${{ github.event.pull_request.head.repo.full_name }}
submodules: true
fetch-depth: 0
path: dir1
@@ -136,6 +156,7 @@ jobs:
- name: Checkout into dir2
uses: actions/checkout@v3
with:
repository: ${{ github.event.pull_request.head.repo.full_name }}
submodules: true
fetch-depth: 0
path: dir2
@@ -170,6 +191,7 @@ jobs:
- name: Checkout to branch
uses: actions/checkout@v3
with:
repository: ${{ github.event.pull_request.head.repo.full_name }}
fetch-depth: 0
- name: Download build assets
@@ -226,6 +248,7 @@ jobs:
- name: Checkout to branch
uses: actions/checkout@v3
with:
repository: ${{ github.event.pull_request.head.repo.full_name }}
fetch-depth: 0
- name: Download build assets
@@ -262,6 +285,7 @@ jobs:
- name: Checkout to branch
uses: actions/checkout@v3
with:
repository: ${{ github.event.pull_request.head.repo.full_name }}
fetch-depth: 0
- name: Download build assets
@@ -297,6 +321,7 @@ jobs:
- name: Checkout to branch
uses: actions/checkout@v3
with:
repository: ${{ github.event.pull_request.head.repo.full_name }}
fetch-depth: ${{ matrix.fetch-depth }}
- name: Download build assets
@@ -316,6 +341,67 @@ jobs:
shell:
bash
test-pull-request-head-ref:
name: Test changed-files with pull request head ref
runs-on: ubuntu-latest
needs: build
if: github.event_name != 'push'
steps:
- name: Checkout to branch
uses: actions/checkout@v3
with:
ref: ${{ github.event.pull_request.head.sha }}
- name: Download build assets
uses: actions/download-artifact@v3
with:
name: build-assets
- name: Run changed-files
id: changed-files
uses: ./
- name: Show output
run: |
echo '${{ toJSON(steps.changed-files.outputs) }}'
shell:
bash
test-pull-request-without-persist-credentials:
name: Test changed-files with pull request without persist credentials
runs-on: ubuntu-latest
needs: build
if: github.event_name != 'push'
strategy:
fail-fast: false
max-parallel: 4
matrix:
fetch-depth: [1, 2, 0]
steps:
- name: Checkout to branch
uses: actions/checkout@v3
with:
fetch-depth: ${{ matrix.fetch-depth }}
persist-credentials: false
repository: ${{ github.event.pull_request.head.repo.full_name }}
- name: Download build assets
uses: actions/download-artifact@v3
with:
name: build-assets
- name: Run changed-files
id: changed-files
uses: ./
- name: Show output
run: |
echo '${{ toJSON(steps.changed-files.outputs) }}'
shell:
bash
test-non-existent-base-sha:
name: Test changed-files non existent base sha
runs-on: ubuntu-latest
@@ -481,6 +567,7 @@ jobs:
uses: actions/checkout@v3
with:
submodules: true
repository: ${{ github.event.pull_request.head.repo.full_name }}
fetch-depth: ${{ matrix.fetch-depth }}
- name: Download build assets
uses: actions/download-artifact@v3
@@ -508,6 +595,16 @@ jobs:
echo '${{ toJSON(steps.changed-files-since-last-remote-commit.outputs) }}'
shell:
bash
- name: Run changed-files with dir name
id: changed-files-dir-name
uses: ./
with:
files: .github/workflows
- name: Show output
run: |
echo '${{ toJSON(steps.changed-files-dir-name.outputs) }}'
shell:
bash
- name: Run changed-files with write_output_files
id: changed-files-write-output-files
uses: ./
@@ -1161,7 +1258,7 @@ jobs:
main-branch-name: ${{ steps.branch-name.outputs.base_ref_branch }}
workflow-id: 'test.yml'
- name: Run changed-files with a custom base sha
if: github.event_name != 'push' && github.event.action != 'closed' && matrix.fetch-depth == 0
if: github.event_name != 'push' && github.event.action != 'closed' && matrix.fetch-depth == 0 && steps.last_successful_commit.outputs.base != steps.last_successful_commit.outputs.head
id: changed-files-custom-base-sha
uses: ./
with:

View File

@@ -20,7 +20,7 @@ jobs:
uses: tj-actions/remark@v3
- name: Verify Changed files
uses: tj-actions/verify-changed-files@v14
uses: tj-actions/verify-changed-files@v15
id: verify_changed_files
with:
files: |

View File

@@ -1,5 +1,245 @@
# Changelog
# [36.1.0](https://github.com/tj-actions/changed-files/compare/v36.0.18...v36.1.0) - (2023-06-08)
## <!-- 0 -->🚀 Features
- Improve warning message ([#1241](https://github.com/tj-actions/changed-files/issues/1241)) ([f41e41f](https://github.com/tj-actions/changed-files/commit/f41e41fa3fdcbdf47c5f73526be7d81e413f832e)) - (Tonye Jack)
## <!-- 1 -->🐛 Bug Fixes
- Bug with errors from fork prs ([#1239](https://github.com/tj-actions/changed-files/issues/1239)) ([e208eb4](https://github.com/tj-actions/changed-files/commit/e208eb429a6a5b3444af0a2099bdbbfcd705fae6)) - (Tonye Jack)
- Bug with only_(changed|modified|deleted) outputs ([#1238](https://github.com/tj-actions/changed-files/issues/1238)) ([6dc4095](https://github.com/tj-actions/changed-files/commit/6dc409580193a9e2e52aa4a647684c2ea5a99ddb)) - (Tonye Jack)
## <!-- 26 -->🔄 Update
- Update test.yml ([37e5be9](https://github.com/tj-actions/changed-files/commit/37e5be95e281cd60c1d89e92bb25242b37e9db3c)) - (Tonye Jack)
## <!-- 7 -->⚙️ Miscellaneous Tasks
- Fix bug with nx set shas ([#1244](https://github.com/tj-actions/changed-files/issues/1244)) ([fb20f4d](https://github.com/tj-actions/changed-files/commit/fb20f4d24890fadc539505b1746d260504b213d0)) - (Tonye Jack)
- Update test ([#1243](https://github.com/tj-actions/changed-files/issues/1243)) ([b2a0ba4](https://github.com/tj-actions/changed-files/commit/b2a0ba40a4106c5de8de8ac8b0732f404d084f00)) - (Tonye Jack)
- Update event name ([#1242](https://github.com/tj-actions/changed-files/issues/1242)) ([c467712](https://github.com/tj-actions/changed-files/commit/c467712045a1fb370c4f8a2ce40f93c718e7888e)) - (Tonye Jack)
- Update test.yml ([f490eea](https://github.com/tj-actions/changed-files/commit/f490eeaa59c0a3957b24214e86c462a2e9a6c7fa)) - (tj-actions[bot])
- Improve test coverage ([#1235](https://github.com/tj-actions/changed-files/issues/1235)) ([c784b6f](https://github.com/tj-actions/changed-files/commit/c784b6f1c4775e3db7ddc38d464ae017e41b1576)) - (Tonye Jack)
## <!-- 9 -->⬆️ Upgrades
- Upgraded to v36.0.18 ([#1234](https://github.com/tj-actions/changed-files/issues/1234))
Co-authored-by: jackton1 <jackton1@users.noreply.github.com> ([a522bdb](https://github.com/tj-actions/changed-files/commit/a522bdb715e8ee0e5814bc94f576ebc24cebbfd3)) - (tj-actions[bot])
# [36.0.18](https://github.com/tj-actions/changed-files/compare/v36.0.17...v36.0.18) - (2023-06-06)
## <!-- 0 -->🚀 Features
- Add dir_names_exclude_current_dir input and cleaned up logic to retrieve the current sha ([#1229](https://github.com/tj-actions/changed-files/issues/1229)) ([353ea22](https://github.com/tj-actions/changed-files/commit/353ea22e6fc7b15ce3a30064d8cd19eef2a86b71)) - (Tonye Jack)
## <!-- 26 -->🔄 Update
- Updated README.md ([#1233](https://github.com/tj-actions/changed-files/issues/1233))
Co-authored-by: jackton1 <jackton1@users.noreply.github.com> ([07e0177](https://github.com/tj-actions/changed-files/commit/07e0177b72d3640efced741cae32f9861eee1367)) - (tj-actions[bot])
- Updated README.md ([#1232](https://github.com/tj-actions/changed-files/issues/1232))
Co-authored-by: jackton1 <jackton1@users.noreply.github.com> ([fee9327](https://github.com/tj-actions/changed-files/commit/fee9327009ff80c0a0d442f2204944771f0552b1)) - (tj-actions[bot])
- Update action.yml ([f991633](https://github.com/tj-actions/changed-files/commit/f991633730ca94b13263b3db2bfe3bb4406050e8)) - (Tonye Jack)
- Updated README.md ([#1231](https://github.com/tj-actions/changed-files/issues/1231))
Co-authored-by: jackton1 <jackton1@users.noreply.github.com> ([1fc4377](https://github.com/tj-actions/changed-files/commit/1fc4377f0376e9e24eb836467b94dc0dbe92087a)) - (tj-actions[bot])
- Updated README.md ([#1228](https://github.com/tj-actions/changed-files/issues/1228))
Co-authored-by: jackton1 <jackton1@users.noreply.github.com> ([cdf9afc](https://github.com/tj-actions/changed-files/commit/cdf9afcec863cb917421feea4e2d3fef708b2449)) - (tj-actions[bot])
- Update README.md ([f58fe58](https://github.com/tj-actions/changed-files/commit/f58fe58af9008ac4c45e7caf949ff95791a9deef)) - (Tonye Jack)
- Update action.yml ([9ab4230](https://github.com/tj-actions/changed-files/commit/9ab423063bd7d1ee892ecd5a0ce25f81f604e4f4)) - (Tonye Jack)
## <!-- 7 -->⚙️ Miscellaneous Tasks
- **deps:** Update typescript-eslint monorepo to v5.59.9 ([#1227](https://github.com/tj-actions/changed-files/issues/1227)) ([b8dd3a1](https://github.com/tj-actions/changed-files/commit/b8dd3a1a069b5eb261603aa081023c3e9689d6a4)) - (renovate[bot])
## <!-- 9 -->⬆️ Upgrades
- Upgraded to v36.0.17 ([#1226](https://github.com/tj-actions/changed-files/issues/1226))
Co-authored-by: jackton1 <jackton1@users.noreply.github.com> ([6e4b6b7](https://github.com/tj-actions/changed-files/commit/6e4b6b77a3fd4d60bd02608dba69c7eae38a117f)) - (tj-actions[bot])
# [36.0.17](https://github.com/tj-actions/changed-files/compare/v36.0.16...v36.0.17) - (2023-06-05)
## <!-- 7 -->⚙️ Miscellaneous Tasks
- Update README.md ([#1225](https://github.com/tj-actions/changed-files/issues/1225)) ([b137868](https://github.com/tj-actions/changed-files/commit/b13786805affca18e536ed489687d3d8d1f05d21)) - (Tonye Jack)
- **deps:** Lock file maintenance ([#1224](https://github.com/tj-actions/changed-files/issues/1224)) ([7c72320](https://github.com/tj-actions/changed-files/commit/7c7232040403e5ad44fb31057f9b7efe9dd43ace)) - (renovate[bot])
- Update test.yml ([#1223](https://github.com/tj-actions/changed-files/issues/1223)) ([763a7bf](https://github.com/tj-actions/changed-files/commit/763a7bfbb5780f6798eb06361a5c91495c8b7488)) - (Tonye Jack)
## <!-- 9 -->⬆️ Upgrades
- Upgraded to v36.0.16 ([#1222](https://github.com/tj-actions/changed-files/issues/1222))
Co-authored-by: jackton1 <jackton1@users.noreply.github.com> ([c789aec](https://github.com/tj-actions/changed-files/commit/c789aecfa677158f0ac6a33a87e38a2b4f530aea)) - (tj-actions[bot])
# [36.0.16](https://github.com/tj-actions/changed-files/compare/v36.0.15...v36.0.16) - (2023-06-03)
## <!-- 7 -->⚙️ Miscellaneous Tasks
- **deps:** Lock file maintenance ([#1221](https://github.com/tj-actions/changed-files/issues/1221)) ([1aae160](https://github.com/tj-actions/changed-files/commit/1aae16084af435f73c8cdfd742473028810c5f20)) - (renovate[bot])
- **deps:** Update dependency eslint to v8.42.0 ([#1220](https://github.com/tj-actions/changed-files/issues/1220)) ([a593948](https://github.com/tj-actions/changed-files/commit/a593948c900d7f83d14a30cb162657a8d9894b0e)) - (renovate[bot])
## <!-- 9 -->⬆️ Upgrades
- Upgraded to v36.0.15 ([#1219](https://github.com/tj-actions/changed-files/issues/1219))
Co-authored-by: jackton1 <jackton1@users.noreply.github.com> ([96134b7](https://github.com/tj-actions/changed-files/commit/96134b7430da6261abf9182b7f2df2ae06eee300)) - (tj-actions[bot])
# [36.0.15](https://github.com/tj-actions/changed-files/compare/v36.0.14...v36.0.15) - (2023-06-02)
## <!-- 1 -->🐛 Bug Fixes
- Bug retrieving base sha for force push ([#1216](https://github.com/tj-actions/changed-files/issues/1216)) ([47db5bd](https://github.com/tj-actions/changed-files/commit/47db5bd435ab26939338ff899af621be52f44da4)) - (Tonye Jack)
## <!-- 26 -->🔄 Update
- Update README.md ([5436326](https://github.com/tj-actions/changed-files/commit/5436326dcff90d144b503f5956174744e1e2f3dd)) - (Tonye Jack)
## <!-- 7 -->⚙️ Miscellaneous Tasks
- **deps:** Update dependency typescript to v5.1.3 ([#1215](https://github.com/tj-actions/changed-files/issues/1215)) ([5d2fcdb](https://github.com/tj-actions/changed-files/commit/5d2fcdb4cbef720a52f49fd05d8c7edd18a64758)) - (renovate[bot])
- **deps:** Update dependency eslint-plugin-github to v4.8.0 ([#1218](https://github.com/tj-actions/changed-files/issues/1218)) ([c0a8bcf](https://github.com/tj-actions/changed-files/commit/c0a8bcfa6aa8d8cb3617f30d7a97a9a94233f526)) - (renovate[bot])
- **deps:** Lock file maintenance ([#1217](https://github.com/tj-actions/changed-files/issues/1217)) ([4bc117d](https://github.com/tj-actions/changed-files/commit/4bc117de0ccad2c57bf65627d45b5a397ad7aeab)) - (renovate[bot])
## <!-- 9 -->⬆️ Upgrades
- Upgraded to v36.0.14 ([#1214](https://github.com/tj-actions/changed-files/issues/1214))
Co-authored-by: jackton1 <jackton1@users.noreply.github.com>
Co-authored-by: repo-ranger[bot] <39074581+repo-ranger[bot]@users.noreply.github.com> ([eeb5a25](https://github.com/tj-actions/changed-files/commit/eeb5a258f54ff87633389337e566ad43b7429c8d)) - (tj-actions[bot])
# [36.0.14](https://github.com/tj-actions/changed-files/compare/v36.0.13...v36.0.14) - (2023-06-01)
## <!-- 1 -->🐛 Bug Fixes
- Bug with retrieving the base sha when since last commit is enabled ([#1213](https://github.com/tj-actions/changed-files/issues/1213)) ([9ecc6e7](https://github.com/tj-actions/changed-files/commit/9ecc6e7fe2e26945b52485ccd9bc4b44000f5af1)) - (Tonye Jack)
## <!-- 9 -->⬆️ Upgrades
- Upgraded to v36.0.13 ([#1212](https://github.com/tj-actions/changed-files/issues/1212))
Co-authored-by: jackton1 <jackton1@users.noreply.github.com>
Co-authored-by: Tonye Jack <jtonye@ymail.com> ([72cf889](https://github.com/tj-actions/changed-files/commit/72cf8893fc62273c86d15f761e8693ee99067553)) - (tj-actions[bot])
- Upgraded to v36.0.12 ([#1210](https://github.com/tj-actions/changed-files/issues/1210))
Co-authored-by: jackton1 <jackton1@users.noreply.github.com>
Co-authored-by: repo-ranger[bot] <39074581+repo-ranger[bot]@users.noreply.github.com> ([28d6f29](https://github.com/tj-actions/changed-files/commit/28d6f2964c56cd2c00615dae99814ebcb3339c32)) - (tj-actions[bot])
# [36.0.13](https://github.com/tj-actions/changed-files/compare/v36.0.12...v36.0.13) - (2023-06-01)
## <!-- 1 -->🐛 Bug Fixes
- Error fetching history ([#1211](https://github.com/tj-actions/changed-files/issues/1211)) ([8c9ee56](https://github.com/tj-actions/changed-files/commit/8c9ee56d0180a538ad5b6b8a208e4db974bad9c0)) - (Tonye Jack)
# [36.0.12](https://github.com/tj-actions/changed-files/compare/v36.0.11...v36.0.12) - (2023-06-01)
## <!-- 1 -->🐛 Bug Fixes
- Bug retrieving diff when persist credentials is false ([#1209](https://github.com/tj-actions/changed-files/issues/1209)) ([5978e5a](https://github.com/tj-actions/changed-files/commit/5978e5a2df95ef20cde627d4acb5edd1f87ba46a)) - (Tonye Jack)
## <!-- 9 -->⬆️ Upgrades
- Upgraded to v36.0.11 ([#1208](https://github.com/tj-actions/changed-files/issues/1208))
Co-authored-by: jackton1 <jackton1@users.noreply.github.com> ([ab45871](https://github.com/tj-actions/changed-files/commit/ab45871481bbe65bf9de161fdb13c95410d9b930)) - (tj-actions[bot])
# [36.0.11](https://github.com/tj-actions/changed-files/compare/v36.0.10...v36.0.11) - (2023-05-31)
## <!-- 7 -->⚙️ Miscellaneous Tasks
- Update test to include pull request head sha checkout ([#1205](https://github.com/tj-actions/changed-files/issues/1205)) ([17c3e9e](https://github.com/tj-actions/changed-files/commit/17c3e9e98f47ef859502ba3e38be0b8a6a4bddd9)) - (Tonye Jack)
- **deps:** Update dependency @types/jest to v29.5.2 ([#1207](https://github.com/tj-actions/changed-files/issues/1207)) ([c9dcbc3](https://github.com/tj-actions/changed-files/commit/c9dcbc31476236325f8079dd68519c7faae1ead8)) - (renovate[bot])
## <!-- 9 -->⬆️ Upgrades
- Upgraded to v36.0.10 ([#1202](https://github.com/tj-actions/changed-files/issues/1202))
Co-authored-by: jackton1 <jackton1@users.noreply.github.com> ([aa54931](https://github.com/tj-actions/changed-files/commit/aa54931d1daf7fb83e84f8b18362536ea6e86589)) - (tj-actions[bot])
# [36.0.10](https://github.com/tj-actions/changed-files/compare/v36.0.9...v36.0.10) - (2023-05-30)
## <!-- 1 -->🐛 Bug Fixes
- Bug with diff output ([#1201](https://github.com/tj-actions/changed-files/issues/1201)) ([3f7b5c9](https://github.com/tj-actions/changed-files/commit/3f7b5c900bdbf1b80a825e220413986227b3ff03)) - (Tonye Jack)
## <!-- 26 -->🔄 Update
- Update README.md ([161a189](https://github.com/tj-actions/changed-files/commit/161a189eb5c78db4f84ac77bab2ff4dbfc6b9d9c)) - (Tonye Jack)
## <!-- 7 -->⚙️ Miscellaneous Tasks
- **deps:** Update typescript-eslint monorepo to v5.59.8 ([#1199](https://github.com/tj-actions/changed-files/issues/1199)) ([a48618a](https://github.com/tj-actions/changed-files/commit/a48618a94b7ff98374d2d326319105f772da3b7a)) - (renovate[bot])
## <!-- 9 -->⬆️ Upgrades
- Upgraded to v36.0.9 ([#1198](https://github.com/tj-actions/changed-files/issues/1198))
Co-authored-by: jackton1 <jackton1@users.noreply.github.com> ([2bdfc0c](https://github.com/tj-actions/changed-files/commit/2bdfc0c60d432fdb25b4d45b810881e8dcdad82c)) - (tj-actions[bot])
# [36.0.9](https://github.com/tj-actions/changed-files/compare/v36.0.8...v36.0.9) - (2023-05-29)
## <!-- 1 -->🐛 Bug Fixes
- Matching all nested files with a directory name ([#1197](https://github.com/tj-actions/changed-files/issues/1197)) ([cf4fe87](https://github.com/tj-actions/changed-files/commit/cf4fe8759a45edd76ed6215da3529d2dbd2a3c68)) - (Tonye Jack)
## <!-- 26 -->🔄 Update
- Updated README.md ([#1196](https://github.com/tj-actions/changed-files/issues/1196))
Co-authored-by: jackton1 <jackton1@users.noreply.github.com> ([58c7ce2](https://github.com/tj-actions/changed-files/commit/58c7ce2addd872691e0da689c1fa281c07713275)) - (tj-actions[bot])
- Update README.md ([61316fd](https://github.com/tj-actions/changed-files/commit/61316fda7680cc63f418e60ecc690b89be1da81f)) - (Tonye Jack)
- Update README.md ([#1195](https://github.com/tj-actions/changed-files/issues/1195))
([5d38ef5](https://github.com/tj-actions/changed-files/commit/5d38ef52895b6ff6402354d6848ec6fedbf0d2ca)) - (Tonye Jack)
- Update README.md ([51330c5](https://github.com/tj-actions/changed-files/commit/51330c5719e5ccb3eba7e629ea5d44be35d04b00)) - (Tonye Jack)
- Update README.md ([7b92155](https://github.com/tj-actions/changed-files/commit/7b92155d7a2bb44c09d58bd53e4cc54e6ce4811a)) - (Tonye Jack)
- Update README.md ([3127174](https://github.com/tj-actions/changed-files/commit/3127174fab678ec0c8a22b5482efa6c350cec573)) - (Tonye Jack)
## <!-- 9 -->⬆️ Upgrades
- Upgraded to v36.0.8 ([#1192](https://github.com/tj-actions/changed-files/issues/1192))
Co-authored-by: jackton1 <jackton1@users.noreply.github.com> ([cfdaf8f](https://github.com/tj-actions/changed-files/commit/cfdaf8f14eabcd0bbf60d1fdde9009892b275ddc)) - (tj-actions[bot])
# [36.0.8](https://github.com/tj-actions/changed-files/compare/v36.0.7...v36.0.8) - (2023-05-29)
## <!-- 0 -->🚀 Features
- Add support for running on release event ([#1191](https://github.com/tj-actions/changed-files/issues/1191)) ([043929e](https://github.com/tj-actions/changed-files/commit/043929ee8fffa1dd1d619782a5a338cf39e76e23)) - (Tonye Jack)
## <!-- 9 -->⬆️ Upgrades
- Upgraded to v36.0.7 ([#1190](https://github.com/tj-actions/changed-files/issues/1190))
Co-authored-by: jackton1 <jackton1@users.noreply.github.com> ([96fd197](https://github.com/tj-actions/changed-files/commit/96fd19710a49b0e910f7363e8af37dd6b182636a)) - (tj-actions[bot])
# [36.0.7](https://github.com/tj-actions/changed-files/compare/v36.0.6...v36.0.7) - (2023-05-29)
## <!-- 1 -->🐛 Bug Fixes
- Bug running changed files with limited history ([#1188](https://github.com/tj-actions/changed-files/issues/1188)) ([449a845](https://github.com/tj-actions/changed-files/commit/449a845ff28da516ea1752afd195d2f7f642c6f4)) - (Tonye Jack)
## <!-- 26 -->🔄 Update
- Update README.md ([777b2b4](https://github.com/tj-actions/changed-files/commit/777b2b437a82c8afbb474f57812fd790c7509391)) - (Tonye Jack)
- Update README.md ([2fafe0a](https://github.com/tj-actions/changed-files/commit/2fafe0a7349fddf5ea3a02484419a4831979d79b)) - (Tonye Jack)
## <!-- 7 -->⚙️ Miscellaneous Tasks
- **deps:** Lock file maintenance ([#1189](https://github.com/tj-actions/changed-files/issues/1189)) ([4e2535f](https://github.com/tj-actions/changed-files/commit/4e2535f2b330e70ff7055f7de4272653cfdbd555)) - (renovate[bot])
- **deps:** Update tj-actions/eslint-changed-files action to v19 ([#1185](https://github.com/tj-actions/changed-files/issues/1185)) ([bc88d8b](https://github.com/tj-actions/changed-files/commit/bc88d8bc954005f987c5c73e133f2cb4927ddf3e)) - (renovate[bot])
## <!-- 9 -->⬆️ Upgrades
- Upgraded to v36.0.6 ([#1184](https://github.com/tj-actions/changed-files/issues/1184))
Co-authored-by: jackton1 <jackton1@users.noreply.github.com> ([fd2b77d](https://github.com/tj-actions/changed-files/commit/fd2b77dd749ff644f3fe50e1f7341902e0064744)) - (tj-actions[bot])
# [36.0.6](https://github.com/tj-actions/changed-files/compare/v36.0.5...v36.0.6) - (2023-05-26)
## <!-- 0 -->🚀 Features

134
README.md
View File

@@ -19,7 +19,7 @@
## changed-files
Retrieve all changed files and directories relative to a target branch, preceeding commit or the last remote commit returning a **relative path** from the project root.
Retrieve all changed files and directories relative to a target branch, preceeding commit or the last remote commit returning **relative paths** from the project root.
## Table of contents
@@ -45,7 +45,8 @@ Retrieve all changed files and directories relative to a target branch, preceedi
* Supports Git submodules.
* Escaped JSON output which can be used to run matrix jobs based on changed files.
* List changed directories.
* Restrict the max depth of matching changed directories.
* Limit the matching changed directories to a maximum depth.
* Optionally exclude the current directory
* Write outputs to a `.txt` or `.json` file at a specified location for further processing.
* Monorepos (Fetches a fixed number of commits).
* Supports all platforms (Linux, MacOS, Windows).
@@ -59,6 +60,7 @@ Retrieve all changed files and directories relative to a target branch, preceedi
* Restrict change detection to a subset of files and directories:
* Boolean output indicating that certain files have been changed.
* Using [Glob pattern](https://docs.github.com/en/actions/learn-github-actions/workflow-syntax-for-github-actions#filter-pattern-cheat-sheet) matching.
* Globstar.
* Brace expansion.
## Usage
@@ -67,9 +69,9 @@ Retrieve all changed files and directories relative to a target branch, preceedi
>
> * **IMPORTANT:** For `push` events when configuring [`actions/checkout`](https://github.com/actions/checkout#usage) the `fetch-depth` should be set to either `fetch-depth: 0` **OR** `fetch-depth: 2` depending on your use case.
> * For monorepos where pulling all the branch history might not be desired, you can omit [`actions/checkout`](https://github.com/actions/checkout#usage) - `fetch-depth` for `pull_request` events.
> * For files located in a sub-directory ensure that the pattern specified contains `**/` (globstar) to match any preceding directories or explicitly pass the full path relative to the project root. See: [Pattern Gotcha](https://github.com/tj-actions/glob#pattern-gotcha).
> * All multiline inputs should not use double or single quotes since the value is already a string seperated by a newline character. See [Examples](#examples) for more information.
> * 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 PR's 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)
```yaml
name: CI
@@ -82,10 +84,10 @@ on:
branches:
- main
# -------------------------------------------------------------------------------------------------------------------------
# ------------------------------------------------------------------------------------------------------------
# Event `push`: Compare the preceeding 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.
# -------------------------------------------------------------------------------------------------------------------------
# ------------------------------------------------------------------------------------------------------------
jobs:
build:
@@ -125,19 +127,19 @@ jobs:
echo "List all the files that have changed: ${{ steps.changed-files-specific.outputs.all_changed_files }}"
# Example 3
- name: Get all changed *.js file(s) or any file in the static folder excluding the docs folder
- 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@v36
with:
files: |
**/*.js
**.js
static
files_ignore: docs
- name: Run step if any *.js file(s) or any file in the static folder change
- 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 "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 }}"
```
@@ -170,29 +172,29 @@ Support this project with a :star:
<!-- AUTO-DOC-OUTPUT:START - Do not remove or modify this section -->
| OUTPUT | TYPE | DESCRIPTION |
|--------------------------------|--------|----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|
| added\_files | string | Returns only files that are <br>Added (A). |
| all\_changed\_and\_modified\_files | string | Returns all changed and modified <br>files i.e. *a combination of (ACMRDTUX)* |
| all\_changed\_files | string | Returns all changed files i.e. <br>*a combination of all added, copied, modified and renamed files (ACMR)* |
| all\_modified\_files | string | Returns all changed files i.e. <br>*a combination of all added, copied, modified, renamed and deleted files (ACMRD)*. |
| all\_old\_new\_renamed\_files | string | Returns only files that are <br>Renamed and list their old <br>and new names. **NOTE:** This <br>requires setting `include_all_old_new_renamed_files` to `true` <br>(R) |
| any\_changed | string | Returns `true` when any of <br>the filenames provided using the <br>`files` input has changed. i.e. <br>*using a combination of all added, copied, modified and renamed files (ACMR)*. |
| any\_deleted | string | Returns `true` when any of <br>the filenames provided using the <br>`files` input has been deleted. <br>(D) |
| any\_modified | string | Returns `true` when any of <br>the filenames provided using the <br>`files` input has been modified. <br>i.e. *using a combination of all added, copied, modified, renamed, and deleted files (ACMRD)*. |
| copied\_files | string | Returns only files that are <br>Copied (C). |
| deleted\_files | string | Returns only files that are <br>Deleted (D). |
| modified\_files | string | Returns only files that are <br>Modified (M). |
| only\_changed | string | Returns `true` when only files <br>provided using the `files` input <br>has changed. i.e. *using a combination of all added, copied, modified and renamed files (ACMR)*. |
| only\_deleted | string | Returns `true` when only files <br>provided using the `files` input <br>has been deleted. (D) |
| only\_modified | string | Returns `true` when only files <br>provided using the `files` input <br>has been modified. (ACMRD). |
| other\_changed\_files | string | Returns all other changed files <br>not listed in the files <br>input i.e. *using a combination of all added, copied, modified and renamed files (ACMR)*. |
| other\_deleted\_files | string | Returns all other deleted files <br>not listed in the files <br>input i.e. *a combination of all deleted files (D)* |
| other\_modified\_files | string | Returns all other modified files <br>not listed in the files <br>input i.e. *a combination of all added, copied, modified, and deleted files (ACMRD)* |
| renamed\_files | string | Returns only files that are <br>Renamed (R). |
| type\_changed\_files | string | Returns only files that have <br>their file type changed (T). |
| unknown\_files | string | Returns only files that are <br>Unknown (X). |
| unmerged\_files | string | Returns only files that are <br>Unmerged (U). |
| OUTPUT | TYPE | DESCRIPTION |
|--------------------------------|--------|-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|
| added\_files | string | Returns only files that are <br>Added (A). |
| all\_changed\_and\_modified\_files | string | Returns all changed and modified <br>files i.e. *a combination of (ACMRDTUX)* |
| all\_changed\_files | string | Returns all changed files i.e. <br>*a combination of all added, copied, modified and renamed files (ACMR)* |
| all\_modified\_files | string | Returns all changed files i.e. <br>*a combination of all added, copied, modified, renamed and deleted files (ACMRD)*. |
| all\_old\_new\_renamed\_files | string | Returns only files that are <br>Renamed and list their old <br>and new names. **NOTE:** This <br>requires setting `include_all_old_new_renamed_files` to `true` <br>(R) |
| any\_changed | string | Returns `true` when any of <br>the filenames provided using the <br>`files*` or `files_ignore*` inputs has changed. i.e. <br>*using a combination of all added, copied, modified and renamed files (ACMR)*. |
| any\_deleted | string | Returns `true` when any of <br>the filenames provided using the <br>`files*` or `files_ignore*` inputs has been deleted. <br>(D) |
| any\_modified | string | Returns `true` when any of <br>the filenames provided using the <br>`files*` or `files_ignore*` inputs has been modified. <br>i.e. *using a combination of all added, copied, modified, renamed, and deleted files (ACMRD)*. |
| copied\_files | string | Returns only files that are <br>Copied (C). |
| deleted\_files | string | Returns only files that are <br>Deleted (D). |
| modified\_files | string | Returns only files that are <br>Modified (M). |
| only\_changed | string | Returns `true` when only files <br>provided using the `files*` or `files_ignore*` inputs <br>has changed. i.e. *using a combination of all added, copied, modified and renamed files (ACMR)*. |
| only\_deleted | string | Returns `true` when only files <br>provided using the `files*` or `files_ignore*` inputs <br>has been deleted. (D) |
| only\_modified | string | Returns `true` when only files <br>provided using the `files*` or `files_ignore*` inputs <br>has been modified. (ACMRD). |
| other\_changed\_files | string | Returns all other changed files <br>not listed in the files <br>input i.e. *using a combination of all added, copied, modified and renamed files (ACMR)*. |
| other\_deleted\_files | string | Returns all other deleted files <br>not listed in the files <br>input i.e. *a combination of all deleted files (D)* |
| other\_modified\_files | string | Returns all other modified files <br>not listed in the files <br>input i.e. *a combination of all added, copied, modified, and deleted files (ACMRD)* |
| renamed\_files | string | Returns only files that are <br>Renamed (R). |
| type\_changed\_files | string | Returns only files that have <br>their file type changed (T). |
| unknown\_files | string | Returns only files that are <br>Unknown (X). |
| unmerged\_files | string | Returns only files that are <br>Unmerged (U). |
<!-- AUTO-DOC-OUTPUT:END -->
@@ -200,36 +202,37 @@ Support this project with a :star:
<!-- AUTO-DOC-INPUT:START - Do not remove or modify this section -->
| INPUT | TYPE | REQUIRED | DEFAULT | DESCRIPTION |
|-----------------------------------------|--------|----------|---------------------|---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|
| 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 root of the <br>project. |
| dir\_names\_exclude\_root | string | false | `"false"` | Exclude the root directory represented <br>by `.` from the output <br>when `dir_names`is set to `true`. |
| dir\_names\_max\_depth | string | false | | Maximum depth of directories to <br>output. e.g `test/test1/test2` with max <br>depth of `2` 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 to <br>detect changes using only these <br>list of file(s) (Defaults to the entire repo) **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\_separator | string | false | `"\n"` | Separator used to split the <br>`files` 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. |
| path | string | false | `"."` | Specify a relative path under <br>`$GITHUB_WORKSPACE` to locate the repository. |
| quotepath | string | false | `"true"` | Use non ascii characters to <br>match files and output the <br>filenames completely verbatim by setting <br>this to `false` |
| 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 <br>target branch for pull request <br>events and the previous remote <br>commit of the current branch <br>for push events. |
| 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 files in <br>the `.github/outputs` folder by default. |
| INPUT | TYPE | REQUIRED | DEFAULT | DESCRIPTION |
|------------------------------------------------------------------------------|--------|----------|---------------------|---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|
| 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\_exclude\_root~~ <br> Use `dir_names_exclude_current_dir` instead. | string | false | `"false"` | **Deprecated:** Exclude the root directory <br>represented by `.` from the <br>output 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 to <br>detect changes using only these <br>list of file(s) (Defaults to the entire repo) **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\_separator | string | false | `"\n"` | Separator used to split the <br>`files` 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. |
| path | string | false | `"."` | Specify a relative path under <br>`$GITHUB_WORKSPACE` to locate the repository. |
| quotepath | string | false | `"true"` | Use non ascii characters to <br>match files and output the <br>filenames completely verbatim by setting <br>this to `false` |
| 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 <br>target branch for pull request <br>events and the previous remote <br>commit of the current branch <br>for push events. |
| 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 -->
@@ -731,6 +734,12 @@ See [inputs](#inputs) for more information.
* [nodejs/docker-node: uses tj-actions/changed-files to generate matrix jobs based on changes detected](https://github.com/nodejs/docker-node/blob/3c4fa6daf06a4786d202f2f610351837806a0380/.github/workflows/build-test.yml#L29)
* [refined-github: uses tj-actions/changed-files to automate test URL validation in added/edited files](https://github.com/refined-github/refined-github/blob/b754bfe58904da8a599d7876fdaaf18302785629/.github/workflows/features.yml#L35)
* [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)
![image](https://github.com/tj-actions/changed-files/assets/17484350/23767413-4c51-42fb-ab1c-39ef72c44904)
And many more...
## Known Limitation
@@ -767,7 +776,6 @@ With the switch from using grep's Extended regex to match files to the natively
This package was created with [cookiecutter-action](https://github.com/tj-actions/cookiecutter-action).
* [tj-actions/glob](https://github.com/tj-actions/glob)
* [tj-actions/auto-doc](https://github.com/tj-actions/auto-doc)
* [tj-actions/verify-changed-files](https://github.com/tj-actions/verify-changed-files)
* [tj-actions/demo](https://github.com/tj-actions/demo)

View File

@@ -79,15 +79,20 @@ inputs:
default: "true"
dir_names:
default: "false"
description: "Output unique changed directories instead of filenames. **NOTE:** This returns `.` for changed files located in the root of the project."
description: "Output unique changed directories instead of filenames. **NOTE:** This returns `.` for changed files located in the current working directory which defaults to `$GITHUB_WORKSPACE`."
required: false
dir_names_max_depth:
description: "Maximum depth of directories to output. e.g `test/test1/test2` with max depth of `2` returns `test/test1`."
description: "Limit the directory output to a maximum depth e.g `test/test1/test2` with max depth of `2` returns `test/test1`."
required: false
dir_names_exclude_current_dir:
description: "Exclude the current directory represented by `.` from the output when `dir_names` is set to `true`."
required: false
default: "false"
dir_names_exclude_root:
description: "Exclude the root directory represented by `.` from the output when `dir_names`is set to `true`."
required: false
default: "false"
deprecationMessage: "Use `dir_names_exclude_current_dir` instead."
json:
description: "Output list of changed files in a JSON formatted string which can be used for matrix jobs."
required: false
@@ -105,7 +110,7 @@ inputs:
required: false
default: "false"
write_output_files:
description: "Write outputs to files in the `.github/outputs` folder by default."
description: "Write outputs to the `output_dir` defaults to `.github/outputs` folder. **NOTE:** This creates a `.txt` file by default and a `.json` file if `json` is set to `true`."
required: false
default: "false"
output_dir:
@@ -137,23 +142,23 @@ outputs:
all_changed_files:
description: "Returns all changed files i.e. *a combination of all added, copied, modified and renamed files (ACMR)*"
any_changed:
description: "Returns `true` when any of the filenames provided using the `files` input has changed. i.e. *using a combination of all added, copied, modified and renamed files (ACMR)*."
description: "Returns `true` when any of the filenames provided using the `files*` or `files_ignore*` inputs has changed. i.e. *using a combination of all added, copied, modified and renamed files (ACMR)*."
only_changed:
description: "Returns `true` when only files provided using the `files` input has changed. i.e. *using a combination of all added, copied, modified and renamed files (ACMR)*."
description: "Returns `true` when only files provided using the `files*` or `files_ignore*` inputs has changed. i.e. *using a combination of all added, copied, modified and renamed files (ACMR)*."
other_changed_files:
description: "Returns all other changed files not listed in the files input i.e. *using a combination of all added, copied, modified and renamed files (ACMR)*."
all_modified_files:
description: "Returns all changed files i.e. *a combination of all added, copied, modified, renamed and deleted files (ACMRD)*."
any_modified:
description: "Returns `true` when any of the filenames provided using the `files` input has been modified. i.e. *using a combination of all added, copied, modified, renamed, and deleted files (ACMRD)*."
description: "Returns `true` when any of the filenames provided using the `files*` or `files_ignore*` inputs has been modified. i.e. *using a combination of all added, copied, modified, renamed, and deleted files (ACMRD)*."
only_modified:
description: "Returns `true` when only files provided using the `files` input has been modified. (ACMRD)."
description: "Returns `true` when only files provided using the `files*` or `files_ignore*` inputs has been modified. (ACMRD)."
other_modified_files:
description: "Returns all other modified files not listed in the files input i.e. *a combination of all added, copied, modified, and deleted files (ACMRD)*"
any_deleted:
description: "Returns `true` when any of the filenames provided using the `files` input has been deleted. (D)"
description: "Returns `true` when any of the filenames provided using the `files*` or `files_ignore*` inputs has been deleted. (D)"
only_deleted:
description: "Returns `true` when only files provided using the `files` input has been deleted. (D)"
description: "Returns `true` when only files provided using the `files*` or `files_ignore*` inputs has been deleted. (D)"
other_deleted_files:
description: "Returns all other deleted files not listed in the files input i.e. *a combination of all deleted files (D)*"

968
dist/index.js generated vendored

File diff suppressed because it is too large Load Diff

2
dist/index.js.map generated vendored

File diff suppressed because one or more lines are too long

51
dist/licenses.txt generated vendored
View File

@@ -134,6 +134,57 @@ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
THE SOFTWARE.
lodash
MIT
Copyright OpenJS Foundation and other contributors <https://openjsf.org/>
Based on Underscore.js, copyright Jeremy Ashkenas,
DocumentCloud and Investigative Reporters & Editors <http://underscorejs.org/>
This software consists of voluntary contributions made by many
individuals. For exact contribution history, see the revision history
available at https://github.com/lodash/lodash
The following license applies to all parts of this software except as
documented below:
====
Permission is hereby granted, free of charge, to any person obtaining
a copy of this software and associated documentation files (the
"Software"), to deal in the Software without restriction, including
without limitation the rights to use, copy, modify, merge, publish,
distribute, sublicense, and/or sell copies of the Software, and to
permit persons to whom the Software is furnished to do so, subject to
the following conditions:
The above copyright notice and this permission notice shall be
included in all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
====
Copyright and related rights for sample code are waived via CC0. Sample
code is defined as all source code displayed within the prose of the
documentation.
CC0: http://creativecommons.org/publicdomain/zero/1.0/
====
Files located in the node_modules and vendor directories are externally
maintained libraries used by this software which have their own
licenses; we recommend you read them, as their terms may differ from the
terms above.
micromatch
MIT
The MIT License (MIT)

View File

@@ -34,23 +34,25 @@
"dependencies": {
"@actions/core": "1.10.0",
"@actions/exec": "1.1.1",
"lodash": "^4.17.15",
"micromatch": "^4.0.5"
},
"devDependencies": {
"@types/jest": "29.5.1",
"@types/jest": "29.5.2",
"@types/lodash": "^4.14.195",
"@types/micromatch": "^4.0.2",
"@types/node": "20.2.1",
"@types/uuid": "9.0.1",
"@typescript-eslint/eslint-plugin": "5.59.7",
"@typescript-eslint/parser": "5.59.7",
"@types/uuid": "9.0.2",
"@typescript-eslint/eslint-plugin": "5.59.11",
"@typescript-eslint/parser": "5.59.11",
"@vercel/ncc": "0.36.1",
"eslint": "8.41.0",
"eslint-plugin-github": "4.7.0",
"eslint": "8.42.0",
"eslint-plugin-github": "4.8.0",
"eslint-plugin-jest": "27.2.1",
"eslint-plugin-prettier": "^4.2.1",
"jest": "29.5.0",
"prettier": "2.8.8",
"ts-jest": "29.1.0",
"typescript": "5.0.4"
"typescript": "5.1.3"
}
}

View File

@@ -4,11 +4,12 @@ import {DiffResult} from './commitSha'
import {Inputs} from './inputs'
import {
getDirnameMaxDepth,
gitDiff,
gitRenamedFiles,
gitSubmoduleDiffSHA,
jsonOutput
jsonOutput,
getAllChangedFiles
} from './utils'
import flatten from 'lodash/flatten'
export const getRenamedFiles = async ({
inputs,
@@ -68,30 +69,37 @@ export const getRenamedFiles = async ({
return renamedFiles.join(inputs.oldNewFilesSeparator)
}
export const getDiffFiles = async ({
inputs,
export enum ChangeTypeEnum {
Added = 'A',
Copied = 'C',
Deleted = 'D',
Modified = 'M',
Renamed = 'R',
TypeChanged = 'T',
Unmerged = 'U',
Unknown = 'X'
}
export type ChangedFiles = {
[key in ChangeTypeEnum]: string[]
}
export const getAllDiffFiles = async ({
workingDirectory,
hasSubmodule,
diffResult,
diffFilter,
filePatterns = [],
submodulePaths
}: {
inputs: Inputs
workingDirectory: string
hasSubmodule: boolean
diffResult: DiffResult
diffFilter: string
filePatterns?: string[]
submodulePaths: string[]
}): Promise<string> => {
let files = await gitDiff({
}): Promise<ChangedFiles> => {
const files = await getAllChangedFiles({
cwd: workingDirectory,
sha1: diffResult.previousSha,
sha2: diffResult.currentSha,
diff: diffResult.diff,
diffFilter,
filePatterns
diff: diffResult.diff
})
if (hasSubmodule) {
@@ -110,31 +118,107 @@ export const getDiffFiles = async ({
)
if (submoduleShaResult.currentSha && submoduleShaResult.previousSha) {
const submoduleFiles = await gitDiff({
const submoduleFiles = await getAllChangedFiles({
cwd: submoduleWorkingDirectory,
sha1: submoduleShaResult.previousSha,
sha2: submoduleShaResult.currentSha,
diff: diffResult.diff,
diffFilter,
isSubmodule: true,
filePatterns,
parentDir: submodulePath
})
files.push(...submoduleFiles)
for (const changeType of Object.keys(
submoduleFiles
) as ChangeTypeEnum[]) {
if (!files[changeType]) {
files[changeType] = []
}
files[changeType].push(...submoduleFiles[changeType])
}
}
}
}
if (inputs.dirNames) {
files = files.map(file =>
getDirnameMaxDepth({
pathStr: file,
dirNamesMaxDepth: inputs.dirNamesMaxDepth,
excludeRoot: inputs.dirNamesExcludeRoot
})
)
files = [...new Set(files)]
return files
}
function* getChangeTypeFilesGenerator({
inputs,
changedFiles,
changeTypes
}: {
inputs: Inputs
changedFiles: ChangedFiles
changeTypes: ChangeTypeEnum[]
}): Generator<string> {
for (const changeType of changeTypes) {
const files = changedFiles[changeType] || []
for (const file of files) {
if (inputs.dirNames) {
yield getDirnameMaxDepth({
pathStr: file,
dirNamesMaxDepth: inputs.dirNamesMaxDepth,
excludeCurrentDir:
inputs.dirNamesExcludeRoot || inputs.dirNamesExcludeCurrentDir
})
} else {
yield file
}
}
}
}
export const getChangeTypeFiles = async ({
inputs,
changedFiles,
changeTypes
}: {
inputs: Inputs
changedFiles: ChangedFiles
changeTypes: ChangeTypeEnum[]
}): Promise<string> => {
const files = [
...new Set(getChangeTypeFilesGenerator({inputs, changedFiles, changeTypes}))
]
if (inputs.json) {
return jsonOutput({value: files, shouldEscape: inputs.escapeJson})
}
return files.join(inputs.separator)
}
function* getAllChangeTypeFilesGenerator({
inputs,
changedFiles
}: {
inputs: Inputs
changedFiles: ChangedFiles
}): Generator<string> {
for (const file of flatten(Object.values(changedFiles))) {
if (inputs.dirNames) {
yield getDirnameMaxDepth({
pathStr: file,
dirNamesMaxDepth: inputs.dirNamesMaxDepth,
excludeCurrentDir:
inputs.dirNamesExcludeRoot || inputs.dirNamesExcludeCurrentDir
})
} else {
yield file
}
}
}
export const getAllChangeTypeFiles = async ({
inputs,
changedFiles
}: {
inputs: Inputs
changedFiles: ChangedFiles
}): Promise<string> => {
const files = [
...new Set(getAllChangeTypeFilesGenerator({inputs, changedFiles}))
]
if (inputs.json) {
return jsonOutput({value: files, shouldEscape: inputs.escapeJson})

View File

@@ -7,17 +7,19 @@ import {
getHeadSha,
getParentSha,
getPreviousGitTag,
getRemoteBranchHeadSha,
gitFetch,
gitFetchSubmodules,
gitLog,
gitLsRemote,
verifyCommitSha
} from './utils'
const getCurrentSHA = async ({
env,
inputs,
workingDirectory
}: {
env: Env
inputs: Inputs
workingDirectory: string
}): Promise<string> => {
@@ -47,7 +49,18 @@ const getCurrentSHA = async ({
}
} else {
if (!currentSha) {
currentSha = await getHeadSha({cwd: workingDirectory})
if (
env.GITHUB_EVENT_PULL_REQUEST_HEAD_SHA &&
(await verifyCommitSha({
sha: env.GITHUB_EVENT_PULL_REQUEST_HEAD_SHA,
cwd: workingDirectory,
showAsErrorMessage: false
})) === 0
) {
currentSha = env.GITHUB_EVENT_PULL_REQUEST_HEAD_SHA
} else {
currentSha = await getHeadSha({cwd: workingDirectory})
}
}
}
@@ -83,7 +96,9 @@ export const getSHAForPushEvent = async (
core.info('Repository is shallow, fetching more history...')
if (isTag) {
const sourceBranch = env.GITHUB_EVENT_BASE_REF.replace('refs/heads/', '')
const sourceBranch =
env.GITHUB_EVENT_BASE_REF.replace('refs/heads/', '') ||
env.GITHUB_EVENT_RELEASE_TARGET_COMMITISH
await gitFetch({
cwd: workingDirectory,
args: [
@@ -122,7 +137,7 @@ export const getSHAForPushEvent = async (
}
}
const currentSha = await getCurrentSHA({inputs, workingDirectory})
const currentSha = await getCurrentSHA({env, inputs, workingDirectory})
let previousSha = inputs.baseSha
const diff = '..'
@@ -259,7 +274,7 @@ export const getSHAForPullRequestEvent = async (
if (isShallow) {
core.info('Repository is shallow, fetching more history...')
const prFetchExitCode = await gitFetch({
let prFetchExitCode = await gitFetch({
cwd: workingDirectory,
args: [
...gitExtraArgs,
@@ -271,7 +286,7 @@ export const getSHAForPullRequestEvent = async (
})
if (prFetchExitCode !== 0) {
await gitFetch({
prFetchExitCode = await gitFetch({
cwd: workingDirectory,
args: [
...gitExtraArgs,
@@ -284,6 +299,12 @@ export const getSHAForPullRequestEvent = async (
})
}
if (prFetchExitCode !== 0) {
throw new Error(
'Failed to fetch pull request branch. Please ensure "persist-credentials" is set to "true" when checking out the repository. See: https://github.com/actions/checkout#usage'
)
}
if (!inputs.sinceLastRemoteCommit) {
core.debug('Fetching target branch...')
await gitFetch({
@@ -310,9 +331,10 @@ export const getSHAForPullRequestEvent = async (
})
}
}
core.info('Completed fetching more history.')
}
const currentSha = await getCurrentSHA({inputs, workingDirectory})
const currentSha = await getCurrentSHA({env, inputs, workingDirectory})
let previousSha = inputs.baseSha
let diff = '...'
@@ -327,7 +349,7 @@ export const getSHAForPullRequestEvent = async (
throw new Error('Similar commit hashes detected.')
}
await verifyCommitSha({sha: currentSha, cwd: workingDirectory})
await verifyCommitSha({sha: previousSha, cwd: workingDirectory})
core.debug(`Previous SHA: ${previousSha}`)
return {
@@ -348,32 +370,32 @@ export const getSHAForPullRequestEvent = async (
if (!previousSha) {
if (inputs.sinceLastRemoteCommit) {
previousSha = env.GITHUB_EVENT_BEFORE
if (!previousSha) {
previousSha = await gitLsRemote({
previousSha =
env.GITHUB_EVENT_BEFORE ||
(await getRemoteBranchHeadSha({
cwd: workingDirectory,
args: [currentBranch]
})
}
branch: currentBranch
}))
if (
(await verifyCommitSha({
sha: previousSha,
cwd: workingDirectory,
showAsErrorMessage: false
})) !== 0
!previousSha ||
(previousSha &&
(await verifyCommitSha({sha: previousSha, cwd: workingDirectory})) !==
0)
) {
core.warning(
'Unable to locate the remote branch head sha. Falling back to the pull request base sha.'
)
previousSha = env.GITHUB_EVENT_PULL_REQUEST_BASE_SHA
}
} else {
previousSha = env.GITHUB_EVENT_PULL_REQUEST_BASE_SHA
previousSha = await getRemoteBranchHeadSha({
cwd: workingDirectory,
branch: targetBranch
})
if (!previousSha) {
previousSha = await gitLsRemote({
cwd: workingDirectory,
args: [targetBranch]
})
previousSha = env.GITHUB_EVENT_PULL_REQUEST_BASE_SHA
}
if (isShallow) {
@@ -458,9 +480,28 @@ export const getSHAForPullRequestEvent = async (
core.error(
`Similar commit hashes detected: previous sha: ${previousSha} is equivalent to the current sha: ${currentSha}.`
)
core.error(
`Please verify that both commits are valid, and increase the fetch_depth to a number higher than ${inputs.fetchDepth}.`
)
// This occurs if a PR is created from a forked repository and the event is pull_request_target.
// - name: Checkout to branch
// uses: actions/checkout@v3
// Without setting the repository to use the same repository as the pull request will cause the previousSha
// to be the same as the currentSha since the currentSha cannot be found in the local history.
// The solution is to use:
// - name: Checkout to branch
// uses: actions/checkout@v3
// with:
// repository: ${{ github.event.pull_request.head.repo.full_name }}
if (env.GITHUB_EVENT_NAME === '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 }}'
)
} else {
core.error(
`Please verify that both commits are valid, and increase the fetch_depth to a number higher than ${inputs.fetchDepth}.`
)
}
throw new Error('Similar commit hashes detected.')
}

View File

@@ -8,11 +8,14 @@ export type Env = {
GITHUB_REF_NAME: string
GITHUB_REF: string
GITHUB_EVENT_BASE_REF: string
GITHUB_EVENT_RELEASE_TARGET_COMMITISH: string
GITHUB_EVENT_HEAD_REPO_FORK: string
GITHUB_WORKSPACE: string
GITHUB_EVENT_FORCED: string
GITHUB_EVENT_PULL_REQUEST_NUMBER: string
GITHUB_EVENT_PULL_REQUEST_BASE_SHA: string
GITHUB_EVENT_PULL_REQUEST_HEAD_SHA: string
GITHUB_EVENT_NAME: string
}
type GithubEvent = {
@@ -20,6 +23,7 @@ type GithubEvent = {
pull_request?: {
head: {
ref: string
sha: string
}
base: {
ref: string
@@ -27,10 +31,15 @@ type GithubEvent = {
}
number: string
}
release?: {
target_commitish: string
}
before?: string
base_ref?: string
head_repo?: {
fork: string
head?: {
repo?: {
fork: string
}
}
}
@@ -49,12 +58,16 @@ export const getEnv = async (): Promise<Env> => {
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_HEAD_REPO_FORK: eventJson.head_repo?.fork || '',
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_REF_NAME: process.env.GITHUB_REF_NAME || '',
GITHUB_REF: process.env.GITHUB_REF || '',
GITHUB_WORKSPACE: process.env.GITHUB_WORKSPACE || ''
GITHUB_WORKSPACE: process.env.GITHUB_WORKSPACE || '',
GITHUB_EVENT_NAME: process.env.GITHUB_EVENT_NAME || ''
}
}

View File

@@ -23,6 +23,7 @@ export type Inputs = {
dirNames: boolean
dirNamesMaxDepth?: number
dirNamesExcludeRoot: boolean
dirNamesExcludeCurrentDir: boolean
json: boolean
escapeJson: boolean
fetchDepth?: number
@@ -93,6 +94,12 @@ export const getInputs = (): Inputs => {
const dirNamesExcludeRoot = core.getBooleanInput('dir_names_exclude_root', {
required: false
})
const dirNamesExcludeCurrentDir = core.getBooleanInput(
'dir_names_exclude_current_dir',
{
required: false
}
)
const json = core.getBooleanInput('json', {required: false})
const escapeJson = core.getBooleanInput('escape_json', {required: false})
const fetchDepth = core.getInput('fetch_depth', {required: false})
@@ -127,6 +134,7 @@ export const getInputs = (): Inputs => {
diffRelative,
dirNames,
dirNamesExcludeRoot,
dirNamesExcludeCurrentDir,
json,
escapeJson,
sinceLastRemoteCommit,

View File

@@ -1,15 +1,22 @@
import * as core from '@actions/core'
import path from 'path'
import {getDiffFiles, getRenamedFiles} from './changedFiles'
import {
getAllChangeTypeFiles,
getAllDiffFiles,
getChangeTypeFiles,
getRenamedFiles,
ChangeTypeEnum
} from './changedFiles'
import {
DiffResult,
getSHAForPullRequestEvent,
getSHAForPushEvent,
DiffResult
getSHAForPushEvent
} from './commitSha'
import {getEnv} from './env'
import {getInputs} from './inputs'
import {
getFilePatterns,
getFilteredChangedFiles,
getSubmodulePath,
isRepoShallow,
setOutput,
@@ -67,7 +74,7 @@ export async function run(): Promise<void> {
let diffResult: DiffResult
if (!env.GITHUB_EVENT_PULL_REQUEST_BASE_REF) {
core.info('Running on a push event...')
core.info(`Running on a ${env.GITHUB_EVENT_NAME || 'push'} event...`)
diffResult = await getSHAForPushEvent(
inputs,
env,
@@ -78,7 +85,9 @@ export async function run(): Promise<void> {
isTag
)
} else {
core.info('Running on a pull request event...')
core.info(
`Running on a ${env.GITHUB_EVENT_NAME || 'pull_request'} event...`
)
diffResult = await getSHAForPullRequestEvent(
inputs,
env,
@@ -103,16 +112,27 @@ export async function run(): Promise<void> {
inputs,
workingDirectory
})
core.debug(`File patterns: ${filePatterns}`)
const addedFiles = await getDiffFiles({
inputs,
const allDiffFiles = await getAllDiffFiles({
workingDirectory,
hasSubmodule,
diffResult,
diffFilter: 'A',
filePatterns,
submodulePaths
})
core.debug(`All diff files: ${JSON.stringify(allDiffFiles)}`)
const allFilteredDiffFiles = await getFilteredChangedFiles({
allDiffFiles,
filePatterns
})
core.debug(`All filtered diff files: ${JSON.stringify(allFilteredDiffFiles)}`)
const addedFiles = await getChangeTypeFiles({
inputs,
changedFiles: allFilteredDiffFiles,
changeTypes: [ChangeTypeEnum.Added]
})
core.debug(`Added files: ${addedFiles}`)
await setOutput({
key: 'added_files',
@@ -120,14 +140,10 @@ export async function run(): Promise<void> {
inputs
})
const copiedFiles = await getDiffFiles({
const copiedFiles = await getChangeTypeFiles({
inputs,
workingDirectory,
hasSubmodule,
diffResult,
diffFilter: 'C',
filePatterns,
submodulePaths
changedFiles: allFilteredDiffFiles,
changeTypes: [ChangeTypeEnum.Copied]
})
core.debug(`Copied files: ${copiedFiles}`)
await setOutput({
@@ -136,14 +152,10 @@ export async function run(): Promise<void> {
inputs
})
const modifiedFiles = await getDiffFiles({
const modifiedFiles = await getChangeTypeFiles({
inputs,
workingDirectory,
hasSubmodule,
diffResult,
diffFilter: 'M',
filePatterns,
submodulePaths
changedFiles: allFilteredDiffFiles,
changeTypes: [ChangeTypeEnum.Modified]
})
core.debug(`Modified files: ${modifiedFiles}`)
await setOutput({
@@ -152,14 +164,10 @@ export async function run(): Promise<void> {
inputs
})
const renamedFiles = await getDiffFiles({
const renamedFiles = await getChangeTypeFiles({
inputs,
workingDirectory,
hasSubmodule,
diffResult,
diffFilter: 'R',
filePatterns,
submodulePaths
changedFiles: allFilteredDiffFiles,
changeTypes: [ChangeTypeEnum.Renamed]
})
core.debug(`Renamed files: ${renamedFiles}`)
await setOutput({
@@ -168,14 +176,10 @@ export async function run(): Promise<void> {
inputs
})
const typeChangedFiles = await getDiffFiles({
const typeChangedFiles = await getChangeTypeFiles({
inputs,
workingDirectory,
hasSubmodule,
diffResult,
diffFilter: 'T',
filePatterns,
submodulePaths
changedFiles: allFilteredDiffFiles,
changeTypes: [ChangeTypeEnum.TypeChanged]
})
core.debug(`Type changed files: ${typeChangedFiles}`)
await setOutput({
@@ -184,14 +188,10 @@ export async function run(): Promise<void> {
inputs
})
const unmergedFiles = await getDiffFiles({
const unmergedFiles = await getChangeTypeFiles({
inputs,
workingDirectory,
hasSubmodule,
diffResult,
diffFilter: 'U',
filePatterns,
submodulePaths
changedFiles: allFilteredDiffFiles,
changeTypes: [ChangeTypeEnum.Unmerged]
})
core.debug(`Unmerged files: ${unmergedFiles}`)
await setOutput({
@@ -200,14 +200,10 @@ export async function run(): Promise<void> {
inputs
})
const unknownFiles = await getDiffFiles({
const unknownFiles = await getChangeTypeFiles({
inputs,
workingDirectory,
hasSubmodule,
diffResult,
diffFilter: 'X',
filePatterns,
submodulePaths
changedFiles: allFilteredDiffFiles,
changeTypes: [ChangeTypeEnum.Unknown]
})
core.debug(`Unknown files: ${unknownFiles}`)
await setOutput({
@@ -216,14 +212,9 @@ export async function run(): Promise<void> {
inputs
})
const allChangedAndModifiedFiles = await getDiffFiles({
const allChangedAndModifiedFiles = await getAllChangeTypeFiles({
inputs,
workingDirectory,
hasSubmodule,
diffResult,
diffFilter: 'ACDMRTUX',
filePatterns,
submodulePaths
changedFiles: allFilteredDiffFiles
})
core.debug(`All changed and modified files: ${allChangedAndModifiedFiles}`)
await setOutput({
@@ -232,14 +223,15 @@ export async function run(): Promise<void> {
inputs
})
const allChangedFiles = await getDiffFiles({
const allChangedFiles = await getChangeTypeFiles({
inputs,
workingDirectory,
hasSubmodule,
diffResult,
diffFilter: 'ACMR',
filePatterns,
submodulePaths
changedFiles: allFilteredDiffFiles,
changeTypes: [
ChangeTypeEnum.Added,
ChangeTypeEnum.Copied,
ChangeTypeEnum.Modified,
ChangeTypeEnum.Renamed
]
})
core.debug(`All changed files: ${allChangedFiles}`)
await setOutput({
@@ -254,25 +246,28 @@ export async function run(): Promise<void> {
inputs
})
const allOtherChangedFiles = await getDiffFiles({
const allOtherChangedFiles = await getChangeTypeFiles({
inputs,
workingDirectory,
hasSubmodule,
diffResult,
diffFilter: 'ACMR',
submodulePaths
changedFiles: allDiffFiles,
changeTypes: [
ChangeTypeEnum.Added,
ChangeTypeEnum.Copied,
ChangeTypeEnum.Modified,
ChangeTypeEnum.Renamed
]
})
core.debug(`All other changed files: ${allOtherChangedFiles}`)
const otherChangedFiles = allOtherChangedFiles
.split(inputs.filesSeparator)
.split(inputs.separator)
.filter(
filePath =>
!allChangedFiles.split(inputs.filesSeparator).includes(filePath)
filePath => !allChangedFiles.split(inputs.separator).includes(filePath)
)
const onlyChanged =
otherChangedFiles.length === 0 && allChangedFiles.length > 0
otherChangedFiles.length === 0 &&
allChangedFiles.length > 0 &&
filePatterns.length > 0
await setOutput({
key: 'only_changed',
@@ -282,18 +277,20 @@ export async function run(): Promise<void> {
await setOutput({
key: 'other_changed_files',
value: otherChangedFiles.join(inputs.filesSeparator),
value: otherChangedFiles.join(inputs.separator),
inputs
})
const allModifiedFiles = await getDiffFiles({
const allModifiedFiles = await getChangeTypeFiles({
inputs,
workingDirectory,
hasSubmodule,
diffResult,
diffFilter: 'ACMRD',
filePatterns,
submodulePaths
changedFiles: allFilteredDiffFiles,
changeTypes: [
ChangeTypeEnum.Added,
ChangeTypeEnum.Copied,
ChangeTypeEnum.Modified,
ChangeTypeEnum.Renamed,
ChangeTypeEnum.Deleted
]
})
core.debug(`All modified files: ${allModifiedFiles}`)
await setOutput({
@@ -308,24 +305,28 @@ export async function run(): Promise<void> {
inputs
})
const allOtherModifiedFiles = await getDiffFiles({
const allOtherModifiedFiles = await getChangeTypeFiles({
inputs,
workingDirectory,
hasSubmodule,
diffResult,
diffFilter: 'ACMRD',
submodulePaths
changedFiles: allDiffFiles,
changeTypes: [
ChangeTypeEnum.Added,
ChangeTypeEnum.Copied,
ChangeTypeEnum.Modified,
ChangeTypeEnum.Renamed,
ChangeTypeEnum.Deleted
]
})
const otherModifiedFiles = allOtherModifiedFiles
.split(inputs.filesSeparator)
.split(inputs.separator)
.filter(
filePath =>
!allModifiedFiles.split(inputs.filesSeparator).includes(filePath)
filePath => !allModifiedFiles.split(inputs.separator).includes(filePath)
)
const onlyModified =
otherModifiedFiles.length === 0 && allModifiedFiles.length > 0
otherModifiedFiles.length === 0 &&
allModifiedFiles.length > 0 &&
filePatterns.length > 0
await setOutput({
key: 'only_modified',
@@ -335,18 +336,14 @@ export async function run(): Promise<void> {
await setOutput({
key: 'other_modified_files',
value: otherModifiedFiles.join(inputs.filesSeparator),
value: otherModifiedFiles.join(inputs.separator),
inputs
})
const deletedFiles = await getDiffFiles({
const deletedFiles = await getChangeTypeFiles({
inputs,
workingDirectory,
hasSubmodule,
diffResult,
diffFilter: 'D',
filePatterns,
submodulePaths
changedFiles: allFilteredDiffFiles,
changeTypes: [ChangeTypeEnum.Deleted]
})
core.debug(`Deleted files: ${deletedFiles}`)
await setOutput({
@@ -361,22 +358,22 @@ export async function run(): Promise<void> {
inputs
})
const allOtherDeletedFiles = await getDiffFiles({
const allOtherDeletedFiles = await getChangeTypeFiles({
inputs,
workingDirectory,
hasSubmodule,
diffResult,
diffFilter: 'D',
submodulePaths
changedFiles: allDiffFiles,
changeTypes: [ChangeTypeEnum.Deleted]
})
const otherDeletedFiles = allOtherDeletedFiles
.split(inputs.filesSeparator)
.split(inputs.separator)
.filter(
filePath => !deletedFiles.split(inputs.filesSeparator).includes(filePath)
filePath => !deletedFiles.split(inputs.separator).includes(filePath)
)
const onlyDeleted = otherDeletedFiles.length === 0 && deletedFiles.length > 0
const onlyDeleted =
otherDeletedFiles.length === 0 &&
deletedFiles.length > 0 &&
filePatterns.length > 0
await setOutput({
key: 'only_deleted',
@@ -386,7 +383,7 @@ export async function run(): Promise<void> {
await setOutput({
key: 'other_deleted_files',
value: otherDeletedFiles.join(inputs.filesSeparator),
value: otherDeletedFiles.join(inputs.separator),
inputs
})

View File

@@ -5,6 +5,7 @@ import {createReadStream, promises as fs} from 'fs'
import mm from 'micromatch'
import * as path from 'path'
import {createInterface} from 'readline'
import {ChangedFiles, ChangeTypeEnum} from './changedFiles'
import {Inputs} from './inputs'
@@ -288,7 +289,7 @@ export const getSubmodulePath = async ({
return stdout
.trim()
.split('\n')
.map(line => normalizePath(line.split(' ')[1]))
.map((line: string) => normalizePath(line.split(' ')[1]))
}
export const gitSubmoduleDiffSHA = async ({
@@ -389,7 +390,7 @@ export const gitRenamedFiles = async ({
.trim()
.split('\n')
.filter(Boolean)
.map(line => {
.map((line: string) => {
core.debug(`Renamed file: ${line}`)
const [, oldPath, newPath] = line.split('\t')
if (isSubmodule) {
@@ -403,32 +404,28 @@ export const gitRenamedFiles = async ({
})
}
export const gitDiff = async ({
export const getAllChangedFiles = async ({
cwd,
sha1,
sha2,
diff,
diffFilter,
filePatterns = [],
isSubmodule = false,
parentDir = ''
}: {
cwd: string
sha1: string
sha2: string
diffFilter: string
diff: string
filePatterns?: string[]
isSubmodule?: boolean
parentDir?: string
}): Promise<string[]> => {
}): Promise<ChangedFiles> => {
const {exitCode, stdout, stderr} = await exec.getExecOutput(
'git',
[
'diff',
'--name-only',
'--name-status',
'--ignore-submodules=all',
`--diff-filter=${diffFilter}`,
`--diff-filter=ACDMRTUX`,
`${sha1}${diff}${sha2}`
],
{
@@ -437,6 +434,16 @@ export const gitDiff = async ({
silent: process.env.RUNNER_DEBUG !== '1'
}
)
const changedFiles: ChangedFiles = {
[ChangeTypeEnum.Added]: [],
[ChangeTypeEnum.Copied]: [],
[ChangeTypeEnum.Deleted]: [],
[ChangeTypeEnum.Modified]: [],
[ChangeTypeEnum.Renamed]: [],
[ChangeTypeEnum.TypeChanged]: [],
[ChangeTypeEnum.Unmerged]: [],
[ChangeTypeEnum.Unknown]: []
}
if (exitCode !== 0) {
if (isSubmodule) {
@@ -453,28 +460,60 @@ export const gitDiff = async ({
)
}
return []
return changedFiles
}
const files = stdout
.split('\n')
.filter(Boolean)
.map(p => {
if (isSubmodule) {
return normalizePath(path.join(parentDir, p))
}
return normalizePath(p)
})
const lines = stdout.split('\n').filter(Boolean)
if (filePatterns.length === 0) {
return files
for (const line of lines) {
const [changeType, filePath] = line.split('\t')
const normalizedFilePath = isSubmodule
? normalizePath(path.join(parentDir, filePath))
: normalizePath(filePath)
if (changeType.startsWith('R')) {
changedFiles[ChangeTypeEnum.Renamed].push(normalizedFilePath)
} else {
changedFiles[changeType as ChangeTypeEnum].push(normalizedFilePath)
}
}
return changedFiles
}
export const getFilteredChangedFiles = async ({
allDiffFiles,
filePatterns
}: {
allDiffFiles: ChangedFiles
filePatterns: string[]
}): Promise<ChangedFiles> => {
const changedFiles: ChangedFiles = {
[ChangeTypeEnum.Added]: [],
[ChangeTypeEnum.Copied]: [],
[ChangeTypeEnum.Deleted]: [],
[ChangeTypeEnum.Modified]: [],
[ChangeTypeEnum.Renamed]: [],
[ChangeTypeEnum.TypeChanged]: [],
[ChangeTypeEnum.Unmerged]: [],
[ChangeTypeEnum.Unknown]: []
}
return mm(files, filePatterns, {
dot: true,
windows: IS_WINDOWS,
noext: true
})
for (const changeType of Object.keys(allDiffFiles)) {
const files = allDiffFiles[changeType as ChangeTypeEnum]
const hasFilePatterns = filePatterns.length > 0
if (hasFilePatterns) {
changedFiles[changeType as ChangeTypeEnum] = mm(files, filePatterns, {
dot: true,
windows: IS_WINDOWS,
noext: true
})
} else {
changedFiles[changeType as ChangeTypeEnum] = files
}
}
return changedFiles
}
export const gitLog = async ({
@@ -501,28 +540,23 @@ export const getHeadSha = async ({cwd}: {cwd: string}): Promise<string> => {
return stdout.trim()
}
export const gitLsRemote = async ({
export const getRemoteBranchHeadSha = async ({
cwd,
args
branch
}: {
cwd: string
args: string[]
branch: string
}): Promise<string> => {
const {stdout} = await exec.getExecOutput(
'git',
['ls-remote', 'origin', ...args],
['rev-parse', `origin/${branch}`],
{
cwd,
silent: process.env.RUNNER_DEBUG !== '1'
}
)
const output = stdout.trim().split('\t')
if (output.length === 0) {
throw new Error('No output returned from git ls-remote')
}
return output[0]
return stdout.trim()
}
export const getParentSha = async ({cwd}: {cwd: string}): Promise<string> => {
@@ -647,11 +681,11 @@ export const canDiffCommits = async ({
export const getDirnameMaxDepth = ({
pathStr,
dirNamesMaxDepth,
excludeRoot
excludeCurrentDir
}: {
pathStr: string
dirNamesMaxDepth?: number
excludeRoot?: boolean
excludeCurrentDir?: boolean
}): string => {
const pathArr = dirname(pathStr).split(path.sep)
const maxDepth = Math.min(dirNamesMaxDepth || pathArr.length, pathArr.length)
@@ -661,7 +695,7 @@ export const getDirnameMaxDepth = ({
output = path.join(output, pathArr[i])
}
if (excludeRoot && output === '.') {
if (excludeCurrentDir && output === '.') {
return ''
}
@@ -757,7 +791,23 @@ export const getFilePatterns = async ({
core.debug(`file patterns: ${filePatterns}`)
return filePatterns.trim().split('\n').filter(Boolean)
return filePatterns
.trim()
.split('\n')
.filter(Boolean)
.map(pattern => {
if (pattern.endsWith('/')) {
return `${pattern}**`
} else {
const pathParts = pattern.split('/')
const lastPart = pathParts[pathParts.length - 1]
if (!lastPart.includes('.')) {
return `${pattern}/**`
} else {
return pattern
}
}
})
}
export const setOutput = async ({

View File

@@ -1 +1 @@
This is a test file with non ascii character in the filename.
This is a test file with non ASCII character in the filename.

1360
yarn.lock

File diff suppressed because it is too large Load Diff