Compare commits

...

105 Commits

Author SHA1 Message Date
dependabot[bot]
1c26215f3f chore(deps): bump test/demo from e168fac to f0065d7 (#1481)
Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2023-08-23 22:40:11 +00:00
dependabot[bot]
7b1e1540e2 chore(deps-dev): bump @types/node from 20.5.3 to 20.5.4 (#1480)
Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2023-08-23 21:46:49 +00:00
Tonye Jack
02010edac3 chore: move submodule update to dependabot and remove unused workflow (#1478) 2023-08-23 15:09:57 -06:00
tj-actions[bot]
e4e76943d6 Updated README.md (#1477)
Co-authored-by: jackton1 <jackton1@users.noreply.github.com>
2023-08-23 15:05:35 -06:00
Tonye Jack
569361586a feat: add support for fetching additional history for submodules (#1476)
Co-authored-by: GitHub Action <action@github.com>
2023-08-23 15:04:44 -06:00
renovate[bot]
785218258b chore(deps): lock file maintenance 2023-08-23 05:18:13 +00:00
tj-actions[bot]
0b45bc64c2 Upgraded to v38 (#1474)
Co-authored-by: jackton1 <jackton1@users.noreply.github.com>
2023-08-22 22:59:10 -06:00
Tonye Jack
17f3fec1ed fix: error getting diff for submodules (#1473)
Co-authored-by: GitHub Action <action@github.com>
2023-08-22 22:26:07 -06:00
Tonye Jack
52dbf3e3cf chore: update test (#1469)
Co-authored-by: GitHub Action <action@github.com>
Co-authored-by: repo-ranger[bot] <39074581+repo-ranger[bot]@users.noreply.github.com>
2023-08-23 04:06:23 +00:00
renovate[bot]
0a814e4372 chore(deps): update dependency @types/jest to v29.5.4 (#1472)
Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>
2023-08-22 13:53:55 -06:00
Tonye Jack
fc63326544 fix: bug with locating the previous tag (#1470)
Co-authored-by: GitHub Action <action@github.com>
2023-08-22 13:41:54 -06:00
renovate[bot]
18bacaab15 chore(deps): update dependency @types/node to v20.5.3 (#1467)
Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>
2023-08-22 13:41:13 -06:00
tj-actions[bot]
e8f12786b4 Updated README.md (#1466)
Co-authored-by: repo-ranger[bot] <repo-ranger[bot]@users.noreply.github.com>
2023-08-21 22:42:43 -06:00
Tonye Jack
8789204f97 feat: add support for including matching changed files when dir_names is set to true (#1464)
Co-authored-by: tj-actions[bot] <109116665+tj-actions-bot@users.noreply.github.com>
Co-authored-by: GitHub Action <action@github.com>
2023-08-22 03:11:59 +00:00
Tonye Jack
819fb64520 chore: update .eslintrc.json (#1465) 2023-08-21 16:11:26 -06:00
renovate[bot]
31003b45e6 chore(deps): update typescript-eslint monorepo to v6.4.1 (#1463)
Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>
2023-08-21 19:33:34 +00:00
renovate[bot]
1f04b16682 chore(deps): update dependency jest to v29.6.3 (#1462)
Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>
2023-08-21 16:43:07 +00:00
renovate[bot]
0a8b04e3e3 chore(deps): lock file maintenance (#1461)
Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>
Co-authored-by: GitHub Action <action@github.com>
2023-08-21 01:48:26 +00:00
Tonye Jack
f8b4039d96 Update README.md 2023-08-18 19:52:10 -06:00
renovate[bot]
6da496e2f9 chore(deps): update dependency @types/node to v20.5.1 (#1460)
Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>
2023-08-18 19:53:36 +00:00
renovate[bot]
68d38a3f16 chore(deps): update actions/setup-node action to v3.8.1 (#1459)
Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>
2023-08-17 17:55:12 +00:00
Tonye Jack
0e8eddfd8c Update README.md 2023-08-16 19:09:51 -06:00
tj-actions[bot]
3645cf9fc3 Upgraded to v37.6.1 (#1458)
Co-authored-by: jackton1 <jackton1@users.noreply.github.com>
2023-08-16 16:45:15 +00:00
renovate[bot]
a0585ff990 chore(deps): update dependency prettier to v3.0.2 (#1457)
Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>
Co-authored-by: GitHub Action <action@github.com>
2023-08-15 17:37:46 +00:00
renovate[bot]
ec3a2a3b3b chore(deps): update typescript-eslint monorepo to v6.4.0 (#1456)
Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>
2023-08-14 19:38:44 +00:00
renovate[bot]
24e2a6fb86 chore(deps): update actions/setup-node action to v3.8.0 (#1455)
Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>
2023-08-14 13:22:55 +00:00
renovate[bot]
1144bc6587 chore(deps): lock file maintenance (#1454)
Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>
2023-08-14 02:32:29 +00:00
renovate[bot]
fa84d9471e chore(deps): update dependency @types/node to v20.5.0 (#1453)
Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>
2023-08-13 21:41:48 +00:00
renovate[bot]
71dfd0dc2e chore(deps): update dependency @types/node to v20.4.10 (#1452)
Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>
2023-08-11 20:07:54 +00:00
renovate[bot]
b941520afb chore(deps): update dependency eslint to v8.47.0 (#1451)
Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>
2023-08-11 17:39:21 +00:00
renovate[bot]
be110124f6 chore(deps): lock file maintenance (#1450)
Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>
2023-08-11 04:48:12 +00:00
Tonye Jack
927363397d Update README.md 2023-08-09 18:30:47 -06:00
renovate[bot]
9dc097cfe5 chore(deps): update dependency @types/lodash to v4.14.197 (#1446)
Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>
2023-08-09 23:12:12 +00:00
renovate[bot]
e3b0c8a681 chore(deps): update dependency @types/node to v20.4.9 (#1444)
Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>
2023-08-08 22:05:23 +00:00
Tonye Jack
a62be95af3 chore: fix typo 2023-08-08 10:15:34 -06:00
Tonye Jack
a2e707696a Update README.md 2023-08-08 10:14:26 -06:00
renovate[bot]
f267068b02 chore(deps): update typescript-eslint monorepo to v6.3.0 (#1442)
Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>
2023-08-07 18:34:07 +00:00
tj-actions[bot]
7f0849be06 Upgraded to v37.6.0 (#1441)
Co-authored-by: jackton1 <jackton1@users.noreply.github.com>
2023-08-07 06:28:07 +00:00
Tonye Jack
87697c0dca chore: improve test coverage (#1440) 2023-08-07 00:05:28 -06:00
Tonye Jack
0acc1c308e chore: simplify code (#1439)
Co-authored-by: GitHub Action <action@github.com>
2023-08-07 00:00:11 -06:00
renovate[bot]
312a3d8003 chore(deps): lock file maintenance (#1438)
Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>
2023-08-07 02:10:23 +00:00
renovate[bot]
701bae514b chore(deps): update dependency @types/node to v20.4.8 (#1425)
Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>
2023-08-05 14:14:56 +00:00
renovate[bot]
8bffb974e4 chore(deps): lock file maintenance (#1437)
Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>
Co-authored-by: GitHub Action <action@github.com>
2023-08-05 07:48:00 +00:00
Tonye Jack
d4e6e22e93 feat: improve checking local branch history (#1436)
Co-authored-by: GitHub Action <action@github.com>
2023-08-05 06:26:02 +00:00
Tonye Jack
1e9cd5f299 Update README.md 2023-08-04 23:50:03 -06:00
Tonye Jack
29022e81a4 test: improve test coverage (#1435)
Co-authored-by: tj-actions[bot] <109116665+tj-actions-bot@users.noreply.github.com>
2023-08-04 23:04:46 -06:00
Tonye Jack
6b028b6303 Update README.md 2023-08-04 12:32:36 -06:00
dependabot[bot]
f76208237d chore(deps-dev): bump @types/node from 20.4.6 to 20.4.7 (#1433)
Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2023-08-04 01:31:33 +00:00
tj-actions[bot]
b61db7817f Updated README.md (#1432)
Co-authored-by: jackton1 <jackton1@users.noreply.github.com>
2023-08-03 16:17:03 -06:00
Tonye Jack
6a48a0a018 Update README.md 2023-08-03 16:16:10 -06:00
Tonye Jack
3415802ae9 Update README.md 2023-08-03 16:14:44 -06:00
Tonye Jack
20a19b977f Update README.md 2023-08-03 16:11:38 -06:00
Tonye Jack
10228bf07b Update README.md 2023-08-03 16:01:27 -06:00
tj-actions[bot]
24ac45c74e Upgraded to v37.5.2 (#1431)
Co-authored-by: jackton1 <jackton1@users.noreply.github.com>
2023-08-03 14:31:15 -06:00
Tonye Jack
85c8b8252f chore: improve test coverage (#1430)
Co-authored-by: GitHub Action <action@github.com>
Co-authored-by: repo-ranger[bot] <39074581+repo-ranger[bot]@users.noreply.github.com>
2023-08-03 13:25:35 -06:00
Tonye Jack
948fd1aec0 Update README.md 2023-08-03 13:24:56 -06:00
renovate[bot]
213a6fbf71 chore(deps): update dependency prettier to v3.0.1 (#1428)
Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>
2023-08-03 09:12:04 +00:00
renovate[bot]
c089e392a9 chore(deps): lock file maintenance (#1427)
Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>
2023-08-03 02:51:06 +00:00
dependabot[bot]
387fa91a19 chore(deps-dev): bump @types/node from 20.4.5 to 20.4.6 (#1426)
Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2023-08-03 02:06:04 +00:00
Tonye Jack
bde04d3ec6 Update README.md 2023-08-01 11:03:13 -06:00
renovate[bot]
ce7dceac93 chore(deps): lock file maintenance (#1424)
Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>
2023-08-01 13:50:52 +00:00
renovate[bot]
18832c2f0d chore(deps): lock file maintenance (#1423)
Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>
2023-08-01 02:33:46 +00:00
Tonye Jack
3fdcd6b1fa Update README.md 2023-07-31 17:44:57 -06:00
renovate[bot]
2b564ea543 chore(deps): update typescript-eslint monorepo to v6.2.1 (#1422)
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-31 19:04:38 +00:00
Tonye Jack
6b62acfc40 Update README.md 2023-07-31 12:36:37 -06:00
renovate[bot]
62411c0bbf chore(deps): lock file maintenance (#1421)
Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>
2023-07-31 00:27:03 +00:00
tj-actions[bot]
c10ebdc85f Updated README.md (#1420)
Co-authored-by: jackton1 <jackton1@users.noreply.github.com>
2023-07-30 01:55:31 +00:00
Tonye Jack
1b00b76bc1 Update README.md 2023-07-29 19:40:28 -06:00
renovate[bot]
8ffb34e4db chore(deps): lock file maintenance (#1419)
Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>
2023-07-29 05:29:21 +00:00
tj-actions[bot]
81ce706243 Upgraded to v37.5.1 (#1418)
Co-authored-by: jackton1 <jackton1@users.noreply.github.com>
2023-07-28 22:41:29 +00:00
renovate[bot]
a96679dfee chore(deps): update dependency eslint to v8.46.0 (#1417)
Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>
2023-07-28 19:34:23 +00:00
renovate[bot]
0c659577d4 chore(deps): lock file maintenance (#1416)
Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>
2023-07-27 18:23:35 +00:00
renovate[bot]
ea41e77287 chore(deps): update dependency jest to v29.6.2 (#1415)
Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>
2023-07-27 10:07:05 +00:00
Tonye Jack
ca51c3f430 Update README.md 2023-07-26 17:19:03 -06:00
Tonye Jack
5716c6246f Update README.md 2023-07-26 11:14:14 -06:00
Tonye Jack
f6edf885b4 Update README.md 2023-07-26 11:13:06 -06:00
renovate[bot]
4acaa728bb chore(deps): update dependency @types/lodash to v4.14.196 (#1413)
Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>
2023-07-26 00:22:46 +00:00
Tonye Jack
331d2daf96 Update README.md 2023-07-25 17:08:04 -06:00
tj-actions[bot]
174b246d44 Updated README.md (#1412)
Co-authored-by: jackton1 <jackton1@users.noreply.github.com>
2023-07-25 17:06:54 -06:00
Tonye Jack
0bf83955a9 Update README.md 2023-07-25 17:05:23 -06:00
Tonye Jack
69c6091ee4 Update README.md 2023-07-25 17:05:08 -06:00
renovate[bot]
cf02ab960f chore(deps): update dependency @types/node to v20.4.5 (#1409)
Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>
2023-07-25 20:43:43 +00:00
renovate[bot]
b50d1ab2d1 chore(deps): lock file maintenance (#1408)
Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>
2023-07-25 13:25:55 +00:00
Tonye Jack
ba9054e8d5 Update README.md 2023-07-24 21:58:54 -06:00
Tonye Jack
7e9cc01c54 Update README.md 2023-07-24 21:27:04 -06:00
tj-actions[bot]
0f52c861db Upgraded to v37.5.0 (#1407)
Co-authored-by: jackton1 <jackton1@users.noreply.github.com>
2023-07-24 23:40:13 +00:00
renovate[bot]
920e7b9ae1 chore(deps): lock file maintenance (#1406)
Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>
2023-07-24 22:25:33 +00:00
Tonye Jack
b8e577a274 feat: add support to detect changes for merge group event (#1404)
Co-authored-by: GitHub Action <action@github.com>
2023-07-24 21:40:48 +00:00
Tonye Jack
fc3c551a67 fix: error fetch more history for release events (#1403)
Co-authored-by: GitHub Action <action@github.com>
2023-07-24 20:34:13 +00:00
renovate[bot]
797a722244 chore(deps): update typescript-eslint monorepo to v6.2.0 (#1402)
Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>
2023-07-24 19:57:17 +00:00
renovate[bot]
44790ad9d8 chore(deps): lock file maintenance (#1401)
Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>
Co-authored-by: GitHub Action <action@github.com>
2023-07-24 00:48:28 +00:00
Tonye Jack
73d266fe29 Update package.json 2023-07-23 13:32:41 -06:00
Tonye Jack
e1ddf02aff Update package.json 2023-07-23 13:31:48 -06:00
Tonye Jack
66d62c97d5 chore: update package.json 2023-07-23 13:30:24 -06:00
renovate[bot]
d44a61ef33 chore(deps): update dependency @types/node to v20.4.4 (#1400)
Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>
2023-07-22 16:16:14 +00:00
renovate[bot]
ef59201f02 chore(deps): update dependency @types/node to v20.4.3 (#1399)
Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>
2023-07-22 01:40:03 +00:00
Tonye Jack
f5439803c2 Update README.md 2023-07-20 18:20:09 -06:00
Tonye Jack
a0a0be0376 Update README.md 2023-07-20 13:54:41 -06:00
tj-actions[bot]
48ce5846c9 Upgraded to v37.4.0 (#1397)
Co-authored-by: jackton1 <jackton1@users.noreply.github.com>
2023-07-20 18:43:39 +00:00
Tonye Jack
de0eba3279 feat: update error handling for yaml inputs (#1395)
Co-authored-by: GitHub Action <action@github.com>
2023-07-20 18:05:55 +00:00
Tonye Jack
bc262c2f61 Update README.md 2023-07-20 11:41:44 -06:00
Tonye Jack
d4389f0f4f Update README.md 2023-07-20 06:48:41 -06:00
tj-actions[bot]
79984462e1 Updated README.md (#1394)
Co-authored-by: jackton1 <jackton1@users.noreply.github.com>
2023-07-19 17:08:30 -06:00
Tonye Jack
c6dcc2a013 Update action.yml 2023-07-19 17:07:28 -06:00
tj-actions[bot]
e6dde3c065 Upgraded to v37.3.0 (#1392)
Co-authored-by: jackton1 <jackton1@users.noreply.github.com>
2023-07-19 08:19:57 +00:00
20 changed files with 2862 additions and 1228 deletions

View File

@@ -1,4 +1,5 @@
dist/
lib/
node_modules/
jest.config.js
jest.config.js
coverage/

View File

@@ -5,7 +5,8 @@
"github"
],
"extends": [
"plugin:github/recommended"
"plugin:github/recommended",
"plugin:prettier/recommended"
],
"parser": "@typescript-eslint/parser",
"parserOptions": {

View File

@@ -15,3 +15,10 @@ updates:
open-pull-requests-limit: 10
labels:
- "merge when passing"
- package-ecosystem: gitsubmodule
directory: /
schedule:
interval: daily
open-pull-requests-limit: 10
labels:
- "merge when passing"

View File

@@ -1,29 +0,0 @@
on:
workflow_dispatch:
jobs:
sync:
name: Submodule Sync
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v3
with:
fetch-depth: 0
submodules: recursive
- name: Git Sumbodule Update
run: |
git pull --recurse-submodules
git submodule update --remote --recursive
- name: Create Pull Request
uses: peter-evans/create-pull-request@v5.0.2
with:
title: "Updated submodule"
labels: "merge when passing"
branch: "chore/update-submodule"
commit-message: "Updated submodule"
body: "Updated submodule"
token: ${{ secrets.PAT_TOKEN }}

View File

@@ -43,6 +43,8 @@ jobs:
build:
runs-on: ubuntu-latest
outputs:
files_changed: ${{ steps.changed_files.outputs.files_changed }}
steps:
- uses: actions/checkout@v3
with:
@@ -51,7 +53,7 @@ jobs:
repository: ${{ github.event.pull_request.head.repo.full_name }}
- name: Use Node.js 16.x
uses: actions/setup-node@v3.7.0
uses: actions/setup-node@v3.8.1
with:
cache: 'yarn'
node-version: '16.x'
@@ -80,7 +82,6 @@ jobs:
- name: Verify Changed files
uses: tj-actions/verify-changed-files@v16
id: changed_files
if: github.event_name == 'pull_request'
with:
files: |
src
@@ -119,6 +120,7 @@ jobs:
name: Test with multiple repositories
runs-on: ubuntu-latest
needs: build
if: needs.build.outputs.files_changed != 'true'
steps:
- name: Checkout into dir1
uses: actions/checkout@v3
@@ -192,7 +194,7 @@ jobs:
name: Test changed-files using since and until
needs: build
runs-on: ubuntu-latest
if: github.event_name == 'push'
if: github.event_name == 'push' && needs.build.outputs.files_changed != 'true'
steps:
- name: Checkout branch
@@ -250,6 +252,7 @@ jobs:
name: Test changed-files similar base and commit sha
runs-on: ubuntu-latest
needs: build
if: needs.build.outputs.files_changed != 'true'
steps:
- name: Checkout branch
@@ -287,6 +290,7 @@ jobs:
name: Test unset GITHUB_OUTPUT env
runs-on: ubuntu-latest
needs: build
if: needs.build.outputs.files_changed != 'true'
steps:
- name: Checkout branch
@@ -317,6 +321,8 @@ jobs:
name: Test changed-files with limited commit history
runs-on: ubuntu-latest
needs: build
if: needs.build.outputs.files_changed != 'true'
strategy:
fail-fast: false
max-parallel: 4
@@ -354,7 +360,7 @@ jobs:
name: Test changed-files with pull request head ref
runs-on: ubuntu-latest
needs: build
if: github.event_name != 'push'
if: github.event_name != 'push' && needs.build.outputs.files_changed != 'true'
steps:
- name: Checkout branch
@@ -381,7 +387,7 @@ jobs:
name: Test changed-files with pull request without persist credentials
runs-on: ubuntu-latest
needs: build
if: github.event_name != 'push'
if: github.event_name != 'push' && needs.build.outputs.files_changed != 'true'
strategy:
fail-fast: false
max-parallel: 4
@@ -415,6 +421,7 @@ jobs:
name: Test changed-files non existent base sha
runs-on: ubuntu-latest
needs: build
if: needs.build.outputs.files_changed != 'true'
steps:
- name: Checkout branch
@@ -468,6 +475,7 @@ jobs:
name: Test changed-files non existent sha
runs-on: ubuntu-latest
needs: build
if: needs.build.outputs.files_changed != 'true'
steps:
- name: Checkout branch
@@ -521,7 +529,7 @@ jobs:
name: Test changed-files with REST API
runs-on: ubuntu-latest
needs: build
if: github.event_name != 'push'
if: github.event_name != 'push' && needs.build.outputs.files_changed != 'true'
permissions:
pull-requests: read
steps:
@@ -553,6 +561,7 @@ jobs:
name: Test changed-files with submodule
runs-on: ubuntu-latest
needs: build
if: needs.build.outputs.files_changed != 'true'
strategy:
fail-fast: false
max-parallel: 4
@@ -595,6 +604,7 @@ jobs:
name: Test changed-files with yaml
runs-on: ubuntu-latest
needs: build
if: needs.build.outputs.files_changed != 'true'
strategy:
fail-fast: false
max-parallel: 4
@@ -646,6 +656,7 @@ jobs:
name: Test changed-files recover deleted file
runs-on: ubuntu-latest
needs: build
if: needs.build.outputs.files_changed != 'true'
strategy:
fail-fast: false
max-parallel: 4
@@ -799,11 +810,12 @@ jobs:
name: Test changed-files
runs-on: ${{ matrix.platform }}
needs: build
if: needs.build.outputs.files_changed != 'true'
strategy:
fail-fast: false
max-parallel: 4
matrix:
platform: [ubuntu-latest, ubuntu-22.04, windows-latest, macos-latest, macos-11, windows-2022]
platform: [ubuntu-latest, macos-latest, windows-latest]
fetch-depth: [0, 1, 2]
steps:
@@ -920,13 +932,20 @@ jobs:
echo '${{ toJSON(steps.changed-files-dir-names-max-depth.outputs) }}'
shell:
bash
- name: Check dir_names output
if: "!contains(steps.changed-files-dir-names-max-depth.outputs.all_changed_files, 'test/test2/test3')"
- name: Check dir_names output on non windows platform
if: "!contains(steps.changed-files-dir-names-max-depth.outputs.all_changed_files, 'test/test2/test3') && runner.os != 'Windows'"
run: |
echo "Invalid output: Expected to include (test/test2/test3) got (${{ steps.changed-files-dir-names-max-depth.outputs.all_changed_files }})"
exit 1
shell:
bash
- name: Check dir_names output on windows platform
if: "!contains(steps.changed-files-dir-names-max-depth.outputs.all_changed_files, 'test\\test2\\test3') && runner.os == 'Windows'"
run: |
echo "Invalid output: Expected to not include (test\\test2\\test3) got (${{ steps.changed-files-dir-names-max-depth.outputs.all_changed_files }})"
exit 1
shell:
bash
- name: Run changed-files with dir_names and dir_names_exclude_current_dir
id: changed-files-dir-names-exclude-root
uses: ./
@@ -936,7 +955,7 @@ jobs:
fetch_depth: 60000
dir_names: "true"
dir_names_exclude_current_dir: "true"
dir_names_max_depth: "1"
dir_names_max_depth: 1
- name: Show output
run: |
echo '${{ toJSON(steps.changed-files-dir-names-exclude-root.outputs) }}'
@@ -976,7 +995,7 @@ jobs:
base_sha: d1c0ee4
sha: 4d04215
fetch_depth: 60000
dir_names: "true"
dir_names: true
files: test/**
- name: Show output
run: |
@@ -984,12 +1003,50 @@ jobs:
shell:
bash
- name: Check dir_names output
if: steps.changed-files-dir-names.outputs.all_changed_files != 'test'
if: steps.changed-files-dir-names-specific.outputs.all_changed_files != 'test'
run: |
echo "Invalid output: Expected (test) got (${{ steps.changed-files-dir-names-specific.outputs.all_changed_files }})"
exit 1
shell:
bash
- name: Run changed-files with dir_names and dir_names_include_files with specific files
id: changed-files-dir-names-specific-include-files
uses: ./
with:
base_sha: d1c0ee4
sha: 4d04215
fetch_depth: 60000
dir_names: true
dir_names_include_files: test/*.txt
files: test/**
json: true
- name: Show output
run: |
echo '${{ toJSON(steps.changed-files-dir-names-specific-include-files.outputs) }}'
shell:
bash
- name: Check dir_names output on non windows platform
if: |
(
!contains(steps.changed-files-dir-names-specific-include-files.outputs.all_changed_files, 'test/test rename-1.txt') ||
!contains(steps.changed-files-dir-names-specific-include-files.outputs.all_changed_files, 'test')
) && runner.os != 'Windows'
run: |
echo "Invalid output: Expected to include (test/test rename-1.txt) and (test) got (${{ steps.changed-files-dir-names-specific-include-files.outputs.all_changed_files }})"
exit 1
shell:
bash
- name: Check dir_names output on windows platform
if: |
(
!contains(steps.changed-files-dir-names-specific-include-files.outputs.all_changed_files, 'test\\test rename-1.txt') ||
!contains(steps.changed-files-dir-names-specific-include-files.outputs.all_changed_files, 'test')
) && runner.os == 'Windows'
run: |
echo "Invalid output: Expected to include (test\\test rename-1.txt) and (test) got (${{ steps.changed-files-dir-names-specific-include-files.outputs.all_changed_files }})"
exit 1
shell:
bash
- name: Run changed-files with forward slash separator
id: changed-files-forward-slash
uses: ./
@@ -1087,20 +1144,34 @@ jobs:
echo '${{ toJSON(steps.changed-files-all-old-new-renamed-files-1.outputs) }}'
shell:
bash
- name: Check all_old_new_renamed_files output
if: "!contains(steps.changed-files-all-old-new-renamed-files-1.outputs.all_old_new_renamed_files, 'test/test rename 1.txt,test/test rename-1.txt')"
- name: Check all_old_new_renamed_files output on non windows platform
if: "!contains(steps.changed-files-all-old-new-renamed-files-1.outputs.all_old_new_renamed_files, 'test/test rename 1.txt,test/test rename-1.txt') && runner.os != 'Windows'"
run: |
echo "Invalid output: Expected to include (test/test rename 1.txt,test/test rename-1.txt) got (${{ steps.changed-files-all-old-new-renamed-files-1.outputs.all_old_new_renamed_files }})"
exit 1
shell:
bash
- name: Check the renamed_files output
if: "!contains(steps.changed-files-all-old-new-renamed-files-1.outputs.renamed_files, 'test/test rename-1.txt')"
- name: Check all_old_new_renamed_files output on windows platform
if: "!contains(steps.changed-files-all-old-new-renamed-files-1.outputs.all_old_new_renamed_files, 'test\\test rename 1.txt,test\\test rename-1.txt') && runner.os == 'Windows'"
run: |
echo "Invalid output: Expected to not include (test\\test rename 1.txt,test\\test rename-1.txt) got (${{ steps.changed-files-all-old-new-renamed-files-1.outputs.all_old_new_renamed_files }})"
exit 1
shell:
bash
- name: Check the renamed_files output on non windows platform
if: "!contains(steps.changed-files-all-old-new-renamed-files-1.outputs.renamed_files, 'test/test rename-1.txt') && runner.os != 'Windows'"
run: |
echo "Invalid output: Expected to include (test/test rename-1.txt) got (${{ steps.changed-files-all-old-new-renamed-files-1.outputs.renamed_files }})"
exit 1
shell:
bash
- name: Check the renamed_files output on windows platform
if: "!contains(steps.changed-files-all-old-new-renamed-files-1.outputs.renamed_files, 'test\\test rename-1.txt') && runner.os == 'Windows'"
run: |
echo "Invalid output: Expected to not include (test\\test rename-1.txt) got (${{ steps.changed-files-all-old-new-renamed-files-1.outputs.renamed_files }})"
exit 1
shell:
bash
- name: Run changed-files for old new filenames test rename 2
id: changed-files-all-old-new-renamed-files-2
uses: ./
@@ -1114,20 +1185,34 @@ jobs:
echo '${{ toJSON(steps.changed-files-all-old-new-renamed-files-2.outputs) }}'
shell:
bash
- name: Check all_old_new_renamed_files output
if: "!contains(steps.changed-files-all-old-new-renamed-files-2.outputs.all_old_new_renamed_files, 'test/test rename 2.txt,test/test rename-2.txt')"
- name: Check all_old_new_renamed_files output on non windows platform
if: "!contains(steps.changed-files-all-old-new-renamed-files-2.outputs.all_old_new_renamed_files, 'test/test rename 2.txt,test/test rename-2.txt') && runner.os != 'Windows'"
run: |
echo "Invalid output: Expected to include (test/test rename 2.txt test/test rename-2.txt) got (${{ steps.changed-files-all-old-new-renamed-files-2.outputs.all_old_new_renamed_files }})"
exit 1
shell:
bash
- name: Check the renamed_files output
if: "!contains(steps.changed-files-all-old-new-renamed-files-2.outputs.renamed_files, 'test/test rename-2.txt')"
- name: Check all_old_new_renamed_files output on windows platform
if: "!contains(steps.changed-files-all-old-new-renamed-files-2.outputs.all_old_new_renamed_files, 'test\\test rename 2.txt,test\\test rename-2.txt') && runner.os == 'Windows'"
run: |
echo "Invalid output: Expected to not include (test\\test rename 2.txt test/test rename-2.txt) got (${{ steps.changed-files-all-old-new-renamed-files-2.outputs.all_old_new_renamed_files }})"
exit 1
shell:
bash
- name: Check the renamed_files output on non windows platform
if: "!contains(steps.changed-files-all-old-new-renamed-files-2.outputs.renamed_files, 'test/test rename-2.txt') && runner.os != 'Windows'"
run: |
echo "Invalid output: Expected to include (test/test rename-2.txt) got (${{ steps.changed-files-all-old-new-renamed-files-2.outputs.renamed_files }})"
exit 1
shell:
bash
- name: Check the renamed_files output on windows platform
if: "!contains(steps.changed-files-all-old-new-renamed-files-2.outputs.renamed_files, 'test\\test rename-2.txt') && runner.os == 'Windows'"
run: |
echo "Invalid output: Expected to not include (test\\test rename-2.txt) got (${{ steps.changed-files-all-old-new-renamed-files-2.outputs.renamed_files }})"
exit 1
shell:
bash
- name: Run changed-files for old new filenames test rename 2 output as deleted and added
id: changed-files-all-old-new-renamed-files-2-output-as-deleted-and-added
uses: ./
@@ -1142,27 +1227,48 @@ jobs:
echo '${{ toJSON(steps.changed-files-all-old-new-renamed-files-2-output-as-deleted-and-added.outputs) }}'
shell:
bash
- name: Check all_old_new_renamed_files output
if: "!contains(steps.changed-files-all-old-new-renamed-files-2-output-as-deleted-and-added.outputs.all_old_new_renamed_files, 'test/test rename 2.txt,test/test rename-2.txt')"
- name: Check all_old_new_renamed_files output on non windows platform
if: "!contains(steps.changed-files-all-old-new-renamed-files-2-output-as-deleted-and-added.outputs.all_old_new_renamed_files, 'test/test rename 2.txt,test/test rename-2.txt') && runner.os != 'Windows'"
run: |
echo "Invalid output: Expected to include (test/test rename 2.txt test/test rename-2.txt) got (${{ steps.changed-files-all-old-new-renamed-files-2-output-as-deleted-and-added.outputs.all_old_new_renamed_files }})"
exit 1
shell:
bash
- name: Check deleted_files output
if: "!contains(steps.changed-files-all-old-new-renamed-files-2-output-as-deleted-and-added.outputs.deleted_files, 'test/test rename 2.txt')"
- name: Check all_old_new_renamed_files output on windows platform
if: "!contains(steps.changed-files-all-old-new-renamed-files-2-output-as-deleted-and-added.outputs.all_old_new_renamed_files, 'test\\test rename 2.txt,test\\test rename-2.txt') && runner.os == 'Windows'"
run: |
echo "Invalid output: Expected to not include (test\\test rename 2.txt test\\test rename-2.txt) got (${{ steps.changed-files-all-old-new-renamed-files-2-output-as-deleted-and-added.outputs.all_old_new_renamed_files }})"
exit 1
shell:
bash
- name: Check deleted_files output on non windows platform
if: "!contains(steps.changed-files-all-old-new-renamed-files-2-output-as-deleted-and-added.outputs.deleted_files, 'test/test rename 2.txt') && runner.os != 'Windows'"
run: |
echo "Invalid output: Expected to include (test/test rename 2.txt) got (${{ steps.changed-files-all-old-new-renamed-files-2-output-as-deleted-and-added.outputs.deleted_files }})"
exit 1
shell:
bash
- name: Check added_files output
if: "!contains(steps.changed-files-all-old-new-renamed-files-2-output-as-deleted-and-added.outputs.added_files, 'test/test rename-2.txt')"
- name: Check deleted_files output on windows platform
if: "!contains(steps.changed-files-all-old-new-renamed-files-2-output-as-deleted-and-added.outputs.deleted_files, 'test\\test rename 2.txt') && runner.os == 'Windows'"
run: |
echo "Invalid output: Expected to not include (test\\test rename 2.txt) got (${{ steps.changed-files-all-old-new-renamed-files-2-output-as-deleted-and-added.outputs.deleted_files }})"
exit 1
shell:
bash
- name: Check added_files output on non windows platform
if: "!contains(steps.changed-files-all-old-new-renamed-files-2-output-as-deleted-and-added.outputs.added_files, 'test/test rename-2.txt') && runner.os != 'Windows'"
run: |
echo "Invalid output: Expected to include (test/test rename-2.txt) got (${{ steps.changed-files-all-old-new-renamed-files-2-output-as-deleted-and-added.outputs.added_files }})"
exit 1
shell:
bash
- name: Check added_files output on windows platform
if: "!contains(steps.changed-files-all-old-new-renamed-files-2-output-as-deleted-and-added.outputs.added_files, 'test\\test rename-2.txt') && runner.os == 'Windows'"
run: |
echo "Invalid output: Expected to not include (test\\test rename-2.txt) got (${{ steps.changed-files-all-old-new-renamed-files-2-output-as-deleted-and-added.outputs.added_files }})"
exit 1
shell:
bash
- name: Run changed-files with specific files
id: changed-files-specific
uses: ./
@@ -1178,15 +1284,22 @@ jobs:
echo '${{ toJSON(steps.changed-files-specific.outputs) }}'
shell:
bash
- name: Check if a excluded file is not included in any_changed
if: "contains(steps.changed-files-specific.outputs.all_changed_files, 'test/test/test.txt')"
- name: Check if a excluded file is not included in any_changed on non windows platform
if: "contains(steps.changed-files-specific.outputs.all_changed_files, 'test/test/test.txt') && runner.os != 'Windows'"
run: |
echo "Invalid output: Expected not to include (test/test/test.txt) got (${{ steps.changed-files-specific.outputs.all_changed_files }})"
exit 1
shell:
bash
- name: Verify any_changed for specific files
if: "!contains(steps.changed-files-specific.outputs.all_changed_files, 'action.yml') && !contains(steps.changed-files-specific.outputs.all_changed_files, '.github/workflows/test.yml') && !contains(steps.changed-files-specific.outputs.all_changed_files, 'test/test.txt')"
- name: Check if a excluded file is not included in any_changed on windows platform
if: "contains(steps.changed-files-specific.outputs.all_changed_files, 'test\\test\\test.txt') && runner.os == 'Windows'"
run: |
echo "Invalid output: Expected not to include (test\\test\\test.txt) got (${{ steps.changed-files-specific.outputs.all_changed_files }})"
exit 1
shell:
bash
- name: Verify any_changed for specific files on non windows platform
if: "!contains(steps.changed-files-specific.outputs.all_changed_files, 'action.yml') && !contains(steps.changed-files-specific.outputs.all_changed_files, '.github/workflows/test.yml') && !contains(steps.changed-files-specific.outputs.all_changed_files, 'test/test.txt') && runner.os != 'Windows'"
run: |
if [[ "${{ steps.changed-files-specific.outputs.any_changed }}" != "false" ]]; then
echo "Invalid output: Expected (false) got (${{ steps.changed-files-specific.outputs.any_changed }})"
@@ -1194,15 +1307,31 @@ jobs:
fi
shell:
bash
- name: Check if a excluded file is not included in any_modified
if: "contains(steps.changed-files-specific.outputs.all_modified_files, 'test/test/test.txt')"
- name: Verify any_changed for specific files on windows platform
if: "!contains(steps.changed-files-specific.outputs.all_changed_files, 'action.yml') && !contains(steps.changed-files-specific.outputs.all_changed_files, '.github\\workflows\\test.yml') && !contains(steps.changed-files-specific.outputs.all_changed_files, 'test\\test.txt') && runner.os == 'Windows'"
run: |
if [[ "${{ steps.changed-files-specific.outputs.any_changed }}" != "false" ]]; then
echo "Invalid output: Expected (false) got (${{ steps.changed-files-specific.outputs.any_changed }})"
exit 1
fi
shell:
bash
- name: Check if a excluded file is not included in any_modified on non windows platform
if: "contains(steps.changed-files-specific.outputs.all_modified_files, 'test/test/test.txt') && runner.os != 'Windows'"
run: |
echo "Invalid output: Expected not to include (test/test/test.txt) got (${{ steps.changed-files-specific.outputs.all_modified_files }})"
exit 1
shell:
bash
- name: Verify any_modified for specific files
if: "!contains(steps.changed-files-specific.outputs.all_modified_files, 'action.yml') && !contains(steps.changed-files-specific.outputs.all_modified_files, '.github/workflows/test.yml') && !contains(steps.changed-files-specific.outputs.all_modified_files, 'test/test.txt')"
- name: Check if a excluded file is not included in any_modified on windows platform
if: "contains(steps.changed-files-specific.outputs.all_modified_files, 'test\\test\\test.txt') && runner.os == 'Windows'"
run: |
echo "Invalid output: Expected not to include (test\\test\\test.txt) got (${{ steps.changed-files-specific.outputs.all_modified_files }})"
exit 1
shell:
bash
- name: Verify any_modified for specific files on non windows platform
if: "!contains(steps.changed-files-specific.outputs.all_modified_files, 'action.yml') && !contains(steps.changed-files-specific.outputs.all_modified_files, '.github/workflows/test.yml') && !contains(steps.changed-files-specific.outputs.all_modified_files, 'test/test.txt') && runner.os != 'Windows'"
run: |
if [[ "${{ steps.changed-files-specific.outputs.any_modified }}" != "false" ]]; then
echo "Invalid output: Expected (false) got (${{ steps.changed-files-specific.outputs.any_modified }})"
@@ -1210,15 +1339,40 @@ jobs:
fi
shell:
bash
- name: Check if a excluded file is not included in any_deleted
if: "contains(steps.changed-files-specific.outputs.deleted_files, 'test/test/test.txt')"
- name: Verify any_modified for specific files on windows platform
if: "!contains(steps.changed-files-specific.outputs.all_modified_files, 'action.yml') && !contains(steps.changed-files-specific.outputs.all_modified_files, '.github\\workflows\\test.yml') && !contains(steps.changed-files-specific.outputs.all_modified_files, 'test\\test.txt') && runner.os == 'Windows'"
run: |
if [[ "${{ steps.changed-files-specific.outputs.any_modified }}" != "false" ]]; then
echo "Invalid output: Expected (false) got (${{ steps.changed-files-specific.outputs.any_modified }})"
exit 1
fi
shell:
bash
- name: Check if a excluded file is not included in any_deleted on non windows platform
if: "contains(steps.changed-files-specific.outputs.deleted_files, 'test/test/test.txt') && runner.os != 'Windows'"
run: |
echo "Invalid output: Expected not to include (test/test/test.txt) got (${{ steps.changed-files-specific.outputs.deleted_files }})"
exit 1
shell:
bash
- name: Verify any_deleted for specific files
if: "!contains(steps.changed-files-specific.outputs.deleted_files, 'action.yml') && !contains(steps.changed-files-specific.outputs.deleted_files, '.github/workflows/test.yml') && !contains(steps.changed-files-specific.outputs.deleted_files, 'test/test.txt')"
- name: Check if a excluded file is not included in any_deleted on windows platform
if: "contains(steps.changed-files-specific.outputs.deleted_files, 'test\\test\\test.txt') && runner.os == 'Windows'"
run: |
echo "Invalid output: Expected not to include (test\\test\\test.txt) got (${{ steps.changed-files-specific.outputs.deleted_files }})"
exit 1
shell:
bash
- name: Verify any_deleted for specific files on non windows platform
if: "!contains(steps.changed-files-specific.outputs.deleted_files, 'action.yml') && !contains(steps.changed-files-specific.outputs.deleted_files, '.github/workflows/test.yml') && !contains(steps.changed-files-specific.outputs.deleted_files, 'test/test.txt') && runner.os != 'Windows'"
run: |
if [[ "${{ steps.changed-files-specific.outputs.any_deleted }}" != "false" ]]; then
echo "Invalid output: Expected (false) got (${{ steps.changed-files-specific.outputs.any_deleted }})"
exit 1
fi
shell:
bash
- name: Verify any_deleted for specific files on windows platform
if: "!contains(steps.changed-files-specific.outputs.deleted_files, 'action.yml') && !contains(steps.changed-files-specific.outputs.deleted_files, '.github\\workflows\\test.yml') && !contains(steps.changed-files-specific.outputs.deleted_files, 'test\\test.txt') && runner.os == 'Windows'"
run: |
if [[ "${{ steps.changed-files-specific.outputs.any_deleted }}" != "false" ]]; then
echo "Invalid output: Expected (false) got (${{ steps.changed-files-specific.outputs.any_deleted }})"
@@ -1282,8 +1436,8 @@ jobs:
echo '${{ toJSON(steps.changed-files-specific-comma.outputs) }}'
shell:
bash
- name: Verify any_changed files comma separator
if: "!contains(steps.changed-files-specific-comma.outputs.all_changed_files, 'action.yml') && !contains(steps.changed-files-specific-comma.outputs.all_changed_files, '.github/workflows/test.yml')"
- name: Verify any_changed files comma separator on non windows platform
if: "!contains(steps.changed-files-specific-comma.outputs.all_changed_files, 'action.yml') && !contains(steps.changed-files-specific-comma.outputs.all_changed_files, '.github/workflows/test.yml') && runner.os != 'Windows'"
run: |
if [[ "${{ steps.changed-files-specific-comma.outputs.any_changed }}" != "false" ]]; then
echo "Invalid output: Expected (false) got (${{ steps.changed-files-specific-comma.outputs.any_changed }})"
@@ -1291,8 +1445,17 @@ jobs:
fi
shell:
bash
- name: Verify any_modified files comma separator
if: "!contains(steps.changed-files-specific-comma.outputs.all_modified_files, 'action.yml') && !contains(steps.changed-files-specific-comma.outputs.all_modified_files, '.github/workflows/test.yml')"
- name: Verify any_changed files comma separator on windows platform
if: "!contains(steps.changed-files-specific-comma.outputs.all_changed_files, 'action.yml') && !contains(steps.changed-files-specific-comma.outputs.all_changed_files, '.github\\workflows\\test.yml') && runner.os == 'Windows'"
run: |
if [[ "${{ steps.changed-files-specific-comma.outputs.any_changed }}" != "false" ]]; then
echo "Invalid output: Expected (false) got (${{ steps.changed-files-specific-comma.outputs.any_changed }})"
exit 1
fi
shell:
bash
- name: Verify any_modified files comma separator on non windows platform
if: "!contains(steps.changed-files-specific-comma.outputs.all_modified_files, 'action.yml') && !contains(steps.changed-files-specific-comma.outputs.all_modified_files, '.github/workflows/test.yml') && runner.os != 'Windows'"
run: |
if [[ "${{ steps.changed-files-specific-comma.outputs.any_modified }}" != "false" ]]; then
echo "Invalid output: Expected (false) got (${{ steps.changed-files-specific-comma.outputs.any_modified }})"
@@ -1300,8 +1463,26 @@ jobs:
fi
shell:
bash
- name: Verify any_deleted files comma separator
if: "!contains(steps.changed-files-specific-comma.outputs.deleted_files, 'action.yml') && !contains(steps.changed-files-specific-comma.outputs.deleted_files, '.github/workflows/test.yml')"
- name: Verify any_modified files comma separator on windows platform
if: "!contains(steps.changed-files-specific-comma.outputs.all_modified_files, 'action.yml') && !contains(steps.changed-files-specific-comma.outputs.all_modified_files, '.github\\workflows\\test.yml') && runner.os == 'Windows'"
run: |
if [[ "${{ steps.changed-files-specific-comma.outputs.any_modified }}" != "false" ]]; then
echo "Invalid output: Expected (false) got (${{ steps.changed-files-specific-comma.outputs.any_modified }})"
exit 1
fi
shell:
bash
- name: Verify any_deleted files comma separator on non windows platform
if: "!contains(steps.changed-files-specific-comma.outputs.deleted_files, 'action.yml') && !contains(steps.changed-files-specific-comma.outputs.deleted_files, '.github/workflows/test.yml') && runner.os != 'Windows'"
run: |
if [[ "${{ steps.changed-files-specific-comma.outputs.any_deleted }}" != "false" ]]; then
echo "Invalid output: Expected (false) got (${{ steps.changed-files-specific-comma.outputs.any_deleted }})"
exit 1
fi
shell:
bash
- name: Verify any_deleted files comma separator on windows platform
if: "!contains(steps.changed-files-specific-comma.outputs.deleted_files, 'action.yml') && !contains(steps.changed-files-specific-comma.outputs.deleted_files, '.github\\workflows\\test.yml') && runner.os == 'Windows'"
run: |
if [[ "${{ steps.changed-files-specific-comma.outputs.any_deleted }}" != "false" ]]; then
echo "Invalid output: Expected (false) got (${{ steps.changed-files-specific-comma.outputs.any_deleted }})"
@@ -1322,8 +1503,8 @@ jobs:
echo '${{ toJSON(steps.changed-files-specific-pipe.outputs) }}'
shell:
bash
- name: Verify any_changed files comma separator
if: "!contains(steps.changed-files-specific-pipe.outputs.all_changed_files, 'action.yml') && !contains(steps.changed-files-specific-pipe.outputs.all_changed_files, '.github/workflows/test.yml')"
- name: Verify any_changed files comma separator on non windows platform
if: "!contains(steps.changed-files-specific-pipe.outputs.all_changed_files, 'action.yml') && !contains(steps.changed-files-specific-pipe.outputs.all_changed_files, '.github/workflows/test.yml') && runner.os != 'Windows'"
run: |
if [[ "${{ steps.changed-files-specific-pipe.outputs.any_changed }}" != "false" ]]; then
echo "Invalid output: Expected (false) got (${{ steps.changed-files-specific-pipe.outputs.any_changed }})"
@@ -1331,8 +1512,17 @@ jobs:
fi
shell:
bash
- name: Verify any_modified files comma separator
if: "!contains(steps.changed-files-specific-pipe.outputs.all_modified_files, 'action.yml') && !contains(steps.changed-files-specific-pipe.outputs.all_modified_files, '.github/workflows/test.yml')"
- name: Verify any_changed files comma separator on windows platform
if: "!contains(steps.changed-files-specific-pipe.outputs.all_changed_files, 'action.yml') && !contains(steps.changed-files-specific-pipe.outputs.all_changed_files, '.github\\workflows\\test.yml') && runner.os == 'Windows'"
run: |
if [[ "${{ steps.changed-files-specific-pipe.outputs.any_changed }}" != "false" ]]; then
echo "Invalid output: Expected (false) got (${{ steps.changed-files-specific-pipe.outputs.any_changed }})"
exit 1
fi
shell:
bash
- name: Verify any_modified files comma separator on non windows platform
if: "!contains(steps.changed-files-specific-pipe.outputs.all_modified_files, 'action.yml') && !contains(steps.changed-files-specific-pipe.outputs.all_modified_files, '.github/workflows/test.yml') && runner.os != 'Windows'"
run: |
if [[ "${{ steps.changed-files-specific-pipe.outputs.any_modified }}" != "false" ]]; then
echo "Invalid output: Expected (false) got (${{ steps.changed-files-specific-pipe.outputs.any_modified }})"
@@ -1340,8 +1530,26 @@ jobs:
fi
shell:
bash
- name: Verify any_deleted files comma separator
if: "!contains(steps.changed-files-specific-pipe.outputs.deleted_files, 'action.yml') && !contains(steps.changed-files-specific-pipe.outputs.deleted_files, '.github/workflows/test.yml')"
- name: Verify any_modified files comma separator on windows platform
if: "!contains(steps.changed-files-specific-pipe.outputs.all_modified_files, 'action.yml') && !contains(steps.changed-files-specific-pipe.outputs.all_modified_files, '.github\\workflows\\test.yml') && runner.os == 'Windows'"
run: |
if [[ "${{ steps.changed-files-specific-pipe.outputs.any_modified }}" != "false" ]]; then
echo "Invalid output: Expected (false) got (${{ steps.changed-files-specific-pipe.outputs.any_modified }})"
exit 1
fi
shell:
bash
- name: Verify any_deleted files comma separator on non windows platform
if: "!contains(steps.changed-files-specific-pipe.outputs.deleted_files, 'action.yml') && !contains(steps.changed-files-specific-pipe.outputs.deleted_files, '.github/workflows/test.yml') && runner.os != 'Windows'"
run: |
if [[ "${{ steps.changed-files-specific-pipe.outputs.any_deleted }}" != "false" ]]; then
echo "Invalid output: Expected (false) got (${{ steps.changed-files-specific-pipe.outputs.any_deleted }})"
exit 1
fi
shell:
bash
- name: Verify any_deleted files comma separator on windows platform
if: "!contains(steps.changed-files-specific-pipe.outputs.deleted_files, 'action.yml') && !contains(steps.changed-files-specific-pipe.outputs.deleted_files, '.github\\workflows\\test.yml') && runner.os == 'Windows'"
run: |
if [[ "${{ steps.changed-files-specific-pipe.outputs.any_deleted }}" != "false" ]]; then
echo "Invalid output: Expected (false) got (${{ steps.changed-files-specific-pipe.outputs.any_deleted }})"
@@ -1362,8 +1570,8 @@ jobs:
echo '${{ toJSON(steps.changed-files-specific-forward-slash.outputs) }}'
shell:
bash
- name: Verify any_changed files forward slash separator
if: "!contains(steps.changed-files-specific-forward-slash.outputs.all_changed_files, 'action.yml') && !contains(steps.changed-files-specific-forward-slash.outputs.all_changed_files, '.github/workflows/test.yml')"
- name: Verify any_changed files forward slash separator on non windows platform
if: "!contains(steps.changed-files-specific-forward-slash.outputs.all_changed_files, 'action.yml') && !contains(steps.changed-files-specific-forward-slash.outputs.all_changed_files, '.github/workflows/test.yml') && runner.os != 'Windows'"
run: |
if [[ "${{ steps.changed-files-specific-forward-slash.outputs.any_changed }}" != "false" ]]; then
echo "Invalid output: Expected (false) got (${{ steps.changed-files-specific-forward-slash.outputs.any_changed }})"
@@ -1371,8 +1579,17 @@ jobs:
fi
shell:
bash
- name: Verify any_modified files forward slash separator
if: "!contains(steps.changed-files-specific-forward-slash.outputs.all_modified_files, 'action.yml') && !contains(steps.changed-files-specific-forward-slash.outputs.all_modified_files, '.github/workflows/test.yml')"
- name: Verify any_changed files forward slash separator on windows platform
if: "!contains(steps.changed-files-specific-forward-slash.outputs.all_changed_files, 'action.yml') && !contains(steps.changed-files-specific-forward-slash.outputs.all_changed_files, '.github\\workflows\\test.yml') && runner.os == 'Windows'"
run: |
if [[ "${{ steps.changed-files-specific-forward-slash.outputs.any_changed }}" != "false" ]]; then
echo "Invalid output: Expected (false) got (${{ steps.changed-files-specific-forward-slash.outputs.any_changed }})"
exit 1
fi
shell:
bash
- name: Verify any_modified files forward slash separator on non windows platform
if: "!contains(steps.changed-files-specific-forward-slash.outputs.all_modified_files, 'action.yml') && !contains(steps.changed-files-specific-forward-slash.outputs.all_modified_files, '.github/workflows/test.yml') && runner.os != 'Windows'"
run: |
if [[ "${{ steps.changed-files-specific-forward-slash.outputs.any_modified }}" != "false" ]]; then
echo "Invalid output: Expected (false) got (${{ steps.changed-files-specific-forward-slash.outputs.any_modified }})"
@@ -1380,8 +1597,26 @@ jobs:
fi
shell:
bash
- name: Verify any_deleted files forward slash separator
if: "!contains(steps.changed-files-specific-forward-slash.outputs.deleted_files, 'action.yml') && !contains(steps.changed-files-specific-forward-slash.outputs.deleted_files, '.github/workflows/test.yml')"
- name: Verify any_modified files forward slash separator on windows platform
if: "!contains(steps.changed-files-specific-forward-slash.outputs.all_modified_files, 'action.yml') && !contains(steps.changed-files-specific-forward-slash.outputs.all_modified_files, '.github\\workflows\\test.yml') && runner.os == 'Windows'"
run: |
if [[ "${{ steps.changed-files-specific-forward-slash.outputs.any_modified }}" != "false" ]]; then
echo "Invalid output: Expected (false) got (${{ steps.changed-files-specific-forward-slash.outputs.any_modified }})"
exit 1
fi
shell:
bash
- name: Verify any_deleted files forward slash separator on non windows platform
if: "!contains(steps.changed-files-specific-forward-slash.outputs.deleted_files, 'action.yml') && !contains(steps.changed-files-specific-forward-slash.outputs.deleted_files, '.github/workflows/test.yml') && runner.os != 'Windows'"
run: |
if [[ "${{ steps.changed-files-specific-forward-slash.outputs.any_deleted }}" != "false" ]]; then
echo "Invalid output: Expected (false) got (${{ steps.changed-files-specific-forward-slash.outputs.any_deleted }})"
exit 1
fi
shell:
bash
- name: Verify any_deleted files forward slash separator on windows platform
if: "!contains(steps.changed-files-specific-forward-slash.outputs.deleted_files, 'action.yml') && !contains(steps.changed-files-specific-forward-slash.outputs.deleted_files, '.github\\workflows\\test.yml') && runner.os == 'Windows'"
run: |
if [[ "${{ steps.changed-files-specific-forward-slash.outputs.any_deleted }}" != "false" ]]; then
echo "Invalid output: Expected (false) got (${{ steps.changed-files-specific-forward-slash.outputs.any_deleted }})"
@@ -1398,14 +1633,26 @@ jobs:
test/changed-files-list.txt
files: |
**/workflows/greetings.yml
- name: Check if a excluded file is not included in any_changed
if: contains(steps.changed-files-specific-source-file.outputs.all_changed_files, 'test/test/test.txt')
- name: Show output
run: |
echo '${{ toJSON(steps.changed-files-specific-source-file.outputs) }}'
shell:
bash
- name: Check if a excluded file is not included in any_changed on non windows platform
if: "contains(steps.changed-files-specific-source-file.outputs.all_changed_files, 'test/test/test.txt') && runner.os != 'Windows'"
run: |
echo "Invalid output: Expected not to include (test/test/test.txt) got (${{ steps.changed-files-specific-source-file.outputs.all_changed_files }})"
exit 1
shell:
bash
- name: Verify any_changed from source files
- name: Check if a excluded file is not included in any_changed on windows platform
if: "contains(steps.changed-files-specific-source-file.outputs.all_changed_files, 'test\\test\\test.txt') && runner.os == 'Windows'"
run: |
echo "Invalid output: Expected not to include (test\\test\\test.txt) got (${{ steps.changed-files-specific-source-file.outputs.all_changed_files }})"
exit 1
shell:
bash
- name: Verify any_changed from source files on non windows platform
if: |
(
!contains(steps.changed-files-specific-source-file.outputs.all_changed_files, 'action.yml') &&
@@ -1414,7 +1661,8 @@ jobs:
!contains(steps.changed-files-specific-source-file.outputs.all_changed_files, 'test/test2/test.txt') &&
!contains(steps.changed-files-specific-source-file.outputs.all_changed_files, 'test/test2/test3/test4/test.txt') &&
!contains(steps.changed-files-specific-source-file.outputs.all_changed_files, '[test new].txt') &&
!contains(steps.changed-files-specific-source-file.outputs.all_changed_files, '.github/workflows/greetings.yml')
!contains(steps.changed-files-specific-source-file.outputs.all_changed_files, '.github/workflows/greetings.yml') &&
runner.os != 'Windows'
)
run: |
if [[ "${{ steps.changed-files-specific-source-file.outputs.any_changed }}" != "false" ]]; then
@@ -1423,14 +1671,21 @@ jobs:
fi
shell:
bash
- name: Check if a excluded file is not included in any_modified
if: contains(steps.changed-files-specific-source-file.outputs.all_modified_files, 'test/test/test.txt')
- name: Check if a excluded file is not included in any_modified on non windows platform
if: "contains(steps.changed-files-specific-source-file.outputs.all_modified_files, 'test/test/test.txt') && runner.os != 'Windows'"
run: |
echo "Invalid output: Expected not to include (test/test/test.txt) got (${{ steps.changed-files-specific-source-file.outputs.all_modified_files }})"
exit 1
shell:
bash
- name: Verify any_modified from source files
- name: Check if a excluded file is not included in any_modified on windows platform
if: "contains(steps.changed-files-specific-source-file.outputs.all_modified_files, 'test\\test\\test.txt') && runner.os == 'Windows'"
run: |
echo "Invalid output: Expected not to include (test\\test\\test.txt) got (${{ steps.changed-files-specific-source-file.outputs.all_modified_files }})"
exit 1
shell:
bash
- name: Verify any_modified from source files on non windows platform
if: |
(
!contains(steps.changed-files-specific-source-file.outputs.all_modified_files, 'action.yml') &&
@@ -1439,7 +1694,8 @@ jobs:
!contains(steps.changed-files-specific-source-file.outputs.all_modified_files, 'test/test2/test.txt') &&
!contains(steps.changed-files-specific-source-file.outputs.all_modified_files, 'test/test2/test3/test4/test.txt') &&
!contains(steps.changed-files-specific-source-file.outputs.all_modified_files, '[test new].txt') &&
!contains(steps.changed-files-specific-source-file.outputs.all_modified_files, '.github/workflows/greetings.yml')
!contains(steps.changed-files-specific-source-file.outputs.all_modified_files, '.github/workflows/greetings.yml') &&
runner.os != 'Windows'
)
run: |
if [[ "${{ steps.changed-files-specific-source-file.outputs.any_modified }}" != "false" ]]; then
@@ -1448,14 +1704,21 @@ jobs:
fi
shell:
bash
- name: Check if a excluded file is not included in any_deleted
if: contains(steps.changed-files-specific-source-file.outputs.deleted_files, 'test/test/test.txt')
- name: Check if a excluded file is not included in any_deleted on non windows platform
if: "contains(steps.changed-files-specific-source-file.outputs.deleted_files, 'test/test/test.txt') && runner.os != 'Windows'"
run: |
echo "Invalid output: Expected not to include (test/test/test.txt) got (${{ steps.changed-files-specific-source-file.outputs.deleted_files }})"
exit 1
shell:
bash
- name: Verify any_deleted from source files
- name: Check if a excluded file is not included in any_deleted on windows platform
if: contains(steps.changed-files-specific-source-file.outputs.deleted_files, 'test\\test\\test.txt')
run: |
echo "Invalid output: Expected not to include (test\\test\\test.txt) got (${{ steps.changed-files-specific-source-file.outputs.deleted_files }})"
exit 1
shell:
bash
- name: Verify any_deleted from source files on non windows platform
if: |
(
!contains(steps.changed-files-specific-source-file.outputs.deleted_files, 'action.yml') &&
@@ -1464,7 +1727,8 @@ jobs:
!contains(steps.changed-files-specific-source-file.outputs.deleted_files, 'test/test2/test.txt') &&
!contains(steps.changed-files-specific-source-file.outputs.deleted_files, 'test/test2/test3/test4/test.txt') &&
!contains(steps.changed-files-specific-source-file.outputs.deleted_files, '[test new].txt') &&
!contains(steps.changed-files-specific-source-file.outputs.deleted_files, '.github/workflows/greetings.yml')
!contains(steps.changed-files-specific-source-file.outputs.deleted_files, '.github/workflows/greetings.yml') &&
runner.os != 'Windows'
)
run: |
if [[ "${{ steps.changed-files-specific-source-file.outputs.any_deleted }}" != "false" ]]; then
@@ -1490,7 +1754,7 @@ jobs:
echo '${{ toJSON(steps.changed-files-specific-comma-source-file.outputs) }}'
shell:
bash
- name: Verify any_changed files comma separator
- name: Verify any_changed files comma separator from source files on non windows platform
if: |
(
!contains(steps.changed-files-specific-comma-source-file.outputs.all_changed_files, 'action.yml') &&
@@ -1498,7 +1762,8 @@ jobs:
!contains(steps.changed-files-specific-comma-source-file.outputs.all_changed_files, 'test/test.txt') &&
!contains(steps.changed-files-specific-comma-source-file.outputs.all_changed_files, 'test/test2/test.txt') &&
!contains(steps.changed-files-specific-comma-source-file.outputs.all_changed_files, 'test/test2/test3/test4/test.txt') &&
!contains(steps.changed-files-specific-comma-source-file.outputs.all_changed_files, '[test new].txt')
!contains(steps.changed-files-specific-comma-source-file.outputs.all_changed_files, '[test new].txt') &&
runner.os != 'Windows'
)
run: |
if [[ "${{ steps.changed-files-specific-comma-source-file.outputs.any_changed }}" != "false" ]]; then
@@ -1507,7 +1772,7 @@ jobs:
fi
shell:
bash
- name: Verify any_modified files comma separator
- name: Verify any_modified files comma separator from source files on non windows platform
if: |
(
!contains(steps.changed-files-specific-comma-source-file.outputs.all_modified_files, 'action.yml') &&
@@ -1515,7 +1780,8 @@ jobs:
!contains(steps.changed-files-specific-comma-source-file.outputs.all_modified_files, 'test/test.txt') &&
!contains(steps.changed-files-specific-comma-source-file.outputs.all_modified_files, 'test/test2/test.txt') &&
!contains(steps.changed-files-specific-comma-source-file.outputs.all_modified_files, 'test/test2/test3/test4/test.txt') &&
!contains(steps.changed-files-specific-comma-source-file.outputs.all_modified_files, '[test new].txt')
!contains(steps.changed-files-specific-comma-source-file.outputs.all_modified_files, '[test new].txt') &&
runner.os != 'Windows'
)
run: |
if [[ "${{ steps.changed-files-specific-comma-source-file.outputs.any_modified }}" != "false" ]]; then
@@ -1524,23 +1790,6 @@ jobs:
fi
shell:
bash
- name: Verify any_deleted files with comma separator
if: |
(
!contains(steps.changed-files-specific-comma-source-file.outputs.deleted_files, 'action.yml') &&
!contains(steps.changed-files-specific-comma-source-file.outputs.deleted_files, '.github/workflows/test.yml') &&
!contains(steps.changed-files-specific-comma-source-file.outputs.deleted_files, 'test/test.txt') &&
!contains(steps.changed-files-specific-comma-source-file.outputs.deleted_files, 'test/test2/test.txt') &&
!contains(steps.changed-files-specific-comma-source-file.outputs.deleted_files, 'test/test2/test3/test4/test.txt') &&
!contains(steps.changed-files-specific-comma-source-file.outputs.deleted_files, '[test new].txt')
)
run: |
if [[ "${{ steps.changed-files-specific-comma-source-file.outputs.any_deleted }}" != "false" ]]; then
echo "Invalid output: Expected (false) got (${{ steps.changed-files-specific-comma-source-file.outputs.any_deleted }})"
exit 1
fi
shell:
bash
- name: Get branch name
id: branch-name
uses: tj-actions/branch-names@v7

View File

@@ -1,5 +1,240 @@
# Changelog
# [38.0.0](https://github.com/tj-actions/changed-files/compare/v37.6.1...v38.0.0) - (2023-08-23)
## <!-- 0 -->🚀 Features
- Add support for including matching changed files when dir_names is set to true ([#1464](https://github.com/tj-actions/changed-files/issues/1464)) ([8789204](https://github.com/tj-actions/changed-files/commit/8789204f9747de46e322edc26ccef589722b5d12)) - (Tonye Jack)
## <!-- 1 -->🐛 Bug Fixes
- Error getting diff for submodules ([#1473](https://github.com/tj-actions/changed-files/issues/1473)) ([17f3fec](https://github.com/tj-actions/changed-files/commit/17f3fec1edef0c3916d59cbcee1585fcd457e456)) - (Tonye Jack)
- Bug with locating the previous tag ([#1470](https://github.com/tj-actions/changed-files/issues/1470)) ([fc63326](https://github.com/tj-actions/changed-files/commit/fc633265449c7430ee5634b1c673247b313ef8cf)) - (Tonye Jack)
## <!-- 26 -->🔄 Update
- Updated README.md ([#1466](https://github.com/tj-actions/changed-files/issues/1466))
Co-authored-by: repo-ranger[bot] <repo-ranger[bot]@users.noreply.github.com> ([e8f1278](https://github.com/tj-actions/changed-files/commit/e8f12786b4779b5208c8e0593863215f52c804e0)) - (tj-actions[bot])
- Update README.md ([f8b4039](https://github.com/tj-actions/changed-files/commit/f8b4039d9628a18c5e26b11a098230dd037e299e)) - (Tonye Jack)
- Update README.md ([0e8eddf](https://github.com/tj-actions/changed-files/commit/0e8eddfd8c525e4d8522d7de71af8ad5e4290b90)) - (Tonye Jack)
## <!-- 7 -->⚙️ Miscellaneous Tasks
- Update test ([#1469](https://github.com/tj-actions/changed-files/issues/1469)) ([52dbf3e](https://github.com/tj-actions/changed-files/commit/52dbf3e3cf799a1324a9c148c64948abbf8c3fa6)) - (Tonye Jack)
- **deps:** Update dependency @types/jest to v29.5.4 ([#1472](https://github.com/tj-actions/changed-files/issues/1472)) ([0a814e4](https://github.com/tj-actions/changed-files/commit/0a814e4372753d6beb4a9ec8f4166aea312f679a)) - (renovate[bot])
- **deps:** Update dependency @types/node to v20.5.3 ([#1467](https://github.com/tj-actions/changed-files/issues/1467)) ([18bacaa](https://github.com/tj-actions/changed-files/commit/18bacaab15227e761b04fb4097648318590be71a)) - (renovate[bot])
- Update .eslintrc.json ([#1465](https://github.com/tj-actions/changed-files/issues/1465)) ([819fb64](https://github.com/tj-actions/changed-files/commit/819fb645201f8693c48ca1158b4069d0c7cec64d)) - (Tonye Jack)
- **deps:** Update typescript-eslint monorepo to v6.4.1 ([#1463](https://github.com/tj-actions/changed-files/issues/1463)) ([31003b4](https://github.com/tj-actions/changed-files/commit/31003b45e6faa01151aeb2508de21d895b9024d8)) - (renovate[bot])
- **deps:** Update dependency jest to v29.6.3 ([#1462](https://github.com/tj-actions/changed-files/issues/1462)) ([1f04b16](https://github.com/tj-actions/changed-files/commit/1f04b16682ff06e18be316b672337f43ebd8f768)) - (renovate[bot])
- **deps:** Lock file maintenance ([#1461](https://github.com/tj-actions/changed-files/issues/1461)) ([0a8b04e](https://github.com/tj-actions/changed-files/commit/0a8b04e3e345eae4a8aa28fb46959c1509197ee5)) - (renovate[bot])
- **deps:** Update dependency @types/node to v20.5.1 ([#1460](https://github.com/tj-actions/changed-files/issues/1460)) ([6da496e](https://github.com/tj-actions/changed-files/commit/6da496e2f92930ffc11735db0b53e4e2027e9e26)) - (renovate[bot])
- **deps:** Update actions/setup-node action to v3.8.1 ([#1459](https://github.com/tj-actions/changed-files/issues/1459)) ([68d38a3](https://github.com/tj-actions/changed-files/commit/68d38a3f163ab827c733c45c9f23d607401a34ce)) - (renovate[bot])
## <!-- 9 -->⬆️ Upgrades
- Upgraded to v37.6.1 ([#1458](https://github.com/tj-actions/changed-files/issues/1458))
Co-authored-by: jackton1 <jackton1@users.noreply.github.com> ([3645cf9](https://github.com/tj-actions/changed-files/commit/3645cf9fc374b6e501b12888142f2aabc6b3cbf9)) - (tj-actions[bot])
# [37.6.1](https://github.com/tj-actions/changed-files/compare/v37.6.0...v37.6.1) - (2023-08-15)
## <!-- 26 -->🔄 Update
- Update README.md ([9273633](https://github.com/tj-actions/changed-files/commit/927363397d870aec841c3616c5136442218239af)) - (Tonye Jack)
- Update README.md ([a2e7076](https://github.com/tj-actions/changed-files/commit/a2e707696afd3f2f1738328cbfed71c56cd9b744)) - (Tonye Jack)
## <!-- 7 -->⚙️ Miscellaneous Tasks
- **deps:** Update dependency prettier to v3.0.2 ([#1457](https://github.com/tj-actions/changed-files/issues/1457)) ([a0585ff](https://github.com/tj-actions/changed-files/commit/a0585ff9904b77d046192a7846e59783d6ea287b)) - (renovate[bot])
- **deps:** Update typescript-eslint monorepo to v6.4.0 ([#1456](https://github.com/tj-actions/changed-files/issues/1456)) ([ec3a2a3](https://github.com/tj-actions/changed-files/commit/ec3a2a3b3bf9648f952a5c642013948f99ab154f)) - (renovate[bot])
- **deps:** Update actions/setup-node action to v3.8.0 ([#1455](https://github.com/tj-actions/changed-files/issues/1455)) ([24e2a6f](https://github.com/tj-actions/changed-files/commit/24e2a6fb86042fb1e67a527045d6f8dea53b7d06)) - (renovate[bot])
- **deps:** Lock file maintenance ([#1454](https://github.com/tj-actions/changed-files/issues/1454)) ([1144bc6](https://github.com/tj-actions/changed-files/commit/1144bc6587e8570446c99b3cd5961539c750de3e)) - (renovate[bot])
- **deps:** Update dependency @types/node to v20.5.0 ([#1453](https://github.com/tj-actions/changed-files/issues/1453)) ([fa84d94](https://github.com/tj-actions/changed-files/commit/fa84d9471e31552ac5031e74416776d80f7b3c23)) - (renovate[bot])
- **deps:** Update dependency @types/node to v20.4.10 ([#1452](https://github.com/tj-actions/changed-files/issues/1452)) ([71dfd0d](https://github.com/tj-actions/changed-files/commit/71dfd0dc2e7cde599586ee53148fcf31fda68499)) - (renovate[bot])
- **deps:** Update dependency eslint to v8.47.0 ([#1451](https://github.com/tj-actions/changed-files/issues/1451)) ([b941520](https://github.com/tj-actions/changed-files/commit/b941520afb05ff090564ee87734ece045963aaa7)) - (renovate[bot])
- **deps:** Lock file maintenance ([#1450](https://github.com/tj-actions/changed-files/issues/1450)) ([be11012](https://github.com/tj-actions/changed-files/commit/be110124f6253e3471e3c0280329c359fef9b077)) - (renovate[bot])
- **deps:** Update dependency @types/lodash to v4.14.197 ([#1446](https://github.com/tj-actions/changed-files/issues/1446)) ([9dc097c](https://github.com/tj-actions/changed-files/commit/9dc097cfe56dd6dca442b8b71b988aad4c385f94)) - (renovate[bot])
- **deps:** Update dependency @types/node to v20.4.9 ([#1444](https://github.com/tj-actions/changed-files/issues/1444)) ([e3b0c8a](https://github.com/tj-actions/changed-files/commit/e3b0c8a681e6f809136066ceeaae9a9203eddf29)) - (renovate[bot])
- Fix typo ([a62be95](https://github.com/tj-actions/changed-files/commit/a62be95af39e3e8d28a0ff4a80d07d30e7d16e17)) - (Tonye Jack)
- **deps:** Update typescript-eslint monorepo to v6.3.0 ([#1442](https://github.com/tj-actions/changed-files/issues/1442)) ([f267068](https://github.com/tj-actions/changed-files/commit/f267068b025785a2b8e6c5fd692c18782759af31)) - (renovate[bot])
## <!-- 9 -->⬆️ Upgrades
- Upgraded to v37.6.0 ([#1441](https://github.com/tj-actions/changed-files/issues/1441))
Co-authored-by: jackton1 <jackton1@users.noreply.github.com> ([7f0849b](https://github.com/tj-actions/changed-files/commit/7f0849be06042444c62445709a000389e08d70e6)) - (tj-actions[bot])
# [37.6.0](https://github.com/tj-actions/changed-files/compare/v37.5.2...v37.6.0) - (2023-08-07)
## <!-- 0 -->🚀 Features
- Improve checking local branch history ([#1436](https://github.com/tj-actions/changed-files/issues/1436)) ([d4e6e22](https://github.com/tj-actions/changed-files/commit/d4e6e22e932832260459e972c83fa76adca04a5c)) - (Tonye Jack)
## <!-- 26 -->🔄 Update
- Update README.md ([1e9cd5f](https://github.com/tj-actions/changed-files/commit/1e9cd5f2990496e3dc049d7978a807ed153b11a7)) - (Tonye Jack)
- Update README.md ([6b028b6](https://github.com/tj-actions/changed-files/commit/6b028b63039ee69ccfad97e35166eb997f6807ff)) - (Tonye Jack)
- Updated README.md ([#1432](https://github.com/tj-actions/changed-files/issues/1432))
Co-authored-by: jackton1 <jackton1@users.noreply.github.com> ([b61db78](https://github.com/tj-actions/changed-files/commit/b61db7817fbdc9f587fb205f4276886cda5913c5)) - (tj-actions[bot])
- Update README.md ([6a48a0a](https://github.com/tj-actions/changed-files/commit/6a48a0a0182db1daa7e00603ede7e99364f65ff2)) - (Tonye Jack)
- Update README.md ([3415802](https://github.com/tj-actions/changed-files/commit/3415802ae92f45865a7bb5f80578ad22994f57ea)) - (Tonye Jack)
- Update README.md ([20a19b9](https://github.com/tj-actions/changed-files/commit/20a19b977fa3a78c7d87956e7b388681926d3b56)) - (Tonye Jack)
- Update README.md ([10228bf](https://github.com/tj-actions/changed-files/commit/10228bf07b9286b8db198de83022b52ab908bde7)) - (Tonye Jack)
## <!-- 6 -->🧪 Testing
- Improve test coverage ([#1435](https://github.com/tj-actions/changed-files/issues/1435)) ([29022e8](https://github.com/tj-actions/changed-files/commit/29022e81a423492ed68172112181d0109be5e64e)) - (Tonye Jack)
## <!-- 7 -->⚙️ Miscellaneous Tasks
- Improve test coverage ([#1440](https://github.com/tj-actions/changed-files/issues/1440)) ([87697c0](https://github.com/tj-actions/changed-files/commit/87697c0dca7dd44e37a2b79a79489332556ff1f3)) - (Tonye Jack)
- Simplify code ([#1439](https://github.com/tj-actions/changed-files/issues/1439)) ([0acc1c3](https://github.com/tj-actions/changed-files/commit/0acc1c308efedeb1a3a82d4c3812e380cacc86ec)) - (Tonye Jack)
- **deps:** Lock file maintenance ([#1438](https://github.com/tj-actions/changed-files/issues/1438)) ([312a3d8](https://github.com/tj-actions/changed-files/commit/312a3d8003811361254cc82903f9a5e057bd1d66)) - (renovate[bot])
- **deps:** Update dependency @types/node to v20.4.8 ([#1425](https://github.com/tj-actions/changed-files/issues/1425)) ([701bae5](https://github.com/tj-actions/changed-files/commit/701bae514b676a5deb33f611a66c7639c3ee2690)) - (renovate[bot])
- **deps:** Lock file maintenance ([#1437](https://github.com/tj-actions/changed-files/issues/1437)) ([8bffb97](https://github.com/tj-actions/changed-files/commit/8bffb974e49dd3c5f242d8af10b9326194c99740)) - (renovate[bot])
- **deps-dev:** Bump @types/node from 20.4.6 to 20.4.7 ([#1433](https://github.com/tj-actions/changed-files/issues/1433)) ([f762082](https://github.com/tj-actions/changed-files/commit/f76208237d15a696b0174f93dbb00254bc016c65)) - (dependabot[bot])
## <!-- 9 -->⬆️ Upgrades
- Upgraded to v37.5.2 ([#1431](https://github.com/tj-actions/changed-files/issues/1431))
Co-authored-by: jackton1 <jackton1@users.noreply.github.com> ([24ac45c](https://github.com/tj-actions/changed-files/commit/24ac45c74eee7f284e92f053e045dd94823f7255)) - (tj-actions[bot])
# [37.5.2](https://github.com/tj-actions/changed-files/compare/v37.5.1...v37.5.2) - (2023-08-03)
## <!-- 26 -->🔄 Update
- Update README.md ([948fd1a](https://github.com/tj-actions/changed-files/commit/948fd1aec0f923945aefa5b428966a3148c14b6f)) - (Tonye Jack)
- Update README.md ([bde04d3](https://github.com/tj-actions/changed-files/commit/bde04d3ec66f15d1bc7856d05ca626fb6573dc64)) - (Tonye Jack)
- Update README.md ([3fdcd6b](https://github.com/tj-actions/changed-files/commit/3fdcd6b1fa054b93db539c7b381c93fa2268d74e)) - (Tonye Jack)
- Update README.md ([6b62acf](https://github.com/tj-actions/changed-files/commit/6b62acfc401246667fa6575c368224614e69d150)) - (Tonye Jack)
- Updated README.md ([#1420](https://github.com/tj-actions/changed-files/issues/1420))
Co-authored-by: jackton1 <jackton1@users.noreply.github.com> ([c10ebdc](https://github.com/tj-actions/changed-files/commit/c10ebdc85fde7af2ea8c66779702ccdc2c09c3ba)) - (tj-actions[bot])
- Update README.md ([1b00b76](https://github.com/tj-actions/changed-files/commit/1b00b76bc1c9caf00f684c3bb3147d85da101580)) - (Tonye Jack)
## <!-- 7 -->⚙️ Miscellaneous Tasks
- Improve test coverage ([#1430](https://github.com/tj-actions/changed-files/issues/1430)) ([85c8b82](https://github.com/tj-actions/changed-files/commit/85c8b8252fc9893e00b3633a16670e53040e6d71)) - (Tonye Jack)
- **deps:** Update dependency prettier to v3.0.1 ([#1428](https://github.com/tj-actions/changed-files/issues/1428)) ([213a6fb](https://github.com/tj-actions/changed-files/commit/213a6fbf71815875a70e39d3f252fe0b13646e14)) - (renovate[bot])
- **deps:** Lock file maintenance ([#1427](https://github.com/tj-actions/changed-files/issues/1427)) ([c089e39](https://github.com/tj-actions/changed-files/commit/c089e392a94aa3fb0651d7893b8d45513851ca14)) - (renovate[bot])
- **deps-dev:** Bump @types/node from 20.4.5 to 20.4.6 ([#1426](https://github.com/tj-actions/changed-files/issues/1426)) ([387fa91](https://github.com/tj-actions/changed-files/commit/387fa91a199f7def6ffb96525119cce72a40c3d2)) - (dependabot[bot])
- **deps:** Lock file maintenance ([#1424](https://github.com/tj-actions/changed-files/issues/1424)) ([ce7dcea](https://github.com/tj-actions/changed-files/commit/ce7dceac93d38ea5365ee8ec231c4c25529ecbfd)) - (renovate[bot])
- **deps:** Lock file maintenance ([#1423](https://github.com/tj-actions/changed-files/issues/1423)) ([18832c2](https://github.com/tj-actions/changed-files/commit/18832c2f0d0dcbf0a631fb9ae64a5b2c840b72d8)) - (renovate[bot])
- **deps:** Update typescript-eslint monorepo to v6.2.1 ([#1422](https://github.com/tj-actions/changed-files/issues/1422)) ([2b564ea](https://github.com/tj-actions/changed-files/commit/2b564ea5437173b3e7dcb0d7aec9ee0ad166d488)) - (renovate[bot])
- **deps:** Lock file maintenance ([#1421](https://github.com/tj-actions/changed-files/issues/1421)) ([62411c0](https://github.com/tj-actions/changed-files/commit/62411c0bbfd74101a58615b1443f3b112aab34f7)) - (renovate[bot])
- **deps:** Lock file maintenance ([#1419](https://github.com/tj-actions/changed-files/issues/1419)) ([8ffb34e](https://github.com/tj-actions/changed-files/commit/8ffb34e4dbad285f2f06e6fc82d72b24d5de2534)) - (renovate[bot])
## <!-- 9 -->⬆️ Upgrades
- Upgraded to v37.5.1 ([#1418](https://github.com/tj-actions/changed-files/issues/1418))
Co-authored-by: jackton1 <jackton1@users.noreply.github.com> ([81ce706](https://github.com/tj-actions/changed-files/commit/81ce7062432f3f2a5ba687cce3f289de9da66332)) - (tj-actions[bot])
# [37.5.1](https://github.com/tj-actions/changed-files/compare/v37.5.0...v37.5.1) - (2023-07-28)
## <!-- 26 -->🔄 Update
- Update README.md ([ca51c3f](https://github.com/tj-actions/changed-files/commit/ca51c3f4304b9cd96adebaa47025a2014040eb61)) - (Tonye Jack)
- Update README.md ([5716c62](https://github.com/tj-actions/changed-files/commit/5716c6246fcfd7031340a7be53243a6a6b689c3e)) - (Tonye Jack)
- Update README.md ([f6edf88](https://github.com/tj-actions/changed-files/commit/f6edf885b4a59cd97f396367b3e6fe4f26454601)) - (Tonye Jack)
- Update README.md ([331d2da](https://github.com/tj-actions/changed-files/commit/331d2daf96995ca6711e07b13681faa6a55bda62)) - (Tonye Jack)
- Updated README.md ([#1412](https://github.com/tj-actions/changed-files/issues/1412))
Co-authored-by: jackton1 <jackton1@users.noreply.github.com> ([174b246](https://github.com/tj-actions/changed-files/commit/174b246d44adb53ce1a125fc589734fce01e47eb)) - (tj-actions[bot])
- Update README.md ([0bf8395](https://github.com/tj-actions/changed-files/commit/0bf83955a913aa99abe90724dc460e86708af650)) - (Tonye Jack)
- Update README.md ([69c6091](https://github.com/tj-actions/changed-files/commit/69c6091ee4f562b2c6509ded97c4e5330ac95b09)) - (Tonye Jack)
- Update README.md ([ba9054e](https://github.com/tj-actions/changed-files/commit/ba9054e8d5ffe1537ded23c6a65348cb9b78e8c4)) - (Tonye Jack)
- Update README.md ([7e9cc01](https://github.com/tj-actions/changed-files/commit/7e9cc01c5474ea22e06e55ea8a296c8653e64d0c)) - (Tonye Jack)
## <!-- 7 -->⚙️ Miscellaneous Tasks
- **deps:** Update dependency eslint to v8.46.0 ([#1417](https://github.com/tj-actions/changed-files/issues/1417)) ([a96679d](https://github.com/tj-actions/changed-files/commit/a96679dfee2a1e64b1db5a210c0ffaf1f2cb24ce)) - (renovate[bot])
- **deps:** Lock file maintenance ([#1416](https://github.com/tj-actions/changed-files/issues/1416)) ([0c65957](https://github.com/tj-actions/changed-files/commit/0c659577d4b26faf3f99868ea9cabd2775f9b3cb)) - (renovate[bot])
- **deps:** Update dependency jest to v29.6.2 ([#1415](https://github.com/tj-actions/changed-files/issues/1415)) ([ea41e77](https://github.com/tj-actions/changed-files/commit/ea41e772876ff19a8d86e3315c52ceff3dae1941)) - (renovate[bot])
- **deps:** Update dependency @types/lodash to v4.14.196 ([#1413](https://github.com/tj-actions/changed-files/issues/1413)) ([4acaa72](https://github.com/tj-actions/changed-files/commit/4acaa728bbc362e0ced57dad81204885d253a0e6)) - (renovate[bot])
- **deps:** Update dependency @types/node to v20.4.5 ([#1409](https://github.com/tj-actions/changed-files/issues/1409)) ([cf02ab9](https://github.com/tj-actions/changed-files/commit/cf02ab960fc3dee58fc4911fac2c6946f4f64552)) - (renovate[bot])
- **deps:** Lock file maintenance ([#1408](https://github.com/tj-actions/changed-files/issues/1408)) ([b50d1ab](https://github.com/tj-actions/changed-files/commit/b50d1ab2d1388e35e9163a8eb2ae8b903e62ca8e)) - (renovate[bot])
## <!-- 9 -->⬆️ Upgrades
- Upgraded to v37.5.0 ([#1407](https://github.com/tj-actions/changed-files/issues/1407))
Co-authored-by: jackton1 <jackton1@users.noreply.github.com> ([0f52c86](https://github.com/tj-actions/changed-files/commit/0f52c861db7764988bb85cbb66a0b166787f586b)) - (tj-actions[bot])
# [37.5.0](https://github.com/tj-actions/changed-files/compare/v37.4.0...v37.5.0) - (2023-07-24)
## <!-- 0 -->🚀 Features
- Add support to detect changes for merge group event ([#1404](https://github.com/tj-actions/changed-files/issues/1404)) ([b8e577a](https://github.com/tj-actions/changed-files/commit/b8e577a27496ebc04ffb8b3bbca1b30a145001b1)) - (Tonye Jack)
## <!-- 1 -->🐛 Bug Fixes
- Error fetch more history for release events ([#1403](https://github.com/tj-actions/changed-files/issues/1403)) ([fc3c551](https://github.com/tj-actions/changed-files/commit/fc3c551a67c6151b4b7746c157a9c0914f18e129)) - (Tonye Jack)
## <!-- 26 -->🔄 Update
- Update package.json ([73d266f](https://github.com/tj-actions/changed-files/commit/73d266fe29bbb01958506ffe53b575269d8f2b13)) - (Tonye Jack)
- Update package.json ([e1ddf02](https://github.com/tj-actions/changed-files/commit/e1ddf02aff6c4d9a624216633291c52df6630421)) - (Tonye Jack)
- Update README.md ([f543980](https://github.com/tj-actions/changed-files/commit/f5439803c2c02cdb10b325d247c8ccc66cbc2203)) - (Tonye Jack)
- Update README.md ([a0a0be0](https://github.com/tj-actions/changed-files/commit/a0a0be0376b580745f0bd13a6b7ee4e98d028bf3)) - (Tonye Jack)
## <!-- 7 -->⚙️ Miscellaneous Tasks
- **deps:** Lock file maintenance ([#1406](https://github.com/tj-actions/changed-files/issues/1406)) ([920e7b9](https://github.com/tj-actions/changed-files/commit/920e7b9ae1d45913fc81f86c956fee89c77d2e5e)) - (renovate[bot])
- **deps:** Update typescript-eslint monorepo to v6.2.0 ([#1402](https://github.com/tj-actions/changed-files/issues/1402)) ([797a722](https://github.com/tj-actions/changed-files/commit/797a7222448d90d32258966774780cfb39ee4f44)) - (renovate[bot])
- **deps:** Lock file maintenance ([#1401](https://github.com/tj-actions/changed-files/issues/1401)) ([44790ad](https://github.com/tj-actions/changed-files/commit/44790ad9d8b0716d28defa47199281f484931e31)) - (renovate[bot])
- Update package.json ([66d62c9](https://github.com/tj-actions/changed-files/commit/66d62c97d57b2c770a365925793a1e8eb2b1dcd0)) - (Tonye Jack)
- **deps:** Update dependency @types/node to v20.4.4 ([#1400](https://github.com/tj-actions/changed-files/issues/1400)) ([d44a61e](https://github.com/tj-actions/changed-files/commit/d44a61ef339541580efca1a47286b8b9e3b69311)) - (renovate[bot])
- **deps:** Update dependency @types/node to v20.4.3 ([#1399](https://github.com/tj-actions/changed-files/issues/1399)) ([ef59201](https://github.com/tj-actions/changed-files/commit/ef59201f02fa40b09640c053d97cdf5c5dc65391)) - (renovate[bot])
## <!-- 9 -->⬆️ Upgrades
- Upgraded to v37.4.0 ([#1397](https://github.com/tj-actions/changed-files/issues/1397))
Co-authored-by: jackton1 <jackton1@users.noreply.github.com> ([48ce584](https://github.com/tj-actions/changed-files/commit/48ce5846c9a7c7c959b6c60e3afc80aaba4e6b0c)) - (tj-actions[bot])
# [37.4.0](https://github.com/tj-actions/changed-files/compare/v37.3.0...v37.4.0) - (2023-07-20)
## <!-- 0 -->🚀 Features
- Update error handling for yaml inputs ([#1395](https://github.com/tj-actions/changed-files/issues/1395)) ([de0eba3](https://github.com/tj-actions/changed-files/commit/de0eba32790fb9bf87471b32855a30fc8f9d5fc6)) - (Tonye Jack)
## <!-- 26 -->🔄 Update
- Update README.md ([bc262c2](https://github.com/tj-actions/changed-files/commit/bc262c2f61e2fdc75b802ad2213f80fefc98af12)) - (Tonye Jack)
- Update README.md ([d4389f0](https://github.com/tj-actions/changed-files/commit/d4389f0f4fe92065f29aee6519d551c3c5d26583)) - (Tonye Jack)
- Updated README.md ([#1394](https://github.com/tj-actions/changed-files/issues/1394))
Co-authored-by: jackton1 <jackton1@users.noreply.github.com> ([7998446](https://github.com/tj-actions/changed-files/commit/79984462e18db53eaaee1f8d582c2e752d13cf0c)) - (tj-actions[bot])
- Update action.yml ([c6dcc2a](https://github.com/tj-actions/changed-files/commit/c6dcc2a013c3d4f2a21908234845ba52952f2a57)) - (Tonye Jack)
## <!-- 9 -->⬆️ Upgrades
- Upgraded to v37.3.0 ([#1392](https://github.com/tj-actions/changed-files/issues/1392))
Co-authored-by: jackton1 <jackton1@users.noreply.github.com> ([e6dde3c](https://github.com/tj-actions/changed-files/commit/e6dde3c0653441e7c18779d1207fe87efa071f02)) - (tj-actions[bot])
# [37.3.0](https://github.com/tj-actions/changed-files/compare/v37.2.0...v37.3.0) - (2023-07-19)
## <!-- 0 -->🚀 Features
- Add support for restricting recoverable deleted files via patterns ([#1390](https://github.com/tj-actions/changed-files/issues/1390)) ([33288d3](https://github.com/tj-actions/changed-files/commit/33288d37e78121ba601151ba03d8dacaf856777c)) - (Tonye Jack)
## <!-- 26 -->🔄 Update
- Updated README.md ([#1391](https://github.com/tj-actions/changed-files/issues/1391))
Co-authored-by: repo-ranger[bot] <repo-ranger[bot]@users.noreply.github.com> ([3928317](https://github.com/tj-actions/changed-files/commit/39283171cefdf491e0f0d6cf285b86b31eb6f3cd)) - (tj-actions[bot])
## <!-- 9 -->⬆️ Upgrades
- Upgraded to v37.2.0 ([#1389](https://github.com/tj-actions/changed-files/issues/1389))
Co-authored-by: jackton1 <jackton1@users.noreply.github.com> ([b60277d](https://github.com/tj-actions/changed-files/commit/b60277dde98548f8d384a0b92a469fc5d0f46b1f)) - (tj-actions[bot])
# [37.2.0](https://github.com/tj-actions/changed-files/compare/v37.1.2...v37.2.0) - (2023-07-18)
## <!-- 26 -->🔄 Update

254
README.md
View File

@@ -13,10 +13,6 @@
<!-- ALL-CONTRIBUTORS-BADGE:END -->
<div align="center">
<img width="auto" alt="Screen Shot 2021-11-19 at 4 59 21 PM" src="https://user-images.githubusercontent.com/17484350/229027815-eee0bf22-f3e5-444d-9d90-6409c68a0dc9.png">
</div>
## 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 using this GitHub action.
@@ -48,7 +44,8 @@ Effortlessly track all changed files and directories relative to a target branch
* Facilitates easy debugging.
* Scales to handle large repositories.
* Supports Git submodules.
* Generates escaped JSON output for running matrix jobs based on changed files.
* Supports [merge queues](https://docs.github.com/en/repositories/configuring-branches-and-merges-in-your-repository/configuring-pull-request-merges/managing-a-merge-queue) for pull requests.
* Generates escaped [JSON output for running matrix jobs](https://github.com/tj-actions/changed-files/blob/main/.github/workflows/matrix-test.yml) based on changed files.
* Lists changed directories.
* Limits matching changed directories to a specified maximum depth.
* Optionally excludes the current directory.
@@ -65,7 +62,7 @@ Effortlessly track all changed files and directories relative to a target branch
* Between the last remote branch commit and the current HEAD.
* Restricts change detection to a subset of files and directories:
* Provides boolean output indicating changes in specific files.
* Uses [Glob pattern](https://docs.github.com/en/actions/learn-github-actions/workflow-syntax-for-github-actions#filter-pattern-cheat-sheet) matching.
* Uses [Glob pattern](https://codepen.io/mrmlnc/pen/OXQjMe) matching.
* Supports Globstar.
* Supports brace expansion.
* Supports negation.
@@ -73,17 +70,19 @@ Effortlessly track all changed files and directories relative to a target branch
* Supports [YAML anchors & aliases](https://www.educative.io/blog/advanced-yaml-syntax-cheatsheet#anchors).
* Supports [YAML multi-line strings](https://learnxinyminutes.com/docs/yaml/).
And many more.
And many more...
## Usage
> **Warning**:
> **Warning**
>
> * **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.
> * All multiline inputs should not use double or single quotes since the value is already a string separated 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 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)
> * For `push` events: When configuring [`actions/checkout`](https://github.com/actions/checkout#usage), make sure to set [`fetch-depth`](https://github.com/actions/checkout#usage) to either `0` or `2`, depending on your use case.
> * For mono repositories where pulling all branch history might not be desired, you can still use the default [`fetch-depth`](https://github.com/actions/checkout#usage), which is set to `1` for `pull_request` events.
> * Avoid using single or double quotes for multiline inputs, as the value is already a string separated by a newline character. See [Examples](#examples) for more information.
> * If [`fetch-depth`](https://github.com/actions/checkout#usage) isn't set to `0`, ensure that `persist-credentials` is set to `true` when configuring [`actions/checkout`](https://github.com/actions/checkout#usage).
> * For repositories that have PRs generated from forks, when configuring [`actions/checkout`](https://github.com/actions/checkout#usage), set the [`repository`](https://github.com/actions/checkout#usage) to `${{ github.event.pull_request.head.repo.full_name }}`. See [Example](https://github.com/tj-actions/changed-files/blob/main/.github/workflows/test.yml#L47-L51).
Visit the [discussions for more information](https://github.com/tj-actions/changed-files/discussions) or [create a new discussion](https://github.com/tj-actions/changed-files/discussions/new/choose) for usage-related questions.
### On `pull_request`
@@ -110,9 +109,39 @@ jobs:
fetch-depth: 0 # OR "2" -> To retrieve the preceding commit.
# Example 1
- name: Get all test, doc and src files that have changed
id: changed-files-yaml
uses: tj-actions/changed-files@v38
with:
files_yaml: |
doc:
- '**/*.md'
- docs/**
- README.md
test:
- test/**
- '!test/**.md'
src:
- src/**
# Optionally set `files_yaml_from_source_file` to read the YAML from a file. e.g `files_yaml_from_source_file: .github/changed-files.yml`
- name: Run step if test file(s) change
# NOTE: Ensure all outputs are prefixed by the same key used above e.g. `test_(...)` | `doc_(...)` | `src_(...)` when trying to access the `any_changed` output.
if: steps.changed-files-yaml.outputs.test_any_changed == 'true'
run: |
echo "One or more test file(s) has changed."
echo "List all the files that have changed: ${{ steps.changed-files-yaml.outputs.test_all_changed_files }}"
- name: Run step if doc file(s) change
if: steps.changed-files-yaml.outputs.doc_any_changed == 'true'
run: |
echo "One or more doc file(s) has changed."
echo "List all the files that have changed: ${{ steps.changed-files-yaml.outputs.doc_all_changed_files }}"
# Example 2
- name: Get changed files
id: changed-files
uses: tj-actions/changed-files@v37
uses: tj-actions/changed-files@v38
# To compare changes between the current commit and the last pushed remote commit set `since_last_remote_commit: true`. e.g
# with:
@@ -124,10 +153,10 @@ jobs:
echo "$file was changed"
done
# Example 2
# Example 3
- name: Get changed files in the docs folder
id: changed-files-specific
uses: tj-actions/changed-files@v37
uses: tj-actions/changed-files@v38
with:
files: docs/*.{js,html} # Alternatively using: `docs/**` or `docs`
files_ignore: docs/static.js
@@ -137,35 +166,6 @@ jobs:
run: |
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 }}"
# 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
- docs/**
- !docs/README.md
test:
- test/**
- !test/README.md
src:
- src/**
# Optionally set `files_yaml_from_source_file` to read the YAML from a file. e.g `files_yaml_from_source_file: .github/changed-files.yml`
- name: Run step if test file(s) change
if: steps.changed-files-yaml.outputs.test_any_changed == 'true'
run: |
echo "One or more test file(s) has changed."
echo "List all the files that have changed: ${{ steps.changed-files-yaml.outputs.test_all_changed_files }}"
- name: Run step if doc file(s) change
if: steps.changed-files-yaml.outputs.doc_any_changed == 'true'
run: |
echo "One or more doc file(s) has changed."
echo "List all the files that have changed: ${{ steps.changed-files-yaml.outputs.doc_all_changed_files }}"
```
#### Using Github's API
@@ -196,7 +196,7 @@ jobs:
steps:
- name: Get changed files
id: changed-files
uses: tj-actions/changed-files@v37
uses: tj-actions/changed-files@v38
- name: List all changed files
run: |
@@ -222,12 +222,16 @@ on:
# - cron: '0 0 * * *'
#
# release:
# types: [published]
# types: [...]
#
# workflow_dispatch:
#
# push:
# tags:
# - '**'
#
# merge_group:
#
# ...and many more
@@ -252,7 +256,7 @@ jobs:
# Example 1
- name: Get changed files
id: changed-files
uses: tj-actions/changed-files@v37
uses: tj-actions/changed-files@v38
# NOTE: `since_last_remote_commit: true` is implied by default and falls back to the previous local commit.
@@ -294,6 +298,10 @@ Support this project with a :star:
| U | Unmerged |
| X | Unknown |
> **Warning**
>
> * When using `files_yaml*` inputs ensure all outputs are prefixed by the key `test_{...}` e.g. `test_added_files`, `test_any_changed`
## Outputs
<!-- AUTO-DOC-OUTPUT:START - Do not remove or modify this section -->
@@ -343,52 +351,55 @@ 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. |
| 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`. |
| 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\_include\_files | string | false | | Include files in the output <br>when `dir_names` is set to <br>`true`. **NOTE:** This returns only <br>the matching files and also <br>the directory names. |
| dir\_names\_include\_files\_separator | string | false | `"\n"` | Separator used to split the <br>`dir_names_include_files` input |
| 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\_additional\_submodule\_history | string | false | `"false"` | Fetch additional history for submodules. |
| 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, defaults <br>to the patterns provided via <br>the `files`, `files_from_source_file`, `files_ignore` and <br>`files_ignore_from_source_file` inputs or all deleted <br>files if no patterns are <br>provided. |
| 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 -->
@@ -413,7 +424,7 @@ The format of the version string is as follows:
...
- name: Get changed files
id: changed-files
uses: tj-actions/changed-files@v37
uses: tj-actions/changed-files@v38
...
```
@@ -426,7 +437,7 @@ The format of the version string is as follows:
...
- name: Get all changed files and use a comma separator in the output
id: changed-files
uses: tj-actions/changed-files@v37
uses: tj-actions/changed-files@v38
with:
separator: ","
...
@@ -443,7 +454,7 @@ See [inputs](#inputs) for more information.
...
- name: Get changed files
id: changed-files
uses: tj-actions/changed-files@v37
uses: tj-actions/changed-files@v38
- name: List all added files
run: |
@@ -464,7 +475,7 @@ See [outputs](#outputs) for a list of all available outputs.
...
- name: Get changed files
id: changed-files
uses: tj-actions/changed-files@v37
uses: tj-actions/changed-files@v38
- name: Run a step if my-file.txt was modified
if: contains(steps.changed-files.outputs.modified_files, 'my-file.txt')
@@ -524,7 +535,7 @@ See [outputs](#outputs) for a list of all available outputs.
...
- name: Get changed files
id: changed-files
uses: tj-actions/changed-files@v37
uses: tj-actions/changed-files@v38
with:
files: |
my-file.txt
@@ -532,7 +543,7 @@ See [outputs](#outputs) for a list of all available outputs.
*.png
!*.md
test_directory
**.sql
**/*.sql
...
```
@@ -547,7 +558,7 @@ See [inputs](#inputs) for more information.
...
- name: Get changed files
id: changed-files-specific
uses: tj-actions/changed-files@v37
uses: tj-actions/changed-files@v38
with:
files: |
my-file.txt
@@ -555,7 +566,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'
@@ -594,7 +605,7 @@ See [outputs](#outputs) for a list of all available outputs.
...
- name: Get changed files using a source file or list of file(s) to populate to files input.
id: changed-files-specific-source-file
uses: tj-actions/changed-files@v37
uses: tj-actions/changed-files@v38
with:
files_from_source_file: test/changed-files-list.txt
...
@@ -611,7 +622,7 @@ See [inputs](#inputs) for more information.
...
- name: Get changed files using a source file or list of file(s) to populate to files input and optionally specify more files.
id: changed-files-specific-source-file-and-specify-files
uses: tj-actions/changed-files@v37
uses: tj-actions/changed-files@v38
with:
files_from_source_file: |
test/changed-files-list.txt
@@ -632,7 +643,7 @@ See [inputs](#inputs) for more information.
...
- name: Get changed files using a different SHA
id: changed-files
uses: tj-actions/changed-files@v37
uses: tj-actions/changed-files@v38
with:
sha: ${{ github.event.pull_request.head.sha }}
...
@@ -649,7 +660,7 @@ See [inputs](#inputs) for more information.
...
- name: Get changed files using a different base SHA
id: changed-files
uses: tj-actions/changed-files@v37
uses: tj-actions/changed-files@v38
with:
base_sha: ${{ github.event.pull_request.base.sha }}
...
@@ -681,11 +692,11 @@ jobs:
- name: Get changed files
id: changed-files
uses: tj-actions/changed-files@v37
uses: tj-actions/changed-files@v38
- name: Get changed files in the .github folder
id: changed-files-specific
uses: tj-actions/changed-files@v37
uses: tj-actions/changed-files@v38
with:
base_sha: ${{ steps.get-base-sha.outputs.base_sha }}
files: .github/**
@@ -715,7 +726,7 @@ See [inputs](#inputs) for more information.
- name: Run changed-files with defaults in dir1
id: changed-files-for-dir1
uses: tj-actions/changed-files@v37
uses: tj-actions/changed-files@v38
with:
path: dir1
@@ -738,7 +749,7 @@ See [inputs](#inputs) for more information.
...
- name: Run changed-files with quotepath disabled
id: changed-files-quotepath
uses: tj-actions/changed-files@v37
uses: tj-actions/changed-files@v38
with:
quotepath: "false"
@@ -777,7 +788,7 @@ See [inputs](#inputs) for more information.
- name: Run changed-files with the commit of the last successful test workflow run
id: changed-files-base-sha-push
uses: tj-actions/changed-files@v37
uses: tj-actions/changed-files@v38
with:
base_sha: ${{ steps.last_successful_commit_push.outputs.base }}
...
@@ -804,7 +815,7 @@ See [inputs](#inputs) for more information.
- 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
uses: tj-actions/changed-files@v38
with:
base_sha: ${{ steps.last_successful_commit_pull_request.outputs.base }}
...
@@ -814,7 +825,9 @@ See [inputs](#inputs) for more information.
</li>
</ul>
> **Warning**: This setting overrides the commit sha used by setting `since_last_remote_commit` to true.
> **Warning**
>
> This setting overrides the commit sha used by setting `since_last_remote_commit` to true.
> It is recommended to use either solution that works for your use case.
See [inputs](#inputs) for more information.
@@ -828,7 +841,7 @@ See [inputs](#inputs) for more information.
...
- name: Run changed-files with dir_names
id: changed-files-dir-names
uses: tj-actions/changed-files@v37
uses: tj-actions/changed-files@v38
with:
dir_names: "true"
...
@@ -845,7 +858,7 @@ See [inputs](#inputs) for more information.
...
- name: Run changed-files with JSON output
id: changed-files-json
uses: tj-actions/changed-files@v37
uses: tj-actions/changed-files@v38
with:
json: "true"
...
@@ -862,13 +875,13 @@ See [inputs](#inputs) for more information.
...
- name: Get changed-files since 2022-08-19
id: changed-files-since
uses: tj-actions/changed-files@v37
uses: tj-actions/changed-files@v38
with:
since: "2022-08-19"
- name: Get changed-files until 2022-08-20
id: changed-files-until
uses: tj-actions/changed-files@v37
uses: tj-actions/changed-files@v38
with:
until: "2022-08-20"
...
@@ -902,7 +915,7 @@ And many more...
## Known Limitation
> **Warning**:
> **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 any hidden issues.
@@ -923,9 +936,8 @@ With the switch from using grep's Extended regex to match files to the natively
- \.sh$
- .(sql|py)$
- ^(dir1|dir2)
+ *.{sh,sql,py}
+ dir1
+ dir2
+ **/*.{sh,sql,py}
+ {dir1,dir2}/**
```
* Free software: [MIT license](LICENSE)

View File

@@ -112,6 +112,14 @@ inputs:
description: "Exclude the current directory represented by `.` from the output when `dir_names` is set to `true`."
required: false
default: "false"
dir_names_include_files:
description: "Include files in the output when `dir_names` is set to `true`. **NOTE:** This returns only the matching files and also the directory names."
required: false
default: ""
dir_names_include_files_separator:
description: "Separator used to split the `dir_names_include_files` input"
default: "\n"
required: false
json:
description: "Output list of changed files in a JSON formatted string which can be used for matrix jobs."
required: false
@@ -128,6 +136,10 @@ inputs:
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"
fetch_additional_submodule_history:
description: "Fetch additional history for submodules."
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
@@ -153,7 +165,7 @@ inputs:
required: false
default: ""
recover_files:
description: "File and directory patterns used to recover deleted files."
description: "File and directory patterns used to recover deleted files, defaults to the patterns provided via the `files`, `files_from_source_file`, `files_ignore` and `files_ignore_from_source_file` inputs or all deleted files if no patterns are provided."
required: false
default: ""
recover_files_separator:

600
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

View File

@@ -1,7 +1,7 @@
{
"name": "@tj-actions/glob",
"version": "17.2.5",
"description": "Glob pattern matching github action",
"name": "@tj-actions/changed-files",
"version": "37.4.0",
"description": "Github action to retrieve all (added, copied, modified, deleted, renamed, type changed, unmerged, unknown) files and directories.",
"main": "lib/main.js",
"publishConfig": {
"registry": "https://npm.pkg.github.com"
@@ -10,7 +10,7 @@
"build": "tsc",
"format": "prettier --write **/*.ts",
"format-check": "prettier --check **/*.ts",
"lint": "eslint src/**/*.ts",
"lint": "eslint **/*.ts --max-warnings 0",
"lint:fix": "eslint --fix src/**/*.ts",
"package": "ncc build lib/main.js --source-map --license licenses.txt",
"test": "jest --coverage",
@@ -18,7 +18,7 @@
},
"repository": {
"type": "git",
"url": "git+https://github.com/tj-actions/glob.git"
"url": "git+https://github.com/tj-actions/changed-files.git"
},
"keywords": [
"actions",
@@ -28,9 +28,9 @@
"author": "Tonye Jack",
"license": "MIT",
"bugs": {
"url": "https://github.com/tj-actions/glob/issues"
"url": "https://github.com/tj-actions/changed-files/issues"
},
"homepage": "https://github.com/tj-actions/glob#readme",
"homepage": "https://github.com/tj-actions/changed-files#readme",
"dependencies": {
"@actions/core": "^1.10.0",
"@actions/exec": "^1.1.1",
@@ -53,6 +53,7 @@
"eslint-plugin-github": "^4.8.0",
"eslint-plugin-jest": "^27.2.2",
"eslint-plugin-prettier": "^5.0.0-alpha.2",
"eslint-config-prettier": "^9.0.0",
"jest": "^29.5.0",
"prettier": "^3.0.0",
"ts-jest": "^29.1.0",

578
src/__tests__/utils.test.ts Normal file
View File

@@ -0,0 +1,578 @@
import {ChangeTypeEnum} from '../changedFiles'
import {
getDirname,
getDirnameMaxDepth,
getFilteredChangedFiles,
normalizeSeparators
} from '../utils'
const originalPlatform = process.platform
function mockedPlatform(platform: string): void {
Object.defineProperty(process, 'platform', {
value: platform
})
}
describe('utils test', () => {
afterEach(() => {
Object.defineProperty(process, 'platform', {
value: originalPlatform
})
})
describe('getDirnameMaxDepth_function', () => {
// Tests that the function returns the correct dirname when the relative path has multiple directories
it('test_multiple_directories', () => {
const result = getDirnameMaxDepth({
relativePath: 'path/to/some/file',
dirNamesMaxDepth: 2,
excludeCurrentDir: false
})
expect(result).toEqual('path/to')
})
// Tests that the function returns the correct dirname when the relative path has only one directory
it('test_single_directory', () => {
const result = getDirnameMaxDepth({
relativePath: 'path/to',
dirNamesMaxDepth: 1,
excludeCurrentDir: false
})
expect(result).toEqual('path')
})
// Tests that the function returns the correct dirname when the relative path has no directories
it('test_no_directories', () => {
const result = getDirnameMaxDepth({
relativePath: 'file.txt',
dirNamesMaxDepth: 1,
excludeCurrentDir: false
})
expect(result).toEqual('.')
})
// Tests that the function returns the correct dirname when dirNamesMaxDepth is set to a value less than the number of directories in the relative path
it('test_dirnames_max_depth_less_than_num_directories', () => {
const result = getDirnameMaxDepth({
relativePath: 'path/to/some/file',
dirNamesMaxDepth: 1,
excludeCurrentDir: false
})
expect(result).toEqual('path')
})
// Tests that the function returns an empty string when excludeCurrentDir is true and the output is '.'
it('test_exclude_current_dir_is_true_and_output_is_dot', () => {
const result = getDirnameMaxDepth({
relativePath: '.',
dirNamesMaxDepth: 1,
excludeCurrentDir: true
})
expect(result).toEqual('')
})
// Tests that the function returns the correct dirname when the relative path is a Windows drive root and excludeCurrentDir is true
it('test_windows_drive_root_and_exclude_current_dir_is_true', () => {
mockedPlatform('win32')
const result = getDirnameMaxDepth({
relativePath: 'C:\\',
dirNamesMaxDepth: 1,
excludeCurrentDir: true
})
expect(result).toEqual('')
})
// Tests that getDirnameMaxDepth handles a relative path with a trailing separator correctly
it('test_trailing_separator', () => {
const input = {
relativePath: 'path/to/dir/',
dirNamesMaxDepth: 2,
excludeCurrentDir: true
}
const expectedOutput = 'path/to'
const actualOutput = getDirnameMaxDepth(input)
expect(actualOutput).toEqual(expectedOutput)
})
// Tests that getDirnameMaxDepth returns an empty string when excludeCurrentDir is true and the output is '.'
it('test_trailing_separator_exclude_current_dir', () => {
const input = {
relativePath: 'file',
excludeCurrentDir: true
}
const expectedOutput = ''
const actualOutput = getDirnameMaxDepth(input)
expect(actualOutput).toEqual(expectedOutput)
})
// Tests that getDirnameMaxDepth returns the correct output for a Windows UNC root path
it('test_windows_unc_root', () => {
mockedPlatform('win32')
const input = {
relativePath: '\\hello',
dirNamesMaxDepth: 2,
excludeCurrentDir: true
}
const expectedOutput = ''
expect(getDirnameMaxDepth(input)).toEqual(expectedOutput)
})
// Tests that getDirnameMaxDepth returns an empty string when given a Windows UNC root and excludeCurrentDir is true
it('test_windows_unc_root_exclude_current_dir', () => {
mockedPlatform('win32')
const relativePath = '\\hello'
const result = getDirnameMaxDepth({
relativePath,
excludeCurrentDir: true
})
expect(result).toEqual('')
})
// Tests that getDirnameMaxDepth returns the correct dirname with a relative path that contains both forward and backward slashes
it('test_relative_path_with_slashes', () => {
const relativePath = 'path/to\file'
const expectedOutput = 'path'
const actualOutput = getDirnameMaxDepth({relativePath})
expect(actualOutput).toEqual(expectedOutput)
})
// Tests that getDirnameMaxDepth returns the correct dirname for a relative path that contains special characters
it('test_special_characters', () => {
const relativePath =
'path/with/special/characters/!@#$%^&*()_+{}|:<>?[];,./'
const expectedDirname = 'path/with/special/characters'
const actualDirname = getDirnameMaxDepth({relativePath})
expect(actualDirname).toEqual(expectedDirname)
})
})
describe('getDirname_function', () => {
// Tests that the function returns the correct dirname for a valid path
it('test valid path', () => {
expect(getDirname('/path/to/file')).toEqual('/path/to')
})
// Tests that the function returns the correct dirname for a valid Windows UNC root path
it('test windows unc root path', () => {
mockedPlatform('win32')
expect(getDirname('\\helloworld')).toEqual('.')
})
// Tests that the function returns the correct dirname for a path with a trailing slash
it('test path with trailing slash', () => {
expect(getDirname('/path/to/file/')).toEqual('/path/to')
})
// Tests that the function returns the correct dirname for a Windows UNC root path with a trailing slash
it('test windows unc root path with trailing slash', () => {
mockedPlatform('win32')
expect(getDirname('\\hello\\world\\')).toEqual('.')
})
// Tests that the function returns the correct dirname for a path with multiple slashes
it('test path with multiple slashes', () => {
expect(getDirname('/path//to/file')).toEqual('/path/to')
})
// Tests that the function returns the correct dirname for a Windows UNC root path with multiple slashes
it('test windows unc root path with multiple slashes', () => {
mockedPlatform('win32')
expect(getDirname('\\hello\\world')).toEqual('.')
})
})
describe('normalizeSeparators_function', () => {
// Tests that forward slashes are normalized on Linux
it('test forward slashes linux', () => {
const input = 'path/to/file'
const expectedOutput = 'path/to/file'
const actualOutput = normalizeSeparators(input)
expect(actualOutput).toEqual(expectedOutput)
})
// Tests that backslashes are normalized on Windows
it('test backslashes windows', () => {
mockedPlatform('win32')
const input = 'path\\to\\file'
const expectedOutput = 'path\\to\\file'
const actualOutput = normalizeSeparators(input)
expect(actualOutput).toEqual(expectedOutput)
})
// Tests that forward slashes are normalized on Windows
it('test mixed slashes windows', () => {
mockedPlatform('win32')
const input = 'path/to/file'
const expectedOutput = 'path\\to\\file'
const actualOutput = normalizeSeparators(input)
expect(actualOutput).toEqual(expectedOutput)
})
// Tests that mixed slashes are normalized on Windows
it('test mixed slashes windows', () => {
mockedPlatform('win32')
const input = 'path\\to/file'
const expectedOutput = 'path\\to\\file'
const actualOutput = normalizeSeparators(input)
expect(actualOutput).toEqual(expectedOutput)
})
// Tests that an empty string returns an empty string
it('test empty string', () => {
const input = ''
const expectedOutput = ''
const actualOutput = normalizeSeparators(input)
expect(actualOutput).toEqual(expectedOutput)
})
// Tests that multiple consecutive slashes are removed
it('test multiple consecutive slashes', () => {
const input = 'path//to//file'
const expectedOutput = 'path/to/file'
const actualOutput = normalizeSeparators(input)
expect(actualOutput).toEqual(expectedOutput)
})
// Tests that UNC format is preserved on Windows
it('test unc format windows', () => {
mockedPlatform('win32')
const input = '\\\\hello\\world'
const expectedOutput = '\\\\hello\\world'
const actualOutput = normalizeSeparators(input)
expect(actualOutput).toEqual(expectedOutput)
})
// Tests that a drive root is preserved on Windows
it('test drive root windows', () => {
mockedPlatform('win32')
const input = 'C:\\'
const expectedOutput = 'C:\\'
const actualOutput = normalizeSeparators(input)
expect(actualOutput).toEqual(expectedOutput)
})
})
describe('getFilteredChangedFiles', () => {
// Tests that the function returns an empty object when allDiffFiles and filePatterns are empty
it('should return an empty object when allDiffFiles and filePatterns are empty', async () => {
const result = await getFilteredChangedFiles({
allDiffFiles: {
[ChangeTypeEnum.Added]: [],
[ChangeTypeEnum.Copied]: [],
[ChangeTypeEnum.Deleted]: [],
[ChangeTypeEnum.Modified]: [],
[ChangeTypeEnum.Renamed]: [],
[ChangeTypeEnum.TypeChanged]: [],
[ChangeTypeEnum.Unmerged]: [],
[ChangeTypeEnum.Unknown]: []
},
filePatterns: []
})
expect(result).toEqual({
[ChangeTypeEnum.Added]: [],
[ChangeTypeEnum.Copied]: [],
[ChangeTypeEnum.Deleted]: [],
[ChangeTypeEnum.Modified]: [],
[ChangeTypeEnum.Renamed]: [],
[ChangeTypeEnum.TypeChanged]: [],
[ChangeTypeEnum.Unmerged]: [],
[ChangeTypeEnum.Unknown]: []
})
})
// Tests that the function returns allDiffFiles when filePatterns is empty
it('should return allDiffFiles when filePatterns is empty', async () => {
const allDiffFiles = {
[ChangeTypeEnum.Added]: ['file1.txt'],
[ChangeTypeEnum.Copied]: [],
[ChangeTypeEnum.Deleted]: [],
[ChangeTypeEnum.Modified]: [],
[ChangeTypeEnum.Renamed]: [],
[ChangeTypeEnum.TypeChanged]: [],
[ChangeTypeEnum.Unmerged]: [],
[ChangeTypeEnum.Unknown]: []
}
const result = await getFilteredChangedFiles({
allDiffFiles,
filePatterns: []
})
expect(result).toEqual(allDiffFiles)
})
// Tests that the function returns an empty object when allDiffFiles is empty
it('should return an empty object when allDiffFiles is empty', async () => {
const result = await getFilteredChangedFiles({
allDiffFiles: {
[ChangeTypeEnum.Added]: [],
[ChangeTypeEnum.Copied]: [],
[ChangeTypeEnum.Deleted]: [],
[ChangeTypeEnum.Modified]: [],
[ChangeTypeEnum.Renamed]: [],
[ChangeTypeEnum.TypeChanged]: [],
[ChangeTypeEnum.Unmerged]: [],
[ChangeTypeEnum.Unknown]: []
},
filePatterns: ['*.txt']
})
expect(result).toEqual({
[ChangeTypeEnum.Added]: [],
[ChangeTypeEnum.Copied]: [],
[ChangeTypeEnum.Deleted]: [],
[ChangeTypeEnum.Modified]: [],
[ChangeTypeEnum.Renamed]: [],
[ChangeTypeEnum.TypeChanged]: [],
[ChangeTypeEnum.Unmerged]: [],
[ChangeTypeEnum.Unknown]: []
})
})
// Tests that the function returns only the files that match the file patterns on non windows platforms
it('should return only the files that match the file patterns', async () => {
const allDiffFiles = {
[ChangeTypeEnum.Added]: [
'file1.txt',
'file2.md',
'file3.txt',
'test/dir/file4.txt',
'test/dir/file5.txt',
'dir/file6.md'
],
[ChangeTypeEnum.Copied]: [],
[ChangeTypeEnum.Deleted]: [],
[ChangeTypeEnum.Modified]: [],
[ChangeTypeEnum.Renamed]: [],
[ChangeTypeEnum.TypeChanged]: [],
[ChangeTypeEnum.Unmerged]: [],
[ChangeTypeEnum.Unknown]: []
}
const result = await getFilteredChangedFiles({
allDiffFiles,
filePatterns: ['*.txt']
})
expect(result).toEqual({
[ChangeTypeEnum.Added]: ['file1.txt', 'file3.txt'],
[ChangeTypeEnum.Copied]: [],
[ChangeTypeEnum.Deleted]: [],
[ChangeTypeEnum.Modified]: [],
[ChangeTypeEnum.Renamed]: [],
[ChangeTypeEnum.TypeChanged]: [],
[ChangeTypeEnum.Unmerged]: [],
[ChangeTypeEnum.Unknown]: []
})
})
// Tests that the function returns only the files that match the file patterns on windows
it('should return only the files that match the file patterns on windows', async () => {
mockedPlatform('win32')
const allDiffFiles = {
[ChangeTypeEnum.Added]: [
'file1.txt',
'file2.md',
'file3.txt',
'test\\dir\\file4.txt',
'test\\dir\\file5.txt',
'dir\\file6.md'
],
[ChangeTypeEnum.Copied]: [],
[ChangeTypeEnum.Deleted]: [],
[ChangeTypeEnum.Modified]: [],
[ChangeTypeEnum.Renamed]: [],
[ChangeTypeEnum.TypeChanged]: [],
[ChangeTypeEnum.Unmerged]: [],
[ChangeTypeEnum.Unknown]: []
}
const result = await getFilteredChangedFiles({
allDiffFiles,
filePatterns: ['*.txt']
})
expect(result).toEqual({
[ChangeTypeEnum.Added]: ['file1.txt', 'file3.txt'],
[ChangeTypeEnum.Copied]: [],
[ChangeTypeEnum.Deleted]: [],
[ChangeTypeEnum.Modified]: [],
[ChangeTypeEnum.Renamed]: [],
[ChangeTypeEnum.TypeChanged]: [],
[ChangeTypeEnum.Unmerged]: [],
[ChangeTypeEnum.Unknown]: []
})
})
// Tests that the function returns only the files that match the file patterns with globstar on non windows platforms
it('should return only the files that match the file patterns with globstar', async () => {
const allDiffFiles = {
[ChangeTypeEnum.Added]: [
'file1.txt',
'file2.md',
'file3.txt',
'test/dir/file4.txt',
'test/dir/file5.txt',
'dir/file6.md'
],
[ChangeTypeEnum.Copied]: [],
[ChangeTypeEnum.Deleted]: [],
[ChangeTypeEnum.Modified]: [],
[ChangeTypeEnum.Renamed]: [],
[ChangeTypeEnum.TypeChanged]: [],
[ChangeTypeEnum.Unmerged]: [],
[ChangeTypeEnum.Unknown]: []
}
const result = await getFilteredChangedFiles({
allDiffFiles,
filePatterns: ['**.txt']
})
expect(result).toEqual({
[ChangeTypeEnum.Added]: [
'file1.txt',
'file3.txt',
'test/dir/file4.txt',
'test/dir/file5.txt'
],
[ChangeTypeEnum.Copied]: [],
[ChangeTypeEnum.Deleted]: [],
[ChangeTypeEnum.Modified]: [],
[ChangeTypeEnum.Renamed]: [],
[ChangeTypeEnum.TypeChanged]: [],
[ChangeTypeEnum.Unmerged]: [],
[ChangeTypeEnum.Unknown]: []
})
})
// Tests that the function returns only the files that match the file patterns with globstar on windows
it('should return only the files that match the file patterns with globstar on windows', async () => {
mockedPlatform('win32')
const allDiffFiles = {
[ChangeTypeEnum.Added]: ['test\\test rename-1.txt'],
[ChangeTypeEnum.Copied]: [],
[ChangeTypeEnum.Deleted]: [],
[ChangeTypeEnum.Modified]: [],
[ChangeTypeEnum.Renamed]: [],
[ChangeTypeEnum.TypeChanged]: [],
[ChangeTypeEnum.Unmerged]: [],
[ChangeTypeEnum.Unknown]: []
}
const result = await getFilteredChangedFiles({
allDiffFiles,
filePatterns: ['test/**']
})
expect(result).toEqual({
[ChangeTypeEnum.Added]: ['test\\test rename-1.txt'],
[ChangeTypeEnum.Copied]: [],
[ChangeTypeEnum.Deleted]: [],
[ChangeTypeEnum.Modified]: [],
[ChangeTypeEnum.Renamed]: [],
[ChangeTypeEnum.TypeChanged]: [],
[ChangeTypeEnum.Unmerged]: [],
[ChangeTypeEnum.Unknown]: []
})
})
// Tests that the function returns an empty object when there are no files that match the file patterns
it('should return an empty object when there are no files that match the file patterns', async () => {
const allDiffFiles = {
[ChangeTypeEnum.Added]: ['file1.md', 'file2.md', 'file3.md'],
[ChangeTypeEnum.Copied]: [],
[ChangeTypeEnum.Deleted]: [],
[ChangeTypeEnum.Modified]: [],
[ChangeTypeEnum.Renamed]: [],
[ChangeTypeEnum.TypeChanged]: [],
[ChangeTypeEnum.Unmerged]: [],
[ChangeTypeEnum.Unknown]: []
}
const result = await getFilteredChangedFiles({
allDiffFiles,
filePatterns: ['*.txt']
})
expect(result).toEqual({
[ChangeTypeEnum.Added]: [],
[ChangeTypeEnum.Copied]: [],
[ChangeTypeEnum.Deleted]: [],
[ChangeTypeEnum.Modified]: [],
[ChangeTypeEnum.Renamed]: [],
[ChangeTypeEnum.TypeChanged]: [],
[ChangeTypeEnum.Unmerged]: [],
[ChangeTypeEnum.Unknown]: []
})
})
// Tests that the function can handle file names with special characters
it('should handle file names with special characters', async () => {
const allDiffFiles = {
[ChangeTypeEnum.Added]: [
'file1.txt',
'file2 with spaces.txt',
'file3$$.txt'
],
[ChangeTypeEnum.Copied]: [],
[ChangeTypeEnum.Deleted]: [],
[ChangeTypeEnum.Modified]: [],
[ChangeTypeEnum.Renamed]: [],
[ChangeTypeEnum.TypeChanged]: [],
[ChangeTypeEnum.Unmerged]: [],
[ChangeTypeEnum.Unknown]: []
}
const result = await getFilteredChangedFiles({
allDiffFiles,
filePatterns: ['file2*.txt']
})
expect(result).toEqual({
[ChangeTypeEnum.Added]: ['file2 with spaces.txt'],
[ChangeTypeEnum.Copied]: [],
[ChangeTypeEnum.Deleted]: [],
[ChangeTypeEnum.Modified]: [],
[ChangeTypeEnum.Renamed]: [],
[ChangeTypeEnum.TypeChanged]: [],
[ChangeTypeEnum.Unmerged]: [],
[ChangeTypeEnum.Unknown]: []
})
})
// Tests that getFilteredChangedFiles correctly filters files using glob patterns
it('should filter files using glob patterns', async () => {
const allDiffFiles = {
[ChangeTypeEnum.Added]: ['test/migrations/test.sql'],
[ChangeTypeEnum.Copied]: [],
[ChangeTypeEnum.Deleted]: [],
[ChangeTypeEnum.Modified]: [],
[ChangeTypeEnum.Renamed]: [],
[ChangeTypeEnum.TypeChanged]: [],
[ChangeTypeEnum.Unmerged]: [],
[ChangeTypeEnum.Unknown]: []
}
const filePatterns = ['test/migrations/**']
const filteredFiles = await getFilteredChangedFiles({
allDiffFiles,
filePatterns
})
expect(filteredFiles[ChangeTypeEnum.Added]).toEqual([
'test/migrations/test.sql'
])
})
// Tests that getFilteredChangedFiles correctly filters files using ignore glob patterns
it('should filter files using ignore glob patterns', async () => {
const allDiffFiles = {
[ChangeTypeEnum.Added]: [],
[ChangeTypeEnum.Copied]: [],
[ChangeTypeEnum.Deleted]: [],
[ChangeTypeEnum.Modified]: [
'assets/scripts/configure-minikube-linux.sh'
],
[ChangeTypeEnum.Renamed]: [],
[ChangeTypeEnum.TypeChanged]: [],
[ChangeTypeEnum.Unmerged]: [],
[ChangeTypeEnum.Unknown]: []
}
const filePatterns = [
'assets/scripts/**.sh',
'!assets/scripts/configure-minikube-linux.sh'
]
const filteredFiles = await getFilteredChangedFiles({
allDiffFiles,
filePatterns
})
expect(filteredFiles[ChangeTypeEnum.Modified]).toEqual([])
})
})
})

View File

@@ -2,15 +2,19 @@ import * as core from '@actions/core'
import * as github from '@actions/github'
import type {RestEndpointMethodTypes} from '@octokit/rest'
import flatten from 'lodash/flatten'
import mm from 'micromatch'
import * as path from 'path'
import {DiffResult} from './commitSha'
import {Inputs} from './inputs'
import {
canDiffCommits,
getAllChangedFiles,
getDirnameMaxDepth,
getDirNamesIncludeFilesPattern,
gitRenamedFiles,
gitSubmoduleDiffSHA,
isWindows,
jsonOutput
} from './utils'
@@ -51,11 +55,27 @@ export const getRenamedFiles = async ({
)
if (submoduleShaResult.currentSha && submoduleShaResult.previousSha) {
let diff = '...'
if (
!(await canDiffCommits({
cwd: submoduleWorkingDirectory,
sha1: submoduleShaResult.previousSha,
sha2: submoduleShaResult.currentSha,
diff
}))
) {
core.warning(
`Set 'fetch_additional_submodule_history: true' to fetch additional submodule history for: ${submodulePath}, Note you can control the fetch depth using 'fetch_depth' input`
)
diff = '..'
}
const submoduleRenamedFiles = await gitRenamedFiles({
cwd: submoduleWorkingDirectory,
sha1: submoduleShaResult.previousSha,
sha2: submoduleShaResult.currentSha,
diff: diffResult.diff,
diff,
oldNewSeparator: inputs.oldNewSeparator,
isSubmodule: true,
parentDir: submodulePath
@@ -130,11 +150,27 @@ export const getAllDiffFiles = async ({
)
if (submoduleShaResult.currentSha && submoduleShaResult.previousSha) {
let diff = '...'
if (
!(await canDiffCommits({
cwd: submoduleWorkingDirectory,
sha1: submoduleShaResult.previousSha,
sha2: submoduleShaResult.currentSha,
diff
}))
) {
core.warning(
`Set 'fetch_additional_submodule_history: true' to fetch additional submodule history for: ${submodulePath}, Note you can control the fetch depth using 'fetch_depth' input`
)
diff = '..'
}
const submoduleFiles = await getAllChangedFiles({
cwd: submoduleWorkingDirectory,
sha1: submoduleShaResult.previousSha,
sha2: submoduleShaResult.currentSha,
diff: diffResult.diff,
diff,
isSubmodule: true,
parentDir: submodulePath,
outputRenamedFilesAsDeletedAndAdded
@@ -155,6 +191,35 @@ export const getAllDiffFiles = async ({
return files
}
function* getFilePaths({
inputs,
filePaths,
dirNamesIncludeFilePatterns
}: {
inputs: Inputs
filePaths: string[]
dirNamesIncludeFilePatterns: string[]
}): Generator<string> {
for (const filePath of filePaths) {
if (inputs.dirNames) {
if (dirNamesIncludeFilePatterns.length > 0) {
const isWin = isWindows()
const matchOptions = {dot: true, windows: isWin, noext: true}
if (mm.isMatch(filePath, dirNamesIncludeFilePatterns, matchOptions)) {
yield filePath
}
}
yield getDirnameMaxDepth({
relativePath: filePath,
dirNamesMaxDepth: inputs.dirNamesMaxDepth,
excludeCurrentDir: inputs.dirNamesExcludeCurrentDir
})
} else {
yield filePath
}
}
}
function* getChangeTypeFilesGenerator({
inputs,
changedFiles,
@@ -164,18 +229,21 @@ function* getChangeTypeFilesGenerator({
changedFiles: ChangedFiles
changeTypes: ChangeTypeEnum[]
}): Generator<string> {
const dirNamesIncludeFilePatterns = getDirNamesIncludeFilesPattern({inputs})
core.debug(
`Dir names include file patterns: ${JSON.stringify(
dirNamesIncludeFilePatterns
)}`
)
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.dirNamesExcludeCurrentDir
})
} else {
yield file
}
const filePaths = changedFiles[changeType] || []
for (const filePath of getFilePaths({
inputs,
filePaths,
dirNamesIncludeFilePatterns
})) {
yield filePath
}
}
}
@@ -213,16 +281,21 @@ function* getAllChangeTypeFilesGenerator({
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.dirNamesExcludeCurrentDir
})
} else {
yield file
}
const dirNamesIncludeFilePatterns = getDirNamesIncludeFilesPattern({inputs})
core.debug(
`Dir names include file patterns: ${JSON.stringify(
dirNamesIncludeFilePatterns
)}`
)
const filePaths = flatten(Object.values(changedFiles))
for (const filePath of getFilePaths({
inputs,
filePaths,
dirNamesIncludeFilePatterns
})) {
yield filePath
}
}
@@ -278,9 +351,10 @@ export const getChangedFilesFromGithubAPI = async ({
per_page: 100
})
const paginatedResponse = await octokit.paginate<
RestEndpointMethodTypes['pulls']['listFiles']['response']['data'][0]
>(options)
const paginatedResponse =
await octokit.paginate<
RestEndpointMethodTypes['pulls']['listFiles']['response']['data'][0]
>(options)
core.info(`Found ${paginatedResponse.length} changed files from GitHub API`)
const statusMap: Record<string, ChangeTypeEnum> = {

View File

@@ -6,7 +6,7 @@ import {
getChangeTypeFiles
} from './changedFiles'
import {Inputs} from './inputs'
import {getFilteredChangedFiles, setOutput} from './utils'
import {setOutput} from './utils'
const getOutputKey = (key: string, outputPrefix: string): string => {
return outputPrefix ? `${outputPrefix}_${key}` : key
@@ -14,21 +14,17 @@ const getOutputKey = (key: string, outputPrefix: string): string => {
export const setChangedFilesOutput = async ({
allDiffFiles,
allFilteredDiffFiles,
inputs,
filePatterns = [],
outputPrefix = ''
}: {
allDiffFiles: ChangedFiles
allFilteredDiffFiles: ChangedFiles
inputs: Inputs
filePatterns?: string[]
outputPrefix?: string
}): Promise<void> => {
const allFilteredDiffFiles = await getFilteredChangedFiles({
allDiffFiles,
filePatterns
})
core.debug(`All filtered diff files: ${JSON.stringify(allFilteredDiffFiles)}`)
const addedFiles = await getChangeTypeFiles({
inputs,
changedFiles: allFilteredDiffFiles,

View File

@@ -57,6 +57,8 @@ const getCurrentSHA = async ({
})) === 0
) {
currentSha = github.context.payload.pull_request?.head?.sha
} else if (github.context.eventName === 'merge_group') {
currentSha = github.context.payload.merge_group?.head_sha
} else {
currentSha = await getHeadSha({cwd: workingDirectory})
}
@@ -78,7 +80,7 @@ export interface DiffResult {
initialCommit?: boolean
}
export const getSHAForPushEvent = async (
export const getSHAForNonPullRequestEvent = async (
inputs: Inputs,
env: Env,
workingDirectory: string,
@@ -91,48 +93,70 @@ export const getSHAForPushEvent = async (
const currentBranch = targetBranch
let initialCommit = false
if (isShallow && !inputs.skipInitialFetch) {
core.info('Repository is shallow, fetching more history...')
if (!inputs.skipInitialFetch) {
if (isShallow) {
core.info('Repository is shallow, fetching more history...')
if (isTag) {
const sourceBranch =
github.context.payload.base_ref.replace('refs/heads/', '') ||
github.context.payload.release?.target_commitish
await gitFetch({
cwd: workingDirectory,
args: [
...gitFetchExtraArgs,
'-u',
'--progress',
`--deepen=${inputs.fetchDepth}`,
'origin',
`+refs/heads/${sourceBranch}:refs/remotes/origin/${sourceBranch}`
]
})
if (isTag) {
let sourceBranch = ''
if (github.context.payload.base_ref) {
sourceBranch = github.context.payload.base_ref.replace(
'refs/heads/',
''
)
} else if (github.context.payload.release?.target_commitish) {
sourceBranch = github.context.payload.release?.target_commitish
}
await gitFetch({
cwd: workingDirectory,
args: [
...gitFetchExtraArgs,
'-u',
'--progress',
`--deepen=${inputs.fetchDepth}`,
'origin',
`+refs/heads/${sourceBranch}:refs/remotes/origin/${sourceBranch}`
]
})
} else {
await gitFetch({
cwd: workingDirectory,
args: [
...gitFetchExtraArgs,
'-u',
'--progress',
`--deepen=${inputs.fetchDepth}`,
'origin',
`+refs/heads/${targetBranch}:refs/remotes/origin/${targetBranch}`
]
})
}
if (hasSubmodule) {
await gitFetchSubmodules({
cwd: workingDirectory,
args: [
...gitFetchExtraArgs,
'-u',
'--progress',
`--deepen=${inputs.fetchDepth}`
]
})
}
} else {
await gitFetch({
cwd: workingDirectory,
args: [
...gitFetchExtraArgs,
'-u',
'--progress',
`--deepen=${inputs.fetchDepth}`,
'origin',
`+refs/heads/${targetBranch}:refs/remotes/origin/${targetBranch}`
]
})
}
if (hasSubmodule) {
await gitFetchSubmodules({
cwd: workingDirectory,
args: [
...gitFetchExtraArgs,
'-u',
'--progress',
`--deepen=${inputs.fetchDepth}`
]
})
if (hasSubmodule && inputs.fetchSubmoduleHistory) {
await gitFetchSubmodules({
cwd: workingDirectory,
args: [
...gitFetchExtraArgs,
'-u',
'--progress',
`--deepen=${inputs.fetchDepth}`
]
})
}
}
}
@@ -189,12 +213,17 @@ export const getSHAForPushEvent = async (
previousSha = sha
targetBranch = tag
} else {
core.debug('Getting previous SHA for last remote commit...')
if (
github.context.payload.forced === 'false' ||
!github.context.payload.forced
) {
previousSha = github.context.payload.before
if (github.context.eventName === 'merge_group') {
core.debug('Getting previous SHA for merge group...')
previousSha = github.context.payload.merge_group?.base_sha
} else {
core.debug('Getting previous SHA for last remote commit...')
if (
github.context.payload.forced === 'false' ||
!github.context.payload.forced
) {
previousSha = github.context.payload.before
}
}
if (
@@ -273,55 +302,68 @@ export const getSHAForPullRequestEvent = async (
targetBranch = currentBranch
}
if (isShallow && !inputs.skipInitialFetch) {
if (!inputs.skipInitialFetch) {
core.info('Repository is shallow, fetching more history...')
let prFetchExitCode = await gitFetch({
cwd: workingDirectory,
args: [
...gitFetchExtraArgs,
'-u',
'--progress',
'origin',
`pull/${github.context.payload.pull_request?.number}/head:${currentBranch}`
]
})
if (prFetchExitCode !== 0) {
prFetchExitCode = await gitFetch({
if (isShallow) {
let prFetchExitCode = await gitFetch({
cwd: workingDirectory,
args: [
...gitFetchExtraArgs,
'-u',
'--progress',
`--deepen=${inputs.fetchDepth}`,
'origin',
`+refs/heads/${currentBranch}*:refs/remotes/origin/${currentBranch}*`
]
})
}
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({
cwd: workingDirectory,
args: [
...gitFetchExtraArgs,
'-u',
'--progress',
`--deepen=${inputs.fetchDepth}`,
'origin',
`+refs/heads/${targetBranch}:refs/remotes/origin/${targetBranch}`
`pull/${github.context.payload.pull_request?.number}/head:${currentBranch}`
]
})
if (hasSubmodule) {
if (prFetchExitCode !== 0) {
prFetchExitCode = await gitFetch({
cwd: workingDirectory,
args: [
...gitFetchExtraArgs,
'-u',
'--progress',
`--deepen=${inputs.fetchDepth}`,
'origin',
`+refs/heads/${currentBranch}*:refs/remotes/origin/${currentBranch}*`
]
})
}
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({
cwd: workingDirectory,
args: [
...gitFetchExtraArgs,
'-u',
'--progress',
`--deepen=${inputs.fetchDepth}`,
'origin',
`+refs/heads/${targetBranch}:refs/remotes/origin/${targetBranch}`
]
})
if (hasSubmodule) {
await gitFetchSubmodules({
cwd: workingDirectory,
args: [
...gitFetchExtraArgs,
'-u',
'--progress',
`--deepen=${inputs.fetchDepth}`
]
})
}
}
} else {
if (hasSubmodule && inputs.fetchSubmoduleHistory) {
await gitFetchSubmodules({
cwd: workingDirectory,
args: [

View File

@@ -29,9 +29,12 @@ export type Inputs = {
dirNames: boolean
dirNamesMaxDepth?: number
dirNamesExcludeCurrentDir: boolean
dirNamesIncludeFiles: string
dirNamesIncludeFilesSeparator: string
json: boolean
escapeJson: boolean
fetchDepth?: number
fetchSubmoduleHistory?: boolean
sinceLastRemoteCommit: boolean
writeOutputFiles: boolean
outputDir: string
@@ -135,6 +138,16 @@ export const getInputs = (): Inputs => {
required: false
}
)
const dirNamesIncludeFiles = core.getInput('dir_names_include_files', {
required: false
})
const dirNamesIncludeFilesSeparator = core.getInput(
'dir_names_include_files_separator',
{
required: false,
trimWhitespace: false
}
)
const json = core.getBooleanInput('json', {required: false})
const escapeJson = core.getBooleanInput('escape_json', {required: false})
const fetchDepth = core.getInput('fetch_depth', {required: false})
@@ -177,6 +190,12 @@ export const getInputs = (): Inputs => {
const skipInitialFetch = core.getBooleanInput('skip_initial_fetch', {
required: false
})
const fetchSubmoduleHistory = core.getBooleanInput(
'fetch_additional_submodule_history',
{
required: false
}
)
const inputs: Inputs = {
files,
@@ -212,17 +231,20 @@ export const getInputs = (): Inputs => {
includeAllOldNewRenamedFiles,
oldNewSeparator,
oldNewFilesSeparator,
skipInitialFetch,
fetchSubmoduleHistory,
// End Not Supported via REST API
dirNames,
dirNamesExcludeCurrentDir,
dirNamesIncludeFiles,
dirNamesIncludeFilesSeparator,
json,
escapeJson,
writeOutputFiles,
outputDir,
outputRenamedFilesAsDeletedAndAdded,
token,
apiUrl,
skipInitialFetch
apiUrl
}
if (fetchDepth) {

View File

@@ -11,13 +11,14 @@ import {
import {setChangedFilesOutput} from './changedFilesOutput'
import {
DiffResult,
getSHAForPullRequestEvent,
getSHAForPushEvent
getSHAForNonPullRequestEvent,
getSHAForPullRequestEvent
} from './commitSha'
import {Env, getEnv} from './env'
import {getInputs, Inputs} from './inputs'
import {
getFilePatterns,
getFilteredChangedFiles,
getRecoverFilePatterns,
getSubmodulePath,
getYamlFilePatterns,
@@ -43,10 +44,18 @@ const changedFilesOutput = async ({
}): Promise<void> => {
if (filePatterns.length > 0) {
core.startGroup('changed-files-patterns')
const allFilteredDiffFiles = await getFilteredChangedFiles({
allDiffFiles,
filePatterns
})
core.debug(
`All filtered diff files: ${JSON.stringify(allFilteredDiffFiles)}`
)
await setChangedFilesOutput({
allDiffFiles,
filePatterns,
inputs
allFilteredDiffFiles,
inputs,
filePatterns
})
core.info('All Done!')
core.endGroup()
@@ -55,11 +64,21 @@ const changedFilesOutput = async ({
if (Object.keys(yamlFilePatterns).length > 0) {
for (const key of Object.keys(yamlFilePatterns)) {
core.startGroup(`changed-files-yaml-${key}`)
const allFilteredDiffFiles = await getFilteredChangedFiles({
allDiffFiles,
filePatterns: yamlFilePatterns[key]
})
core.debug(
`All filtered diff files for ${key}: ${JSON.stringify(
allFilteredDiffFiles
)}`
)
await setChangedFilesOutput({
allDiffFiles,
allFilteredDiffFiles,
inputs,
filePatterns: yamlFilePatterns[key],
outputPrefix: key,
inputs
outputPrefix: key
})
core.info('All Done!')
core.endGroup()
@@ -70,6 +89,7 @@ const changedFilesOutput = async ({
core.startGroup('changed-files-all')
await setChangedFilesOutput({
allDiffFiles,
allFilteredDiffFiles: allDiffFiles,
inputs
})
core.info('All Done!')
@@ -130,7 +150,7 @@ const getChangedFilesFromLocalGit = async ({
if (!github.context.payload.pull_request?.base?.ref) {
core.info(`Running on a ${github.context.eventName || 'push'} event...`)
diffResult = await getSHAForPushEvent(
diffResult = await getSHAForNonPullRequestEvent(
inputs,
env,
workingDirectory,
@@ -294,7 +314,11 @@ export async function run(): Promise<void> {
'sinceLastRemoteCommit',
'recoverDeletedFiles',
'recoverDeletedFilesToDestination',
'includeAllOldNewRenamedFiles'
'recoverFiles',
'recoverFilesIgnore',
'includeAllOldNewRenamedFiles',
'skipInitialFetch',
'fetchSubmoduleHistory'
]
for (const input of unsupportedInputs) {

View File

@@ -12,17 +12,20 @@ import {ChangedFiles, ChangeTypeEnum} from './changedFiles'
import {Inputs} from './inputs'
const IS_WINDOWS = process.platform === 'win32'
const MINIMUM_GIT_VERSION = '2.18.0'
export const isWindows = (): boolean => {
return process.platform === 'win32'
}
/**
* Normalize file path separators to '/' on Windows and Linux/macOS
* @param p file path
* Normalize file path separators to '/' on Linux/macOS and '\\' on Windows
* @param p - file path
* @returns file path with normalized separators
*/
const normalizeSeparators = (p: string): string => {
export const normalizeSeparators = (p: string): string => {
// Windows
if (IS_WINDOWS) {
if (isWindows()) {
// Convert slashes on Windows
p = p.replace(/\//g, '\\')
@@ -37,7 +40,7 @@ const normalizeSeparators = (p: string): string => {
/**
* Trims unnecessary trailing slash from file path
* @param p file path
* @param p - file path
* @returns file path without unnecessary trailing slash
*/
const safeTrimTrailingSeparator = (p: string): string => {
@@ -60,7 +63,7 @@ const safeTrimTrailingSeparator = (p: string): string => {
}
// On Windows, avoid trimming the drive root, e.g. C:\ or \\hello
if (IS_WINDOWS && /^[A-Z]:\\$/i.test(p)) {
if (isWindows() && /^[A-Z]:\\$/i.test(p)) {
return p
}
@@ -68,12 +71,18 @@ const safeTrimTrailingSeparator = (p: string): string => {
return p.substring(0, p.length - 1)
}
const dirname = (p: string): string => {
/**
* Gets the dirname of a path, similar to the Node.js path.dirname() function except that this function
* also works for Windows UNC root paths, e.g. \\hello\world
* @param p - file path
* @returns dirname of path
*/
export const getDirname = (p: string): string => {
// Normalize slashes and trim unnecessary trailing slash
p = safeTrimTrailingSeparator(p)
// Windows UNC root, e.g. \\hello or \\hello\world
if (IS_WINDOWS && /^\\\\[^\\]+(\\[^\\]+)?$/.test(p)) {
if (isWindows() && /^\\\\[^\\]+(\\[^\\]+)?$/.test(p)) {
return p
}
@@ -81,18 +90,31 @@ const dirname = (p: string): string => {
let result = path.dirname(p)
// Trim trailing slash for Windows UNC root, e.g. \\hello\world\
if (IS_WINDOWS && /^\\\\[^\\]+\\[^\\]+\\$/.test(result)) {
if (isWindows() && /^\\\\[^\\]+\\[^\\]+\\$/.test(result)) {
result = safeTrimTrailingSeparator(result)
}
return result
}
/**
* Converts the version string to a number
* @param version - version string
* @returns version number
*/
const versionToNumber = (version: string): number => {
const [major, minor, patch] = version.split('.').map(Number)
return major * 1000000 + minor * 1000 + patch
}
/**
* Verifies the minimum required git version
* @returns minimum required git version
* @throws Minimum git version requirement is not met
* @throws Git is not installed
* @throws Git is not found in PATH
* @throws An unexpected error occurred
*/
export const verifyMinimumGitVersion = async (): Promise<void> => {
const {exitCode, stdout, stderr} = await exec.getExecOutput(
'git',
@@ -113,6 +135,11 @@ export const verifyMinimumGitVersion = async (): Promise<void> => {
}
}
/**
* Checks if a path exists
* @param filePath - path to check
* @returns path exists
*/
const exists = async (filePath: string): Promise<boolean> => {
try {
await fs.access(filePath)
@@ -122,6 +149,11 @@ const exists = async (filePath: string): Promise<boolean> => {
}
}
/**
* Generates lines of a file as an async iterable iterator
* @param filePath - path of file to read
* @param excludedFiles - whether to exclude files
*/
async function* lineOfFileGenerator({
filePath,
excludedFiles
@@ -153,6 +185,11 @@ async function* lineOfFileGenerator({
}
}
/**
* Gets the file patterns from a source file
* @param filePaths - paths of files to read
* @param excludedFiles - whether to exclude the file patterns
*/
const getFilesFromSourceFile = async ({
filePaths,
excludedFiles = false
@@ -169,6 +206,12 @@ const getFilesFromSourceFile = async ({
return lines
}
/**
* Sets the global git configs
* @param name - name of config
* @param value - value of config
* @throws Couldn't update git global config
*/
export const updateGitGlobalConfig = async ({
name,
value
@@ -191,6 +234,11 @@ export const updateGitGlobalConfig = async ({
}
}
/**
* Checks if a git repository is shallow
* @param cwd - working directory
* @returns repository is shallow
*/
export const isRepoShallow = async ({cwd}: {cwd: string}): Promise<boolean> => {
const {stdout} = await exec.getExecOutput(
'git',
@@ -204,6 +252,11 @@ export const isRepoShallow = async ({cwd}: {cwd: string}): Promise<boolean> => {
return stdout.trim() === 'true'
}
/**
* Checks if a submodule exists
* @param cwd - working directory
* @returns submodule exists
*/
export const submoduleExists = async ({
cwd
}: {
@@ -227,6 +280,11 @@ export const submoduleExists = async ({
return stdout.trim() !== ''
}
/**
* Fetches the git repository
* @param args - arguments for fetch command
* @param cwd - working directory
*/
export const gitFetch = async ({
args,
cwd
@@ -243,6 +301,11 @@ export const gitFetch = async ({
return exitCode
}
/**
* Fetches the git repository submodules
* @param args - arguments for fetch command
* @param cwd - working directory
*/
export const gitFetchSubmodules = async ({
args,
cwd
@@ -266,10 +329,10 @@ export const gitFetchSubmodules = async ({
}
}
const normalizePath = (p: string): string => {
return p.replace(/\\/g, '/')
}
/**
* Retrieves all the submodule paths
* @param cwd - working directory
*/
export const getSubmodulePath = async ({
cwd
}: {
@@ -293,9 +356,17 @@ export const getSubmodulePath = async ({
return stdout
.trim()
.split('\n')
.map((line: string) => normalizePath(line.trim().split(' ')[1]))
.map((line: string) => normalizeSeparators(line.trim().split(' ')[1]))
}
/**
* Retrieves commit sha of a submodule from a parent commit
* @param cwd - working directory
* @param parentSha1 - parent commit sha
* @param parentSha2 - parent commit sha
* @param submodulePath - path of submodule
* @param diff - diff type between parent commits (`..` or `...`)
*/
export const gitSubmoduleDiffSHA = async ({
cwd,
parentSha1,
@@ -311,7 +382,7 @@ export const gitSubmoduleDiffSHA = async ({
}): Promise<{previousSha?: string; currentSha?: string}> => {
const {stdout} = await exec.getExecOutput(
'git',
['diff', parentSha1, parentSha2, '--', submodulePath],
['diff', `${parentSha1}${diff}${parentSha2}`, '--', submodulePath],
{
cwd,
silent: !core.isDebug()
@@ -398,16 +469,28 @@ export const gitRenamedFiles = async ({
core.debug(`Renamed file: ${line}`)
const [, oldPath, newPath] = line.split('\t')
if (isSubmodule) {
return `${normalizePath(
return `${normalizeSeparators(
path.join(parentDir, oldPath)
)}${oldNewSeparator}${normalizePath(path.join(parentDir, newPath))}`
)}${oldNewSeparator}${normalizeSeparators(
path.join(parentDir, newPath)
)}`
}
return `${normalizePath(oldPath)}${oldNewSeparator}${normalizePath(
newPath
)}`
return `${normalizeSeparators(
oldPath
)}${oldNewSeparator}${normalizeSeparators(newPath)}`
})
}
/**
* Retrieves all the changed files between two commits
* @param cwd - working directory
* @param sha1 - commit sha
* @param sha2 - commit sha
* @param diff - diff type between parent commits (`..` or `...`)
* @param isSubmodule - is the repo a submodule
* @param parentDir - parent directory of the submodule
* @param outputRenamedFilesAsDeletedAndAdded - output renamed files as deleted and added
*/
export const getAllChangedFiles = async ({
cwd,
sha1,
@@ -474,11 +557,11 @@ export const getAllChangedFiles = async ({
for (const line of lines) {
const [changeType, filePath, newPath = ''] = line.split('\t')
const normalizedFilePath = isSubmodule
? normalizePath(path.join(parentDir, filePath))
: normalizePath(filePath)
? normalizeSeparators(path.join(parentDir, filePath))
: normalizeSeparators(filePath)
const normalizedNewPath = isSubmodule
? normalizePath(path.join(parentDir, newPath))
: normalizePath(newPath)
? normalizeSeparators(path.join(parentDir, newPath))
: normalizeSeparators(newPath)
if (changeType.startsWith('R')) {
if (outputRenamedFilesAsDeletedAndAdded) {
@@ -494,6 +577,11 @@ export const getAllChangedFiles = async ({
return changedFiles
}
/**
* Filters the changed files by the file patterns
* @param allDiffFiles - all the changed files
* @param filePatterns - file patterns to filter by
*/
export const getFilteredChangedFiles = async ({
allDiffFiles,
filePatterns
@@ -512,15 +600,16 @@ export const getFilteredChangedFiles = async ({
[ChangeTypeEnum.Unknown]: []
}
const hasFilePatterns = filePatterns.length > 0
const isWin = isWindows()
for (const changeType of Object.keys(allDiffFiles)) {
const files = allDiffFiles[changeType as ChangeTypeEnum]
if (hasFilePatterns) {
changedFiles[changeType as ChangeTypeEnum] = mm(files, filePatterns, {
dot: true,
windows: IS_WINDOWS,
windows: isWin,
noext: true
})
}).map(normalizeSeparators)
} else {
changedFiles[changeType as ChangeTypeEnum] = files
}
@@ -650,7 +739,7 @@ export const getPreviousGitTag = async ({
}): Promise<{tag: string; sha: string}> => {
const {stdout} = await exec.getExecOutput(
'git',
['tag', '--sort=-version:refname'],
['tag', '--sort=-creatordate'],
{
cwd,
silent: !core.isDebug()
@@ -691,9 +780,58 @@ export const canDiffCommits = async ({
sha2: string
diff: string
}): Promise<boolean> => {
const {exitCode, stderr} = await exec.getExecOutput(
if (diff === '...') {
const mergeBase = await getMergeBase(cwd, sha1, sha2)
if (!mergeBase) {
core.warning(`Unable to find merge base between ${sha1} and ${sha2}`)
return false
}
const {exitCode, stderr} = await exec.getExecOutput(
'git',
['log', '--format=%H', `${mergeBase}..${sha2}`],
{
cwd,
ignoreReturnCode: true,
silent: !core.isDebug()
}
)
if (exitCode !== 0) {
core.warning(stderr || `Error checking commit history`)
return false
}
return true
} else {
const {exitCode, stderr} = await exec.getExecOutput(
'git',
['diff', '--quiet', sha1, sha2],
{
cwd,
ignoreReturnCode: true,
silent: !core.isDebug()
}
)
if (exitCode !== 0) {
core.warning(stderr || `Error checking commit history`)
return false
}
return true
}
}
const getMergeBase = async (
cwd: string,
sha1: string,
sha2: string
): Promise<string | null> => {
const {exitCode, stdout} = await exec.getExecOutput(
'git',
['diff', '--name-only', '--ignore-submodules=all', `${sha1}${diff}${sha2}`],
['merge-base', sha1, sha2],
{
cwd,
ignoreReturnCode: true,
@@ -702,23 +840,22 @@ export const canDiffCommits = async ({
)
if (exitCode !== 0) {
core.warning(stderr || `Unable find merge base between ${sha1} and ${sha2}`)
return false
return null
}
return true
return stdout.trim()
}
export const getDirnameMaxDepth = ({
pathStr,
relativePath,
dirNamesMaxDepth,
excludeCurrentDir
}: {
pathStr: string
relativePath: string
dirNamesMaxDepth?: number
excludeCurrentDir?: boolean
}): string => {
const pathArr = dirname(pathStr).split(path.sep)
const pathArr = getDirname(relativePath).split(path.sep)
const maxDepth = Math.min(dirNamesMaxDepth || pathArr.length, pathArr.length)
let output = pathArr[0]
@@ -730,7 +867,7 @@ export const getDirnameMaxDepth = ({
return ''
}
return normalizePath(output)
return normalizeSeparators(output)
}
export const jsonOutput = ({
@@ -745,6 +882,16 @@ export const jsonOutput = ({
return shouldEscape ? result.replace(/"/g, '\\"') : result
}
export const getDirNamesIncludeFilesPattern = ({
inputs
}: {
inputs: Inputs
}): string[] => {
return inputs.dirNamesIncludeFiles
.split(inputs.dirNamesIncludeFilesSeparator)
.filter(Boolean)
}
export const getFilePatterns = async ({
inputs,
workingDirectory
@@ -754,7 +901,7 @@ export const getFilePatterns = async ({
}): Promise<string[]> => {
let filePatterns = inputs.files
.split(inputs.filesSeparator)
.filter(p => p !== '')
.filter(Boolean)
.join('\n')
if (inputs.filesFromSourceFile !== '') {
@@ -815,12 +962,12 @@ export const getFilePatterns = async ({
filePatterns = filePatterns.concat('\n', filesIgnoreFromSourceFiles)
}
if (IS_WINDOWS) {
if (isWindows()) {
filePatterns = filePatterns.replace(/\r\n/g, '\n')
filePatterns = filePatterns.replace(/\r/g, '\n')
}
core.debug(`file patterns: ${filePatterns}`)
core.debug(`Input file patterns: ${filePatterns}`)
return filePatterns
.trim()
@@ -830,10 +977,10 @@ export const getFilePatterns = async ({
if (pattern.endsWith('/')) {
return `${pattern}**`
} else {
const pathParts = pattern.split(path.sep)
const pathParts = pattern.split('/')
const lastPart = pathParts[pathParts.length - 1]
if (!lastPart.includes('.')) {
return `${pattern}${path.sep}**`
if (!lastPart.includes('.') && !lastPart.includes('*')) {
return `${pattern}/**`
} else {
return pattern
}
@@ -893,17 +1040,17 @@ const getYamlFilePatternsFromContents = async ({
if (doc.errors.length > 0) {
if (filePath) {
core.warning(`YAML errors in ${filePath}: ${doc.errors}`)
throw new Error(`YAML errors in ${filePath}: ${doc.errors}`)
} else {
core.warning(`YAML errors: ${doc.errors}`)
throw new Error(`YAML errors: ${doc.errors}`)
}
}
if (doc.warnings.length > 0) {
if (filePath) {
core.warning(`YAML warnings in ${filePath}: ${doc.warnings}`)
throw new Error(`YAML warnings in ${filePath}: ${doc.warnings}`)
} else {
core.warning(`YAML warnings: ${doc.warnings}`)
throw new Error(`YAML warnings: ${doc.warnings}`)
}
}
@@ -1129,7 +1276,7 @@ export const recoverDeletedFiles = async ({
if (recoverPatterns.length > 0) {
recoverableDeletedFiles = mm(deletedFiles, recoverPatterns, {
dot: true,
windows: IS_WINDOWS,
windows: isWindows(),
noext: true
})
core.debug(`filtered recoverable deleted files: ${recoverableDeletedFiles}`)
@@ -1164,9 +1311,7 @@ export const hasLocalGitDirectory = async ({
}: {
workingDirectory: string
}): Promise<boolean> => {
const insideWorkTree = await isInsideWorkTree({
return await isInsideWorkTree({
cwd: workingDirectory
})
return insideWorkTree
}

1258
yarn.lock

File diff suppressed because it is too large Load Diff