Compare commits

...

97 Commits

Author SHA1 Message Date
Tonye Jack
a21a533a0c Update test.yml 2023-09-19 14:21:54 -06:00
Tonye Jack
eeb169a9f9 chore: add codacy config (#1590)
Co-authored-by: GitHub Action <action@github.com>
2023-09-19 14:19:15 -06:00
Arthur
951140b94a fix: changed_keys and modified_keys output to handle json and escape_json inputs (#1585)
Co-authored-by: Arthur Volant <arthur.volant@adevinta.com>
Co-authored-by: Tonye Jack <jtonye@ymail.com>
Co-authored-by: repo-ranger[bot] <39074581+repo-ranger[bot]@users.noreply.github.com>
2023-09-19 19:18:22 +00:00
Tonye Jack
dbf0700c7a fix: error with test (#1589) 2023-09-19 12:10:14 -06:00
tj-actions[bot]
dacbaebcaf Updated README.md (#1588)
Co-authored-by: jackton1 <jackton1@users.noreply.github.com>
2023-09-19 16:58:27 +00:00
allcontributors[bot]
36ab2fe9c2 docs: add V0lantis as a contributor for bug (#1587)
Co-authored-by: allcontributors[bot] <46447321+allcontributors[bot]@users.noreply.github.com>
2023-09-19 10:39:08 -06:00
Tonye Jack
7e3a4bac80 chore: Update test.yml (#1586) 2023-09-19 16:09:34 +00:00
Tonye Jack
dcbe9805f4 chore: move variable declaration (#1584)
Co-authored-by: repo-ranger[bot] <39074581+repo-ranger[bot]@users.noreply.github.com>
Co-authored-by: tj-actions[bot] <109116665+tj-actions-bot@users.noreply.github.com>
Co-authored-by: GitHub Action <action@github.com>
2023-09-18 23:37:47 +00:00
tj-actions[bot]
fd73c1248c Upgraded to v39.1.0 (#1583)
Co-authored-by: jackton1 <jackton1@users.noreply.github.com>
2023-09-18 20:39:02 +00:00
tj-actions[bot]
8e79ba7ab9 Updated README.md (#1582)
Co-authored-by: repo-ranger[bot] <repo-ranger[bot]@users.noreply.github.com>
2023-09-18 14:22:58 -06:00
Tonye Jack
5db7b578d5 feat: add support for returning YAML keys for paths that have changed (#1581)
Co-authored-by: GitHub Action <action@github.com>
2023-09-18 20:17:46 +00:00
renovate[bot]
a17e8c5252 chore(deps): update typescript-eslint monorepo to v6.7.2 2023-09-18 19:14:08 +00:00
renovate[bot]
d1e9506b19 chore(deps): lock file maintenance 2023-09-18 02:01:10 +00:00
tj-actions[bot]
1fdfe0928a Upgraded to v39.0.3 (#1577)
Co-authored-by: jackton1 <jackton1@users.noreply.github.com>
2023-09-17 21:34:54 +00:00
Tonye Jack
76c4d81a6a chore: cleanup imports (#1576) 2023-09-17 03:16:01 +00:00
Tonye Jack
d8904df6c5 chore: refactor function (#1572)
Co-authored-by: GitHub Action <action@github.com>
Co-authored-by: repo-ranger[bot] <39074581+repo-ranger[bot]@users.noreply.github.com>
2023-09-16 11:44:37 +00:00
renovate[bot]
662c03ea61 chore(deps): update dependency @types/node to v20.6.2 2023-09-16 09:06:38 +00:00
renovate[bot]
c8b7da7226 chore(deps): update dependency eslint-plugin-jest to v27.4.0 2023-09-16 00:28:53 +00:00
renovate[bot]
249c1698c5 chore(deps): update dependency @types/jest to v29.5.5 2023-09-15 22:09:24 +00:00
renovate[bot]
17352b2176 chore(deps): update dependency @types/node to v20.6.1 2023-09-15 08:58:26 +00:00
tj-actions[bot]
e8e6614779 Updated README.md (#1570)
Co-authored-by: jackton1 <jackton1@users.noreply.github.com>
2023-09-14 22:07:53 -06:00
Tonye Jack
ad4b06d999 Update README.md 2023-09-14 21:59:38 -06:00
Tonye Jack
b1a34eb336 Update README.md 2023-09-14 21:58:35 -06:00
Tonye Jack
d9a6ccb099 chore: update README.md (#1569) 2023-09-14 17:38:21 +00:00
renovate[bot]
090eb05f17 chore(deps): update dependency @types/uuid to v9.0.4 2023-09-14 15:58:41 +00:00
tj-actions[bot]
690bef673a Updated README.md (#1566)
Co-authored-by: repo-ranger[bot] <repo-ranger[bot]@users.noreply.github.com>
2023-09-13 17:36:28 +00:00
Tonye Jack
fb8d2c9c29 chore: update input description (#1565) 2023-09-13 17:25:26 +00:00
Tonye Jack
bb3b39cd33 Update README.md 2023-09-13 07:45:12 -06:00
renovate[bot]
001f56257c chore(deps): update dependency jest to v29.7.0 2023-09-12 09:59:39 +00:00
tj-actions[bot]
57245a9721 Upgraded to v39.0.2 (#1563)
Co-authored-by: jackton1 <jackton1@users.noreply.github.com>
2023-09-12 02:19:34 +00:00
renovate[bot]
6ee9cdc581 chore(deps): update typescript-eslint monorepo to v6.7.0 2023-09-11 19:21:13 +00:00
GitHub Action
dc40835d4d Added missing changes and modified dist assets. 2023-09-11 17:08:01 +00:00
renovate[bot]
7e3122dc95 fix(deps): update dependency @actions/core to v1.10.1 2023-09-11 17:08:01 +00:00
renovate[bot]
073479583b chore(deps): lock file maintenance 2023-09-09 12:28:32 +00:00
renovate[bot]
d76ddeeeaa chore(deps): lock file maintenance 2023-09-09 03:38:50 +00:00
tj-actions[bot]
7cdc56dd7a Upgraded to v39.0.1 (#1557)
Co-authored-by: jackton1 <jackton1@users.noreply.github.com>
2023-09-09 03:25:27 +00:00
Tonye Jack
246636f5fa fix: bug returning empty output for pull request close event (#1556)
Co-authored-by: GitHub Action <action@github.com>
2023-09-09 03:02:46 +00:00
Tonye Jack
fe0fb71961 Update README.md 2023-09-08 20:43:21 -06:00
Tonye Jack
e60a7a9173 Update README.md 2023-09-08 20:41:04 -06:00
Tonye Jack
81bb5d8954 chore: update check (#1555)
Co-authored-by: GitHub Action <action@github.com>
2023-09-09 01:39:42 +00:00
Tonye Jack
523e8b6f11 fix: raise error when the previous sha cannot be determined and since_last_remote_commit is true (#1554)
Co-authored-by: GitHub Action <action@github.com>
2023-09-08 19:18:37 -06:00
renovate[bot]
4a0a3c4aa5 chore(deps): update dependency eslint to v8.49.0 2023-09-08 22:14:25 +00:00
renovate[bot]
9dfd3f686b chore(deps): update dependency @types/node to v20.6.0 2023-09-08 21:58:21 +00:00
Tonye Jack
796ac2d08f fix: raise errors when unable to locate the previous commit in local history (#1551)
Co-authored-by: GitHub Action <action@github.com>
2023-09-08 18:31:25 +00:00
tj-actions[bot]
534262e0b2 Updated README.md (#1548)
Co-authored-by: repo-ranger[bot] <repo-ranger[bot]@users.noreply.github.com>
2023-09-08 12:12:32 +00:00
Tonye Jack
673189f77b chore: Update docs to site example (#1547) 2023-09-08 12:00:24 +00:00
tj-actions[bot]
89cb9ea919 Updated README.md (#1546)
Co-authored-by: renovate[bot] <renovate[bot]@users.noreply.github.com>
2023-09-07 15:01:23 +00:00
renovate[bot]
7113206187 chore(deps): lock file maintenance 2023-09-07 14:48:08 +00:00
Tonye Jack
926a3fd777 chore: add warning on valid output keys (#1544) 2023-09-07 14:27:55 +00:00
renovate[bot]
de23f62d1e chore(deps): update reviewdog/action-shellcheck action to v1.19 2023-09-06 23:38:08 +00:00
renovate[bot]
afbabc4364 chore(deps): update dependency @vercel/ncc to ^0.38.0 2023-09-06 20:49:21 +00:00
renovate[bot]
eda0811ed2 chore(deps): update tj-actions/eslint-changed-files action to v21 (#1539)
Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>
2023-09-06 04:39:25 +00:00
renovate[bot]
bda67fc879 chore(deps): update dependency @types/lodash to v4.14.198 2023-09-05 22:15:21 +00:00
Tonye Jack
5a5d398e5f chore: Update sync-release-version.yml (#1537)
Co-authored-by: repo-ranger[bot] <39074581+repo-ranger[bot]@users.noreply.github.com>
2023-09-04 22:11:32 +00:00
tj-actions[bot]
f699bde5ad Upgraded to v39 (#1536)
Co-authored-by: jackton1 <jackton1@users.noreply.github.com>
2023-09-04 21:46:56 +00:00
Tonye Jack
48566bbcc2 upgrade: nodejs to v20 (#1535) 2023-09-04 15:29:37 -06:00
renovate[bot]
d68a6666be chore(deps): lock file maintenance 2023-09-04 21:10:22 +00:00
tj-actions[bot]
07660d51a9 Upgraded to v38.2.2 (#1533)
Co-authored-by: jackton1 <jackton1@users.noreply.github.com>
Co-authored-by: repo-ranger[bot] <39074581+repo-ranger[bot]@users.noreply.github.com>
2023-09-04 20:54:35 +00:00
Tonye Jack
632c84dcca Update README.md 2023-09-04 14:42:58 -06:00
renovate[bot]
1aee3621b1 chore(deps): lock file maintenance 2023-09-04 20:19:43 +00:00
Tonye Jack
8d335b7b7d fix: bug with outputs when json is set to true (#1531)
Co-authored-by: GitHub Action <action@github.com>
Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>
2023-09-04 20:03:32 +00:00
renovate[bot]
fd460fa3ba chore(deps): update typescript-eslint monorepo to v6.6.0 2023-09-04 18:30:15 +00:00
renovate[bot]
5b84ed26a3 chore(deps): update actions/checkout action to v4 (#1527)
Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>
2023-09-04 13:21:19 +00:00
renovate[bot]
e03c026bf4 chore(deps): lock file maintenance 2023-09-04 02:06:29 +00:00
renovate[bot]
5704310356 chore(deps): update dependency @types/node to v20.5.9 2023-09-02 23:52:01 +00:00
renovate[bot]
c922361eb2 chore(deps): update dependency @types/node to v20.5.8 2023-09-01 21:02:17 +00:00
tj-actions[bot]
48576e6584 Upgraded to v38.2.1 (#1523)
Co-authored-by: jackton1 <jackton1@users.noreply.github.com>
Co-authored-by: repo-ranger[bot] <39074581+repo-ranger[bot]@users.noreply.github.com>
2023-09-01 20:46:15 +00:00
renovate[bot]
79d644d1a2 chore(deps): lock file maintenance 2023-09-01 20:30:38 +00:00
Tonye Jack
2f7246cb26 chore: update warning message (#1521)
Co-authored-by: repo-ranger[bot] <39074581+repo-ranger[bot]@users.noreply.github.com>
Co-authored-by: GitHub Action <action@github.com>
2023-09-01 14:07:33 -06:00
Tonye Jack
8476756ae3 fix: bug matching patterns (#1520)
Co-authored-by: GitHub Action <action@github.com>
2023-09-01 19:49:08 +00:00
dependabot[bot]
d90c240f2a chore(deps): bump test/demo from 8bbc726 to 5dfac2e (#1518)
Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2023-09-01 07:30:11 -06:00
renovate[bot]
3be651e99d chore(deps): lock file maintenance 2023-09-01 05:09:43 +00:00
Tonye Jack
4fac98a656 Deleted .github/ISSUE_TEMPLATE/feature_request.yaml 2023-08-31 19:07:44 -06:00
Tonye Jack
bed56b29b8 Deleted .github/ISSUE_TEMPLATE/bug_report.yaml 2023-08-31 19:06:17 -06:00
Tonye Jack
2338e28eef Update bug_report.yaml 2023-08-31 18:14:10 -06:00
Tonye Jack
d4eb53db66 Update bug_report.yaml 2023-08-31 18:12:04 -06:00
Tonye Jack
8f777bbc0d Update bug_report.yaml 2023-08-31 18:10:16 -06:00
Tonye Jack
7d256b941a Update bug_report.yaml 2023-08-31 18:08:46 -06:00
Tonye Jack
c3ceccf9bc Delete FUNDING.yml 2023-08-30 19:50:24 -06:00
renovate[bot]
c89928824f chore(deps): lock file maintenance 2023-08-31 01:09:07 +00:00
tj-actions[bot]
047f654646 Upgraded to v38.2.0 (#1515)
Co-authored-by: jackton1 <jackton1@users.noreply.github.com>
2023-08-30 21:48:14 +00:00
renovate[bot]
0fc9663aa7 chore(deps): update dependency @types/uuid to v9.0.3 (#1512)
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-08-30 15:10:05 -06:00
tj-actions[bot]
50f623482f Updated README.md (#1514)
Co-authored-by: jackton1 <jackton1@users.noreply.github.com>
2023-08-30 15:09:09 -06:00
Tonye Jack
2e0f79f8b6 Update README.md 2023-08-30 15:02:51 -06:00
tj-actions[bot]
308cb3daf9 Updated README.md (#1513)
Co-authored-by: jackton1 <jackton1@users.noreply.github.com>
2023-08-30 14:56:35 -06:00
Tonye Jack
f1b3c2fa8b feat: add support for failing on error (#1511)
Co-authored-by: GitHub Action <action@github.com>
2023-08-30 14:51:36 -06:00
tj-actions[bot]
2f6d66af9d Updated README.md (#1510)
Co-authored-by: jackton1 <jackton1@users.noreply.github.com>
2023-08-30 17:41:36 +00:00
Tonye Jack
ef21b84507 Update README.md 2023-08-30 11:27:45 -06:00
Tonye Jack
c9dd6721cf Update README.md 2023-08-30 11:23:44 -06:00
renovate[bot]
428519788b chore(deps): update dependency prettier to v3.0.3 2023-08-29 16:09:38 +00:00
renovate[bot]
522df62704 chore(deps): update dependency eslint-plugin-github to v4.10.0 2023-08-29 00:54:55 +00:00
renovate[bot]
d35b677f4b chore(deps): update typescript-eslint monorepo to v6.5.0 2023-08-28 18:57:32 +00:00
GitHub Action
b1c183b83c Added missing changes and modified dist assets. 2023-08-28 15:44:10 +00:00
renovate[bot]
7555f14f91 fix(deps): update dependency yaml to v2.3.2 2023-08-28 15:44:10 +00:00
renovate[bot]
bc2a793022 chore(deps): lock file maintenance 2023-08-28 00:52:59 +00:00
tj-actions[bot]
a40e52b504 Upgraded to v38.1.3 (#1503)
Co-authored-by: jackton1 <jackton1@users.noreply.github.com>
2023-08-26 20:51:29 +00:00
renovate[bot]
c860b5c47f chore(deps): update tj-actions/release-tagger action to v4 (#1502)
Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>
2023-08-26 14:32:03 -06:00
27 changed files with 1965 additions and 1368 deletions

View File

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

4
.codacy.yml Normal file
View File

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

12
.github/FUNDING.yml vendored
View File

@@ -1,12 +0,0 @@
# These are supported funding model platforms
github: jackton1
patreon: # Replace with a single Patreon username
open_collective: tj-actions
ko_fi: # Replace with a single Ko-fi username
tidelift: # Replace with a single Tidelift platform-name/package-name e.g., npm/babel
community_bridge: # Replace with a single Community Bridge project-name e.g., cloud-foundry
liberapay: # Replace with a single Liberapay username
issuehunt: # Replace with a single IssueHunt username
otechie: # Replace with a single Otechie username
custom: []

View File

@@ -1,98 +0,0 @@
name: 🐞 Bug
description: Create a report to help us improve
title: "[BUG] <title>"
labels: [bug, needs triage]
body:
- type: markdown
attributes:
value: |
Thanks for taking the time to fill out this bug report!
- type: checkboxes
attributes:
label: Is there an existing issue for this?
description: Please search to see if an issue already exists for the bug you encountered.
options:
- label: I have searched the existing issues
required: true
- type: checkboxes
attributes:
label: Does this issue exist in the latest version?
description: Please view all releases to confirm that this issue hasn't already been fixed.
options:
- label: I'm using the latest release
required: true
- type: textarea
id: what-happened
attributes:
label: Describe the bug?
description: A clear and concise description of what the bug is
placeholder: Tell us what you see!
validations:
required: true
- type: textarea
id: reproduce
attributes:
label: To Reproduce
description: Steps to reproduce the behavior?
placeholder: |
1. In this environment...
2. With this config...
3. Run '...'
4. See error...
validations:
required: true
- type: dropdown
id: os
attributes:
label: What OS are you seeing the problem on?
multiple: true
options:
- all
- ubuntu-latest or ubuntu-20.04
- ubuntu-18.04
- macos-latest or macos-10.15
- macos-11
- windows-latest or windows-2019
- windows-2016
validations:
required: true
- type: textarea
id: expected
attributes:
label: Expected behavior?
description: A clear and concise description of what you expected to happen.
placeholder: Tell us what you expected!
validations:
required: true
- type: textarea
id: logs
attributes:
label: Relevant log output
description: Please copy and paste any relevant log output which is obtained after enabling debug logging. This will be automatically formatted into code, so no need for backticks.
placeholder: |
1. Re-running the workflow with debug logging enabled.
2. Copy or download the log archive.
3. Paste the contents here or upload the file in a subsequent comment.
render: shell
validations:
required: true
- type: textarea
attributes:
label: Anything else?
description: |
Links? or References?
Anything that will give us more context about the issue you are encountering!
Tip: You can attach images or log files by clicking this area to highlight it and then dragging files in.
validations:
required: false
- type: checkboxes
id: terms
attributes:
label: Code of Conduct
description: By submitting this issue, you agree to follow our [Code of Conduct](../blob/main/CODE_OF_CONDUCT.md)
options:
- label: I agree to follow this project's Code of Conduct
required: true

View File

@@ -1,59 +0,0 @@
name: Feature request
description: Suggest an idea for this project
title: "[Feature] <title>"
labels: [enhancement]
body:
- type: markdown
attributes:
value: |
Thanks for taking the time to fill out this feature request!
- type: checkboxes
attributes:
label: Is this feature missing in the latest version?
description: Please upgrade to the latest version to verify that this feature is still missing.
options:
- label: I'm using the latest release
required: true
- type: textarea
id: what-happened
attributes:
label: Is your feature request related to a problem? Please describe.
description: |
A clear and concise description of what the problem is. Ex. I'm always frustrated when [...]
placeholder: Tell us what you see!
validations:
required: true
- type: textarea
id: requests
attributes:
label: Describe the solution you'd like?
description: A clear and concise description of what you want to happen.
validations:
required: true
- type: textarea
id: alternative
attributes:
label: Describe alternatives you've considered?
description: A clear and concise description of any alternative solutions or features you've considered.
validations:
required: false
- type: textarea
attributes:
label: Anything else?
description: |
Links? or References?
Add any other context or screenshots about the feature request here.
Tip: You can attach images or log files by clicking this area to highlight it and then dragging files in.
validations:
required: false
- type: checkboxes
id: terms
attributes:
label: Code of Conduct
description: By submitting this issue, you agree to follow our [Code of Conduct](../blob/main/CODE_OF_CONDUCT.md)
options:
- label: I agree to follow this project's Code of Conduct
required: true

View File

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

View File

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

View File

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

View File

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

View File

@@ -8,11 +8,11 @@ jobs:
update-version:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- uses: actions/checkout@3df4ab11eba7bda6032a0b82a6bb43b11571feac # v4
with:
fetch-depth: 0
- name: Run release-tagger
uses: tj-actions/release-tagger@v3
uses: tj-actions/release-tagger@v4
- name: Sync release version.
uses: tj-actions/sync-release-version@v13
id: sync-release-version
@@ -21,6 +21,14 @@ jobs:
only_major: true
paths: |
README.md
- name: Sync release package version.
uses: tj-actions/sync-release-version@v13
id: sync-release-package-version
with:
pattern: '"version": "'
strip_prefix: "v"
paths: |
package.json
- name: Run git-cliff
uses: tj-actions/git-cliff@v1
- name: Create Pull Request

View File

@@ -37,26 +37,26 @@ jobs:
steps:
- name: Checkout branch
uses: actions/checkout@v3
uses: actions/checkout@v4
- name: shellcheck
uses: reviewdog/action-shellcheck@v1.18
uses: reviewdog/action-shellcheck@v1.19
build:
runs-on: ubuntu-latest
outputs:
files_changed: ${{ steps.changed_files.outputs.files_changed }}
steps:
- uses: actions/checkout@v3
- uses: actions/checkout@v4
with:
persist-credentials: false
fetch-depth: 0
repository: ${{ github.event.pull_request.head.repo.full_name }}
- name: Use Node.js 16.x
- name: Use Node.js 20.x
uses: actions/setup-node@v3.8.1
with:
cache: 'yarn'
node-version: '16.x'
node-version: '20.x'
- name: Create coverage directory and clover.xml
run: |
@@ -68,7 +68,7 @@ jobs:
yarn install
- name: Run eslint on changed files
uses: tj-actions/eslint-changed-files@v20
uses: tj-actions/eslint-changed-files@v21
if: github.event_name == 'pull_request'
with:
token: ${{ secrets.PAT_TOKEN }}
@@ -123,7 +123,7 @@ jobs:
if: needs.build.outputs.files_changed != 'true'
steps:
- name: Checkout into dir1
uses: actions/checkout@v3
uses: actions/checkout@v4
with:
repository: ${{ github.event.pull_request.head.repo.full_name }}
submodules: true
@@ -163,7 +163,7 @@ jobs:
path: dir2/dist
- name: Checkout into dir2
uses: actions/checkout@v3
uses: actions/checkout@v4
with:
repository: ${{ github.event.pull_request.head.repo.full_name }}
submodules: true
@@ -198,7 +198,7 @@ jobs:
steps:
- name: Checkout branch
uses: actions/checkout@v3
uses: actions/checkout@v4
with:
repository: ${{ github.event.pull_request.head.repo.full_name }}
fetch-depth: 0
@@ -256,7 +256,7 @@ jobs:
steps:
- name: Checkout branch
uses: actions/checkout@v3
uses: actions/checkout@v4
with:
repository: ${{ github.event.pull_request.head.repo.full_name }}
fetch-depth: 0
@@ -294,7 +294,7 @@ jobs:
steps:
- name: Checkout branch
uses: actions/checkout@v3
uses: actions/checkout@v4
with:
repository: ${{ github.event.pull_request.head.repo.full_name }}
fetch-depth: 0
@@ -332,7 +332,7 @@ jobs:
steps:
- name: Checkout branch
uses: actions/checkout@v3
uses: actions/checkout@v4
with:
repository: ${{ github.event.pull_request.head.repo.full_name }}
fetch-depth: ${{ matrix.fetch-depth }}
@@ -364,7 +364,7 @@ jobs:
steps:
- name: Checkout branch
uses: actions/checkout@v3
uses: actions/checkout@v4
with:
ref: ${{ github.event.pull_request.head.sha }}
@@ -396,7 +396,7 @@ jobs:
steps:
- name: Checkout branch
uses: actions/checkout@v3
uses: actions/checkout@v4
with:
fetch-depth: ${{ matrix.fetch-depth }}
persist-credentials: false
@@ -425,7 +425,7 @@ jobs:
steps:
- name: Checkout branch
uses: actions/checkout@v3
uses: actions/checkout@v4
- name: Download build assets
uses: actions/download-artifact@v3
@@ -479,7 +479,7 @@ jobs:
steps:
- name: Checkout branch
uses: actions/checkout@v3
uses: actions/checkout@v4
- name: Download build assets
uses: actions/download-artifact@v3
@@ -534,7 +534,7 @@ jobs:
pull-requests: read
steps:
- name: Checkout into dir1
uses: actions/checkout@v3
uses: actions/checkout@v4
with:
repository: ${{ github.event.pull_request.head.repo.full_name }}
submodules: true
@@ -570,7 +570,7 @@ jobs:
steps:
- name: Checkout branch
uses: actions/checkout@v3
uses: actions/checkout@v4
with:
ref: ${{ github.event.pull_request.head.sha || github.sha }}
submodules: recursive
@@ -613,7 +613,7 @@ jobs:
steps:
- name: Checkout branch
uses: actions/checkout@v3
uses: actions/checkout@v4
with:
ref: ${{ github.event.pull_request.head.sha || github.sha }}
submodules: recursive
@@ -665,7 +665,7 @@ jobs:
steps:
- name: Checkout branch
uses: actions/checkout@v3
uses: actions/checkout@v4
with:
ref: ${{ github.event.pull_request.head.sha || github.sha }}
submodules: recursive
@@ -765,6 +765,12 @@ jobs:
echo "Expected: (test/test deleted.txt) got ${{ steps.changed-files-recover-deleted-files-with-files-yaml.outputs.test_deleted_files }}"
exit 1
- name: Verify that the modified_keys is correct
if: "!contains(steps.changed-files-recover-deleted-files-with-files-yaml.outputs.modified_keys, 'test')"
run: |
echo "Expected: (test) got ${{ steps.changed-files-recover-deleted-files-with-files-yaml.outputs.modified_keys }}"
exit 1
- name: Verify that test/test deleted.txt is restored
run: |
if [ ! -f "test/test deleted.txt" ]; then
@@ -805,6 +811,56 @@ jobs:
else
cat "deleted_files/test/test deleted.txt"
fi
test-since-last-remote-commit:
name: Test changed-files since last remote commit
runs-on: ubuntu-latest
needs: build
if: needs.build.outputs.files_changed != 'true'
strategy:
fail-fast: false
max-parallel: 4
matrix:
fetch-depth: [0, 1, 2]
steps:
- name: Checkout branch
uses: actions/checkout@v4
with:
ref: ${{ github.event.pull_request.head.sha }}
repository: ${{ github.event.pull_request.head.repo.full_name }}
submodules: true
fetch-depth: ${{ matrix.fetch-depth }}
- name: Download build assets
uses: actions/download-artifact@v3
with:
name: build-assets
- name: Run changed-files with since_last_remote_commit
id: changed-files-since-last-remote-commit
continue-on-error: true
uses: ./
with:
since_last_remote_commit: true
- name: Verify failed
if: steps.changed-files-since-last-remote-commit.outcome != 'failure' && matrix.fetch-depth == 1 && github.event.action == 'closed' && github.event_name == 'pull_request'
run: |
echo "Expected: (failure) got ${{ steps.changed-files-since-last-remote-commit.outcome }}"
exit 1
- name: Verify succeeded
if: steps.changed-files-since-last-remote-commit.outcome != 'success' && matrix.fetch-depth != 1
run: |
echo "Expected: (success) got ${{ steps.changed-files-since-last-remote-commit.outcome }}"
exit 1
- name: Show output
run: |
echo '${{ toJSON(steps.changed-files-since-last-remote-commit.outputs) }}'
shell:
bash
test:
name: Test changed-files
@@ -820,7 +876,7 @@ jobs:
steps:
- name: Checkout
uses: actions/checkout@v3
uses: actions/checkout@v4
with:
submodules: true
repository: ${{ github.event.pull_request.head.repo.full_name }}
@@ -841,16 +897,6 @@ jobs:
echo '${{ toJSON(steps.changed-files.outputs) }}'
shell:
bash
- name: Run changed-files with since_last_remote_commit
id: changed-files-since-last-remote-commit
uses: ./
with:
since_last_remote_commit: true
- name: Show output
run: |
echo '${{ toJSON(steps.changed-files-since-last-remote-commit.outputs) }}'
shell:
bash
- name: Run changed-files with dir name
id: changed-files-dir-name
uses: ./
@@ -1029,7 +1075,8 @@ jobs:
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')
!contains(steps.changed-files-dir-names-specific-include-files.outputs.all_changed_files, 'test') ||
steps.changed-files-dir-names-specific-include-files.outputs.any_changed == 'false'
) && 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 }})"
@@ -1040,13 +1087,41 @@ jobs:
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')
!contains(steps.changed-files-dir-names-specific-include-files.outputs.all_changed_files, 'test') ||
steps.changed-files-dir-names-specific-include-files.outputs.any_changed == 'false'
) && 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 dir_names for specific files and an unmatched path
id: changed-files-dir-names-specific-unmatched-path
uses: ./
with:
base_sha: d1c0ee4
sha: 4d04215
fetch_depth: 60000
dir_names: true
files: unknown/**
json: true
- name: Show output
run: |
echo '${{ toJSON(steps.changed-files-dir-names-specific-unmatched-path.outputs) }}'
shell:
bash
- name: Check dir_names output
if: |
(
steps.changed-files-dir-names-specific-unmatched-path.outputs.all_changed_files != '[]' ||
steps.changed-files-dir-names-specific-unmatched-path.outputs.any_changed == 'true' ||
steps.changed-files-dir-names-specific-unmatched-path.outputs.all_changed_files_count != '0'
)
run: |
echo "Invalid output: Expected empty array and any_changed to be false got (${{ steps.changed-files-dir-names-specific-unmatched-path.outputs.all_changed_files }}) and (${{ steps.changed-files-dir-names-specific-unmatched-path.outputs.any_changed }})"
exit 1
shell:
bash
- name: Run changed-files with forward slash separator
id: changed-files-forward-slash
uses: ./

View File

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

2
.nvmrc
View File

@@ -1 +1 @@
16
20

View File

@@ -1,5 +1,263 @@
# Changelog
# [39.1.0](https://github.com/tj-actions/changed-files/compare/v39.0.3...v39.1.0) - (2023-09-18)
## <!-- 0 -->🚀 Features
- Add support for returning YAML keys for paths that have changed ([#1581](https://github.com/tj-actions/changed-files/issues/1581)) ([5db7b57](https://github.com/tj-actions/changed-files/commit/5db7b578d50867ab5781bf9d867e7650b5b39fc4)) - (Tonye Jack)
## <!-- 26 -->🔄 Update
- Updated README.md ([#1582](https://github.com/tj-actions/changed-files/issues/1582))
Co-authored-by: repo-ranger[bot] <repo-ranger[bot]@users.noreply.github.com> ([8e79ba7](https://github.com/tj-actions/changed-files/commit/8e79ba7ab9fee9984275219aeb2c8db47bcb8a2d)) - (tj-actions[bot])
## <!-- 7 -->⚙️ Miscellaneous Tasks
- **deps:** Update typescript-eslint monorepo to v6.7.2 ([a17e8c5](https://github.com/tj-actions/changed-files/commit/a17e8c5252f6c9982b161714c528708a7f445479)) - (renovate[bot])
- **deps:** Lock file maintenance ([d1e9506](https://github.com/tj-actions/changed-files/commit/d1e9506b19d9c3a4053191d616b1ac09de1dfa55)) - (renovate[bot])
## <!-- 9 -->⬆️ Upgrades
- Upgraded to v39.0.3 ([#1577](https://github.com/tj-actions/changed-files/issues/1577))
Co-authored-by: jackton1 <jackton1@users.noreply.github.com> ([1fdfe09](https://github.com/tj-actions/changed-files/commit/1fdfe0928a9a55323f0d333ecf6ccfca8c6d73c9)) - (tj-actions[bot])
# [39.0.3](https://github.com/tj-actions/changed-files/compare/v39.0.2...v39.0.3) - (2023-09-17)
## <!-- 26 -->🔄 Update
- Updated README.md ([#1570](https://github.com/tj-actions/changed-files/issues/1570))
Co-authored-by: jackton1 <jackton1@users.noreply.github.com> ([e8e6614](https://github.com/tj-actions/changed-files/commit/e8e66147790920052eb3032cb5a62c70572bae22)) - (tj-actions[bot])
- Update README.md ([ad4b06d](https://github.com/tj-actions/changed-files/commit/ad4b06d99998aabe50aa36b86f0867357026a7e2)) - (Tonye Jack)
- Update README.md ([b1a34eb](https://github.com/tj-actions/changed-files/commit/b1a34eb336292345947ec693f02ef5fb59954683)) - (Tonye Jack)
- Updated README.md ([#1566](https://github.com/tj-actions/changed-files/issues/1566))
Co-authored-by: repo-ranger[bot] <repo-ranger[bot]@users.noreply.github.com> ([690bef6](https://github.com/tj-actions/changed-files/commit/690bef673ae8df0db1deff98f4c33c8f651ce3b9)) - (tj-actions[bot])
- Update README.md ([bb3b39c](https://github.com/tj-actions/changed-files/commit/bb3b39cd33dab0e736e0f00b67222c3edaaea664)) - (Tonye Jack)
## <!-- 7 -->⚙️ Miscellaneous Tasks
- Cleanup imports ([#1576](https://github.com/tj-actions/changed-files/issues/1576)) ([76c4d81](https://github.com/tj-actions/changed-files/commit/76c4d81a6acd339b55bd7407a016981c853eb702)) - (Tonye Jack)
- Refactor function ([#1572](https://github.com/tj-actions/changed-files/issues/1572)) ([d8904df](https://github.com/tj-actions/changed-files/commit/d8904df6c55e24ee0b072a93387f64ab19b03302)) - (Tonye Jack)
- **deps:** Update dependency @types/node to v20.6.2 ([662c03e](https://github.com/tj-actions/changed-files/commit/662c03ea61a144e0bb71991d27928fe08897109f)) - (renovate[bot])
- **deps:** Update dependency eslint-plugin-jest to v27.4.0 ([c8b7da7](https://github.com/tj-actions/changed-files/commit/c8b7da7226d05c69f882473d9bc05af8475f28fc)) - (renovate[bot])
- **deps:** Update dependency @types/jest to v29.5.5 ([249c169](https://github.com/tj-actions/changed-files/commit/249c1698c5b04bfa024f0af7fa876952cc638660)) - (renovate[bot])
- **deps:** Update dependency @types/node to v20.6.1 ([17352b2](https://github.com/tj-actions/changed-files/commit/17352b21768e018a02c594a8c7b151d0002e5d73)) - (renovate[bot])
- Update README.md ([#1569](https://github.com/tj-actions/changed-files/issues/1569)) ([d9a6ccb](https://github.com/tj-actions/changed-files/commit/d9a6ccb099927ca383d6bf06d0d44e3a4cc03dd9)) - (Tonye Jack)
- **deps:** Update dependency @types/uuid to v9.0.4 ([090eb05](https://github.com/tj-actions/changed-files/commit/090eb05f17c92a8e9b30d65ca4abe71ea35d8671)) - (renovate[bot])
- Update input description ([#1565](https://github.com/tj-actions/changed-files/issues/1565)) ([fb8d2c9](https://github.com/tj-actions/changed-files/commit/fb8d2c9c29d888bc338bd0b5cd23a78f8fd04baa)) - (Tonye Jack)
- **deps:** Update dependency jest to v29.7.0 ([001f562](https://github.com/tj-actions/changed-files/commit/001f56257c66815ba8267ded5207cc6feeb3c4fd)) - (renovate[bot])
## <!-- 9 -->⬆️ Upgrades
- Upgraded to v39.0.2 ([#1563](https://github.com/tj-actions/changed-files/issues/1563))
Co-authored-by: jackton1 <jackton1@users.noreply.github.com> ([57245a9](https://github.com/tj-actions/changed-files/commit/57245a97217e7a73240a81d75f5b3f4d9dc7fb04)) - (tj-actions[bot])
# [39.0.2](https://github.com/tj-actions/changed-files/compare/v39.0.1...v39.0.2) - (2023-09-11)
## <!-- 1 -->🐛 Bug Fixes
- **deps:** Update dependency @actions/core to v1.10.1 ([7e3122d](https://github.com/tj-actions/changed-files/commit/7e3122dc950f53aecf77675b13eb8549fc50702d)) - (renovate[bot])
## <!-- 16 --> Add
- Added missing changes and modified dist assets.
([dc40835](https://github.com/tj-actions/changed-files/commit/dc40835d4da682fdd0d708a18736c67f61dd30bd)) - (GitHub Action)
## <!-- 7 -->⚙️ Miscellaneous Tasks
- **deps:** Update typescript-eslint monorepo to v6.7.0 ([6ee9cdc](https://github.com/tj-actions/changed-files/commit/6ee9cdc5816333acda68e01cf12eedc619e28316)) - (renovate[bot])
- **deps:** Lock file maintenance ([0734795](https://github.com/tj-actions/changed-files/commit/073479583b8aa435de99bca59cf0f1d7c9ca60f1)) - (renovate[bot])
- **deps:** Lock file maintenance ([d76ddee](https://github.com/tj-actions/changed-files/commit/d76ddeeeaafef4ed076ba691b79b2ce022583e29)) - (renovate[bot])
## <!-- 9 -->⬆️ Upgrades
- Upgraded to v39.0.1 ([#1557](https://github.com/tj-actions/changed-files/issues/1557))
Co-authored-by: jackton1 <jackton1@users.noreply.github.com> ([7cdc56d](https://github.com/tj-actions/changed-files/commit/7cdc56dd7a1e035be75e46b4023543b68e58a0ac)) - (tj-actions[bot])
# [39.0.1](https://github.com/tj-actions/changed-files/compare/v39.0.0...v39.0.1) - (2023-09-09)
## <!-- 1 -->🐛 Bug Fixes
- Bug returning empty output for pull request close event ([#1556](https://github.com/tj-actions/changed-files/issues/1556)) ([246636f](https://github.com/tj-actions/changed-files/commit/246636f5fa148b5ad8e65ca4c57b18af3123e5f6)) - (Tonye Jack)
- Raise error when the previous sha cannot be determined and since_last_remote_commit is true ([#1554](https://github.com/tj-actions/changed-files/issues/1554)) ([523e8b6](https://github.com/tj-actions/changed-files/commit/523e8b6f11215082522b8e62c274b358f64422fa)) - (Tonye Jack)
- Raise errors when unable to locate the previous commit in local history ([#1551](https://github.com/tj-actions/changed-files/issues/1551)) ([796ac2d](https://github.com/tj-actions/changed-files/commit/796ac2d08f9344cd0602d9bfe4a0393cdfda6ff7)) - (Tonye Jack)
## <!-- 26 -->🔄 Update
- Update README.md ([fe0fb71](https://github.com/tj-actions/changed-files/commit/fe0fb71961c75e134247bf312ee383e33bc06156)) - (Tonye Jack)
- Update README.md ([e60a7a9](https://github.com/tj-actions/changed-files/commit/e60a7a9173bef6e97132058dd044b946b197f9b6)) - (Tonye Jack)
- Updated README.md ([#1548](https://github.com/tj-actions/changed-files/issues/1548))
Co-authored-by: repo-ranger[bot] <repo-ranger[bot]@users.noreply.github.com> ([534262e](https://github.com/tj-actions/changed-files/commit/534262e0b262de5c56969bb66d47df047cba50ff)) - (tj-actions[bot])
- Updated README.md ([#1546](https://github.com/tj-actions/changed-files/issues/1546))
Co-authored-by: renovate[bot] <renovate[bot]@users.noreply.github.com> ([89cb9ea](https://github.com/tj-actions/changed-files/commit/89cb9ea919269ab73a63fbafb7aed58174e5e411)) - (tj-actions[bot])
## <!-- 7 -->⚙️ Miscellaneous Tasks
- Update check ([#1555](https://github.com/tj-actions/changed-files/issues/1555)) ([81bb5d8](https://github.com/tj-actions/changed-files/commit/81bb5d895445a08f2e12fa348b88cd6aea2e94c4)) - (Tonye Jack)
- **deps:** Update dependency eslint to v8.49.0 ([4a0a3c4](https://github.com/tj-actions/changed-files/commit/4a0a3c4aa538c8f49477d4306b29b349031685d8)) - (renovate[bot])
- **deps:** Update dependency @types/node to v20.6.0 ([9dfd3f6](https://github.com/tj-actions/changed-files/commit/9dfd3f686b90dc76c07e414be407ec7d43bf9e7f)) - (renovate[bot])
- Update docs to site example ([#1547](https://github.com/tj-actions/changed-files/issues/1547)) ([673189f](https://github.com/tj-actions/changed-files/commit/673189f77bde91f43ac9301ef8ebcc4ce105358e)) - (Tonye Jack)
- **deps:** Lock file maintenance ([7113206](https://github.com/tj-actions/changed-files/commit/711320618723bac63c2926a9710f091acbbe736e)) - (renovate[bot])
- Add warning on valid output keys ([#1544](https://github.com/tj-actions/changed-files/issues/1544)) ([926a3fd](https://github.com/tj-actions/changed-files/commit/926a3fd7779d0f54baac89dbb55d6302825ae6f9)) - (Tonye Jack)
- **deps:** Update reviewdog/action-shellcheck action to v1.19 ([de23f62](https://github.com/tj-actions/changed-files/commit/de23f62d1eecad9116a04783c7f26d8885f0733b)) - (renovate[bot])
- **deps:** Update dependency @vercel/ncc to ^0.38.0 ([afbabc4](https://github.com/tj-actions/changed-files/commit/afbabc4364fff08a6b98f3d686abae4217a7123f)) - (renovate[bot])
- **deps:** Update tj-actions/eslint-changed-files action to v21 ([#1539](https://github.com/tj-actions/changed-files/issues/1539)) ([eda0811](https://github.com/tj-actions/changed-files/commit/eda0811ed2364c6ea09da7989ab0e572f2f5fd61)) - (renovate[bot])
- **deps:** Update dependency @types/lodash to v4.14.198 ([bda67fc](https://github.com/tj-actions/changed-files/commit/bda67fc879fa09a72253e0ed6b5cffeac9f14f44)) - (renovate[bot])
- Update sync-release-version.yml ([#1537](https://github.com/tj-actions/changed-files/issues/1537)) ([5a5d398](https://github.com/tj-actions/changed-files/commit/5a5d398e5fb9b4d2776feb62de64e396ecb74de8)) - (Tonye Jack)
## <!-- 9 -->⬆️ Upgrades
- Upgraded to v39 ([#1536](https://github.com/tj-actions/changed-files/issues/1536))
Co-authored-by: jackton1 <jackton1@users.noreply.github.com> ([f699bde](https://github.com/tj-actions/changed-files/commit/f699bde5ad428fbc4281b9ca6865153f4b1e7a55)) - (tj-actions[bot])
# [39.0.0](https://github.com/tj-actions/changed-files/compare/v38.2.2...v39.0.0) - (2023-09-04)
## <!-- 26 -->🔄 Update
- Update README.md ([632c84d](https://github.com/tj-actions/changed-files/commit/632c84dcca8d5cbc35825d0cddfd0c2870886adc)) - (Tonye Jack)
## <!-- 7 -->⚙️ Miscellaneous Tasks
- **deps:** Lock file maintenance ([d68a666](https://github.com/tj-actions/changed-files/commit/d68a6666bebcffa866de06e2468374eda79f6187)) - (renovate[bot])
## <!-- 9 -->⬆️ Upgrades
- Nodejs to v20 ([#1535](https://github.com/tj-actions/changed-files/issues/1535)) ([48566bb](https://github.com/tj-actions/changed-files/commit/48566bbcc22ceb7c5809ebdd27377309f2c3de8c)) - (Tonye Jack)
- Upgraded to v38.2.2 ([#1533](https://github.com/tj-actions/changed-files/issues/1533))
Co-authored-by: jackton1 <jackton1@users.noreply.github.com>
Co-authored-by: repo-ranger[bot] <39074581+repo-ranger[bot]@users.noreply.github.com> ([07660d5](https://github.com/tj-actions/changed-files/commit/07660d51a9f53df8dfaa952899fe3170cc8d7a1d)) - (tj-actions[bot])
# [38.2.2](https://github.com/tj-actions/changed-files/compare/v38.2.1...v38.2.2) - (2023-09-04)
## <!-- 1 -->🐛 Bug Fixes
- Bug with outputs when json is set to true ([#1531](https://github.com/tj-actions/changed-files/issues/1531)) ([8d335b7](https://github.com/tj-actions/changed-files/commit/8d335b7b7dd078ea984daff751cca794ed2e3f55)) - (Tonye Jack)
## <!-- 7 -->⚙️ Miscellaneous Tasks
- **deps:** Lock file maintenance ([1aee362](https://github.com/tj-actions/changed-files/commit/1aee3621b1c10305ee778298fcf32324684e5448)) - (renovate[bot])
- **deps:** Update typescript-eslint monorepo to v6.6.0 ([fd460fa](https://github.com/tj-actions/changed-files/commit/fd460fa3ba5a11b8fde158a65d59d764c344878e)) - (renovate[bot])
- **deps:** Update actions/checkout action to v4 ([#1527](https://github.com/tj-actions/changed-files/issues/1527)) ([5b84ed2](https://github.com/tj-actions/changed-files/commit/5b84ed26a3cc4c8a3f72c23739e361226a1c3773)) - (renovate[bot])
- **deps:** Lock file maintenance ([e03c026](https://github.com/tj-actions/changed-files/commit/e03c026bf43272cfd653bdebb67d53eefa7e381c)) - (renovate[bot])
- **deps:** Update dependency @types/node to v20.5.9 ([5704310](https://github.com/tj-actions/changed-files/commit/5704310356f399321c158190d53b4862c1adcdcd)) - (renovate[bot])
- **deps:** Update dependency @types/node to v20.5.8 ([c922361](https://github.com/tj-actions/changed-files/commit/c922361eb2e5315d71b2b0ce26a3ce1919ae0725)) - (renovate[bot])
- **deps:** Lock file maintenance ([79d644d](https://github.com/tj-actions/changed-files/commit/79d644d1a2bc9ca4316052da1b06e73cde530d09)) - (renovate[bot])
## <!-- 9 -->⬆️ Upgrades
- Upgraded to v38.2.1 ([#1523](https://github.com/tj-actions/changed-files/issues/1523))
Co-authored-by: jackton1 <jackton1@users.noreply.github.com>
Co-authored-by: repo-ranger[bot] <39074581+repo-ranger[bot]@users.noreply.github.com> ([48576e6](https://github.com/tj-actions/changed-files/commit/48576e65843bb9b05d25cac69fe8b1c142a9485a)) - (tj-actions[bot])
# [38.2.1](https://github.com/tj-actions/changed-files/compare/v38.2.0...v38.2.1) - (2023-09-01)
## <!-- 1 -->🐛 Bug Fixes
- Bug matching patterns ([#1520](https://github.com/tj-actions/changed-files/issues/1520)) ([8476756](https://github.com/tj-actions/changed-files/commit/8476756ae3363aa4c10685f8804636de76aee77c)) - (Tonye Jack)
## <!-- 17 --> Remove
- Deleted .github/ISSUE_TEMPLATE/feature_request.yaml ([4fac98a](https://github.com/tj-actions/changed-files/commit/4fac98a65655335ee89759e4c87d265b0114e15c)) - (Tonye Jack)
- Deleted .github/ISSUE_TEMPLATE/bug_report.yaml ([bed56b2](https://github.com/tj-actions/changed-files/commit/bed56b29b814ce968175396abd67152a01b3a722)) - (Tonye Jack)
- Delete FUNDING.yml ([c3ceccf](https://github.com/tj-actions/changed-files/commit/c3ceccf9bce227317f59ed99512b300e0aa6c2ae)) - (Tonye Jack)
## <!-- 26 -->🔄 Update
- Update bug_report.yaml ([2338e28](https://github.com/tj-actions/changed-files/commit/2338e28eefcb81d8c25c7e6ca50543f53f60446b)) - (Tonye Jack)
- Update bug_report.yaml ([d4eb53d](https://github.com/tj-actions/changed-files/commit/d4eb53db66ce407e266022c530dec9703cdffd3d)) - (Tonye Jack)
- Update bug_report.yaml ([8f777bb](https://github.com/tj-actions/changed-files/commit/8f777bbc0dbc0dfc6994d2c93114bfb970d95e61)) - (Tonye Jack)
- Update bug_report.yaml ([7d256b9](https://github.com/tj-actions/changed-files/commit/7d256b941a1ffb4dea0a5f3b7a3a34b6fe962e4c)) - (Tonye Jack)
## <!-- 7 -->⚙️ Miscellaneous Tasks
- Update warning message ([#1521](https://github.com/tj-actions/changed-files/issues/1521)) ([2f7246c](https://github.com/tj-actions/changed-files/commit/2f7246cb26e8bb6709b6cbfc1fec7febfe82e96a)) - (Tonye Jack)
- **deps:** Bump test/demo from `8bbc726` to `5dfac2e` ([#1518](https://github.com/tj-actions/changed-files/issues/1518)) ([d90c240](https://github.com/tj-actions/changed-files/commit/d90c240f2ad4ec04d8f0f48e5ac290ad96ebe850)) - (dependabot[bot])
- **deps:** Lock file maintenance ([3be651e](https://github.com/tj-actions/changed-files/commit/3be651e99d3d4eae395694f6c6f3b9d18457f6c8)) - (renovate[bot])
- **deps:** Lock file maintenance ([c899288](https://github.com/tj-actions/changed-files/commit/c89928824ff66dd05ee32708cd6228b6d65c9405)) - (renovate[bot])
## <!-- 9 -->⬆️ Upgrades
- Upgraded to v38.2.0 ([#1515](https://github.com/tj-actions/changed-files/issues/1515))
Co-authored-by: jackton1 <jackton1@users.noreply.github.com> ([047f654](https://github.com/tj-actions/changed-files/commit/047f65464639f7d9b9efefea74419be4c0b50b5f)) - (tj-actions[bot])
# [38.2.0](https://github.com/tj-actions/changed-files/compare/v38.1.3...v38.2.0) - (2023-08-30)
## <!-- 0 -->🚀 Features
- Add support for failing on error ([#1511](https://github.com/tj-actions/changed-files/issues/1511)) ([f1b3c2f](https://github.com/tj-actions/changed-files/commit/f1b3c2fa8b5692e972e331fdd79882d38273972c)) - (Tonye Jack)
## <!-- 1 -->🐛 Bug Fixes
- **deps:** Update dependency yaml to v2.3.2 ([7555f14](https://github.com/tj-actions/changed-files/commit/7555f14f918691d9063483ad675c79b69b47adcd)) - (renovate[bot])
## <!-- 16 --> Add
- Added missing changes and modified dist assets.
([b1c183b](https://github.com/tj-actions/changed-files/commit/b1c183b83c74c3f32fb9bb133284a41b10553736)) - (GitHub Action)
## <!-- 26 -->🔄 Update
- Updated README.md ([#1514](https://github.com/tj-actions/changed-files/issues/1514))
Co-authored-by: jackton1 <jackton1@users.noreply.github.com> ([50f6234](https://github.com/tj-actions/changed-files/commit/50f623482f13ff783ea3495d9c9a106d8f17d2ff)) - (tj-actions[bot])
- Update README.md ([2e0f79f](https://github.com/tj-actions/changed-files/commit/2e0f79f8b6a541bee4a978276043a311172d0dc2)) - (Tonye Jack)
- Updated README.md ([#1513](https://github.com/tj-actions/changed-files/issues/1513))
Co-authored-by: jackton1 <jackton1@users.noreply.github.com> ([308cb3d](https://github.com/tj-actions/changed-files/commit/308cb3daf981b614d1eb8f01ba365f9d478fb50d)) - (tj-actions[bot])
- Updated README.md ([#1510](https://github.com/tj-actions/changed-files/issues/1510))
Co-authored-by: jackton1 <jackton1@users.noreply.github.com> ([2f6d66a](https://github.com/tj-actions/changed-files/commit/2f6d66af9db64309ccb993e5969f61d180c9d5ff)) - (tj-actions[bot])
- Update README.md ([ef21b84](https://github.com/tj-actions/changed-files/commit/ef21b845077a6a12523c59bee84fab2847a3c6ed)) - (Tonye Jack)
- Update README.md ([c9dd672](https://github.com/tj-actions/changed-files/commit/c9dd6721cf288da7c7c5d06f78cb27e66d7d8279)) - (Tonye Jack)
## <!-- 7 -->⚙️ Miscellaneous Tasks
- **deps:** Update dependency @types/uuid to v9.0.3 ([#1512](https://github.com/tj-actions/changed-files/issues/1512)) ([0fc9663](https://github.com/tj-actions/changed-files/commit/0fc9663aa70243d87319dbd32fd926344d18d38f)) - (renovate[bot])
- **deps:** Update dependency prettier to v3.0.3 ([4285197](https://github.com/tj-actions/changed-files/commit/428519788bc9daeb52f4031e6be46b6a8b42d57a)) - (renovate[bot])
- **deps:** Update dependency eslint-plugin-github to v4.10.0 ([522df62](https://github.com/tj-actions/changed-files/commit/522df62704d7d3a82510f5b1af9bcac3e8c95a60)) - (renovate[bot])
- **deps:** Update typescript-eslint monorepo to v6.5.0 ([d35b677](https://github.com/tj-actions/changed-files/commit/d35b677f4bef732191226506c4e785f7dfea2cd0)) - (renovate[bot])
- **deps:** Lock file maintenance ([bc2a793](https://github.com/tj-actions/changed-files/commit/bc2a7930225604ad9877b568ec5bb044d0b1f59c)) - (renovate[bot])
## <!-- 9 -->⬆️ Upgrades
- Upgraded to v38.1.3 ([#1503](https://github.com/tj-actions/changed-files/issues/1503))
Co-authored-by: jackton1 <jackton1@users.noreply.github.com> ([a40e52b](https://github.com/tj-actions/changed-files/commit/a40e52b504ccee766d2304f1b5ff1aeba55a832e)) - (tj-actions[bot])
# [38.1.3](https://github.com/tj-actions/changed-files/compare/v38.1.2...v38.1.3) - (2023-08-26)
## <!-- 7 -->⚙️ Miscellaneous Tasks
- **deps:** Update tj-actions/release-tagger action to v4 ([#1502](https://github.com/tj-actions/changed-files/issues/1502)) ([c860b5c](https://github.com/tj-actions/changed-files/commit/c860b5c47fa71f461da850094ef2f6e3d6514e44)) - (renovate[bot])
# [38.1.2](https://github.com/tj-actions/changed-files/compare/v38.1.1...v38.1.2) - (2023-08-26)
## <!-- 7 -->⚙️ Miscellaneous Tasks
- Update warning message ([#1500](https://github.com/tj-actions/changed-files/issues/1500)) ([2f8b802](https://github.com/tj-actions/changed-files/commit/2f8b80270f04e421b28efb2abaccef4fce4815b6)) - (Tonye Jack)
- **deps:** Lock file maintenance ([d01e38a](https://github.com/tj-actions/changed-files/commit/d01e38ae60f5527562be5c2d2bee11d666a25759)) - (renovate[bot])
- Update submodule ([#1498](https://github.com/tj-actions/changed-files/issues/1498)) ([eed6844](https://github.com/tj-actions/changed-files/commit/eed6844f8b8930b86537b173c0c545d73fdf2177)) - (Tonye Jack)
- Update warning message ([#1497](https://github.com/tj-actions/changed-files/issues/1497)) ([f6e73eb](https://github.com/tj-actions/changed-files/commit/f6e73eb5b610c261657b2de25ec64c4252069608)) - (Tonye Jack)
- **deps:** Update dependency eslint to v8.48.0 ([34c9fcc](https://github.com/tj-actions/changed-files/commit/34c9fcc96ac0a5d0be0519ed91e3f625c9b8ad09)) - (renovate[bot])
## <!-- 9 -->⬆️ Upgrades
- Upgraded to v38.1.1 ([#1495](https://github.com/tj-actions/changed-files/issues/1495))
Co-authored-by: jackton1 <jackton1@users.noreply.github.com>
Co-authored-by: repo-ranger[bot] <39074581+repo-ranger[bot]@users.noreply.github.com> ([3034ed7](https://github.com/tj-actions/changed-files/commit/3034ed7851a1bae2de6ae8f20e9c9890917b859a)) - (tj-actions[bot])
# [38.1.1](https://github.com/tj-actions/changed-files/compare/v38.1.0...v38.1.1) - (2023-08-25)
## <!-- 16 --> Add

164
README.md
View File

@@ -9,7 +9,7 @@
<!-- ALL-CONTRIBUTORS-BADGE:START - Do not remove or modify this section -->
[![All Contributors](https://img.shields.io/badge/all_contributors-20-orange.svg?style=flat-square)](#contributors-)
[![All Contributors](https://img.shields.io/badge/all_contributors-21-orange.svg?style=flat-square)](#contributors-)
<!-- ALL-CONTRIBUTORS-BADGE:END -->
@@ -19,27 +19,27 @@ Effortlessly track all changed files and directories relative to a target branch
## Table of contents
* [Features](#features)
* [Usage](#usage)
* [On `pull_request`](#on-pull_request)
* [Using local .git history](#using-local-git-history)
* [Using Github's API](#using-githubs-api)
* [On `push`](#on-push)
* [Useful Acronyms](#useful-acronyms)
* [Outputs](#outputs)
* [Inputs](#inputs)
* [Versioning](#versioning)
* [Examples](#examples)
* [Real-world usage](#real-world-usage)
* [Open source projects](#open-source-projects)
* [Scalability Example](#scalability-example)
* [Known Limitation](#known-limitation)
* [Migration guide](#migration-guide)
* [Credits](#credits)
* [Report Bugs](#report-bugs)
* [Features 🚀](#features-)
* [Usage 💻](#usage-)
* [On `pull_request` 🔀](#on-pull_request-)
* [Using local .git history 📁](#using-local-git-history-)
* [Using Github's API :octocat:](#using-githubs-api-octocat)
* [On `push` ⬆️](#on-push-)
* [Useful Acronyms 🧮](#useful-acronyms-)
* [Outputs 📤](#outputs-)
* [Inputs ⚙️](#inputs-)
* [Versioning 🏷️](#versioning-)
* [Examples 📄](#examples-)
* [Real-world usage 🌐](#real-world-usage-)
* [Open source projects 📦](#open-source-projects-)
* [Scalability Example 📈](#scalability-example-)
* [Known Limitation ⚠️](#known-limitation-)
* [Migration guide 🔄](#migration-guide-)
* [Credits 👏](#credits-)
* [Report Bugs 🐛](#report-bugs-)
* [Contributors ✨](#contributors-)
## Features
## Features 🚀
* Fast execution, averaging 0-10 seconds.
* Leverages either [Github's REST API](https://docs.github.com/en/rest/reference/repos#list-commits) or [Git's native diff](https://git-scm.com/docs/git-diff) to determine changed files.
@@ -69,12 +69,12 @@ Effortlessly track all changed files and directories relative to a target branch
* Supports brace expansion.
* Supports negation.
* Uses [YAML](https://yaml.org/) syntax for specifying patterns.
* Supports [YAML anchors & aliases](https://www.educative.io/blog/advanced-yaml-syntax-cheatsheet#anchors).
* Supports [YAML multi-line strings](https://learnxinyminutes.com/docs/yaml/).
* Supports [YAML anchors & aliases](https://github.com/tj-actions/changed-files/blob/main/test/changed-files.yml#L8-L12).
* Supports [YAML multi-line strings](https://github.com/tj-actions/changed-files/blob/main/test/changed-files.yml#L13-L16).
And many more...
## Usage
## Usage 💻
> **Warning**
>
@@ -86,9 +86,11 @@ And many more...
Visit the [discussions for more information](https://github.com/tj-actions/changed-files/discussions) or [create a new discussion](https://github.com/tj-actions/changed-files/discussions/new/choose) for usage-related questions.
### On `pull_request`
### On `pull_request` 🔀
#### Using local .git history
Detect changes to all files in a Pull request relative to the target branch or since the last pushed commit.
#### Using local .git history 📁
```yaml
name: CI
@@ -106,14 +108,14 @@ jobs:
runs-on: ubuntu-latest # windows-latest || macos-latest
name: Test changed-files
steps:
- uses: actions/checkout@v3
- uses: actions/checkout@v4
with:
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
uses: tj-actions/changed-files@v39
with:
files_yaml: |
doc:
@@ -143,7 +145,7 @@ jobs:
# Example 2
- name: Get changed files
id: changed-files
uses: tj-actions/changed-files@v38
uses: tj-actions/changed-files@v39
# To compare changes between the current commit and the last pushed remote commit set `since_last_remote_commit: true`. e.g
# with:
@@ -158,7 +160,7 @@ jobs:
# Example 3
- name: Get changed files in the docs folder
id: changed-files-specific
uses: tj-actions/changed-files@v38
uses: tj-actions/changed-files@v39
with:
files: docs/*.{js,html} # Alternatively using: `docs/**` or `docs`
files_ignore: docs/static.js
@@ -170,7 +172,7 @@ jobs:
echo "List all the files that have changed: ${{ steps.changed-files-specific.outputs.all_changed_files }}"
```
#### Using Github's API
#### Using Github's API :octocat:
```yaml
name: CI
@@ -198,7 +200,7 @@ jobs:
steps:
- name: Get changed files
id: changed-files
uses: tj-actions/changed-files@v38
uses: tj-actions/changed-files@v39
- name: List all changed files
run: |
@@ -207,7 +209,9 @@ jobs:
done
```
### On `push`
### On `push` ⬆️
Detect changes to files made since the last pushed commit.
```yaml
name: CI
@@ -251,14 +255,13 @@ jobs:
runs-on: ubuntu-latest # windows-latest || macos-latest
name: Test changed-files
steps:
- uses: actions/checkout@v3
- uses: actions/checkout@v4
with:
fetch-depth: 0 # OR "2" -> To retrieve the preceding commit.
# Example 1
- name: Get changed files
id: changed-files
uses: tj-actions/changed-files@v38
uses: tj-actions/changed-files@v39
# NOTE: `since_last_remote_commit: true` is implied by default and falls back to the previous local commit.
@@ -267,11 +270,6 @@ jobs:
for file in ${{ steps.changed-files.outputs.all_changed_files }}; do
echo "$file was changed"
done
# Example 2: See above
...
# Example 3: See above
...
```
@@ -287,7 +285,7 @@ Support this project with a :star:
[buymeacoffee-shield]: https://www.buymeacoffee.com/assets/img/custom_images/orange_img.png
## Useful Acronyms
## Useful Acronyms 🧮
| Acronym | Meaning |
|:---------:|:------------:|
@@ -303,8 +301,9 @@ Support this project with a :star:
> **Warning**
>
> * When using `files_yaml*` inputs ensure all outputs are prefixed by the key `test_{...}` e.g. `test_added_files`, `test_any_changed`
> * All keys must start with a letter or \_ and contain only alphanumeric characters, -, or \_.
## Outputs
## Outputs 📤
<!-- AUTO-DOC-OUTPUT:START - Do not remove or modify this section -->
@@ -320,23 +319,25 @@ Support this project with a :star:
| <a name="output_all_modified_files_count"></a>[all\_modified\_files\_count](#output_all_modified_files_count) | string | Returns the number of `all_modified_files` |
| <a name="output_all_old_new_renamed_files"></a>[all\_old\_new\_renamed\_files](#output_all_old_new_renamed_files) | string | Returns only files that are <br>Renamed and lists their old <br>and new names. **NOTE:** This <br>requires setting `include_all_old_new_renamed_files` to `true`. <br>Also, keep in mind that <br>this output is global and <br>wouldn't be nested in outputs <br>generated when the `*_yaml_*` input <br>is used. (R) |
| <a name="output_all_old_new_renamed_files_count"></a>[all\_old\_new\_renamed\_files\_count](#output_all_old_new_renamed_files_count) | string | Returns the number of `all_old_new_renamed_files` |
| <a name="output_any_changed"></a>[any\_changed](#output_any_changed) | string | Returns `true` when any of <br>the filenames provided using the <br>`files*` or `files_ignore*` inputs has changed. i.e. <br>*using a combination of all added, copied, modified and renamed files (ACMR)*. |
| <a name="output_any_changed"></a>[any\_changed](#output_any_changed) | string | Returns `true` when any of <br>the filenames provided using the <br>`files*` or `files_ignore*` inputs has changed. i.e. <br>*includes a combination of all added, copied, modified and renamed files (ACMR)*. |
| <a name="output_any_deleted"></a>[any\_deleted](#output_any_deleted) | string | Returns `true` when any of <br>the filenames provided using the <br>`files*` or `files_ignore*` inputs has been deleted. <br>(D) |
| <a name="output_any_modified"></a>[any\_modified](#output_any_modified) | string | Returns `true` when any of <br>the filenames provided using the <br>`files*` or `files_ignore*` inputs has been modified. <br>i.e. *using a combination of all added, copied, modified, renamed, and deleted files (ACMRD)*. |
| <a name="output_any_modified"></a>[any\_modified](#output_any_modified) | string | Returns `true` when any of <br>the filenames provided using the <br>`files*` or `files_ignore*` inputs has been modified. <br>i.e. *includes a combination of all added, copied, modified, renamed, and deleted files (ACMRD)*. |
| <a name="output_changed_keys"></a>[changed\_keys](#output_changed_keys) | string | Returns all changed YAML keys <br>when the `files_yaml` input is <br>used. i.e. *key that contains any path that has either been added, copied, modified, and renamed (ACMR)* |
| <a name="output_copied_files"></a>[copied\_files](#output_copied_files) | string | Returns only files that are <br>Copied (C). |
| <a name="output_copied_files_count"></a>[copied\_files\_count](#output_copied_files_count) | string | Returns the number of `copied_files` |
| <a name="output_deleted_files"></a>[deleted\_files](#output_deleted_files) | string | Returns only files that are <br>Deleted (D). |
| <a name="output_deleted_files_count"></a>[deleted\_files\_count](#output_deleted_files_count) | string | Returns the number of `deleted_files` |
| <a name="output_modified_files"></a>[modified\_files](#output_modified_files) | string | Returns only files that are <br>Modified (M). |
| <a name="output_modified_files_count"></a>[modified\_files\_count](#output_modified_files_count) | string | Returns the number of `modified_files` |
| <a name="output_only_changed"></a>[only\_changed](#output_only_changed) | string | Returns `true` when only files <br>provided using the `files*` or `files_ignore*` inputs <br>has changed. i.e. *using a combination of all added, copied, modified and renamed files (ACMR)*. |
| <a name="output_modified_keys"></a>[modified\_keys](#output_modified_keys) | string | Returns all modified YAML keys <br>when the `files_yaml` input is <br>used. i.e. *key that contains any path that has either been added, copied, modified, and deleted (ACMRD)* |
| <a name="output_only_changed"></a>[only\_changed](#output_only_changed) | string | Returns `true` when only files <br>provided using the `files*` or `files_ignore*` inputs <br>has changed. i.e. *includes a combination of all added, copied, modified and renamed files (ACMR)*. |
| <a name="output_only_deleted"></a>[only\_deleted](#output_only_deleted) | string | Returns `true` when only files <br>provided using the `files*` or `files_ignore*` inputs <br>has been deleted. (D) |
| <a name="output_only_modified"></a>[only\_modified](#output_only_modified) | string | Returns `true` when only files <br>provided using the `files*` or `files_ignore*` inputs <br>has been modified. (ACMRD). |
| <a name="output_other_changed_files"></a>[other\_changed\_files](#output_other_changed_files) | string | Returns all other changed files <br>not listed in the files <br>input i.e. *using a combination of all added, copied, modified and renamed files (ACMR)*. |
| <a name="output_other_changed_files"></a>[other\_changed\_files](#output_other_changed_files) | string | Returns all other changed files <br>not listed in the files <br>input i.e. *includes a combination of all added, copied, modified and renamed files (ACMR)*. |
| <a name="output_other_changed_files_count"></a>[other\_changed\_files\_count](#output_other_changed_files_count) | string | Returns the number of `other_changed_files` |
| <a name="output_other_deleted_files"></a>[other\_deleted\_files](#output_other_deleted_files) | string | Returns all other deleted files <br>not listed in the files <br>input i.e. *a combination of all deleted files (D)* |
| <a name="output_other_deleted_files_count"></a>[other\_deleted\_files\_count](#output_other_deleted_files_count) | string | Returns the number of `other_deleted_files` |
| <a name="output_other_modified_files"></a>[other\_modified\_files](#output_other_modified_files) | string | Returns all other modified files <br>not listed in the files <br>input i.e. *a combination of all added, copied, modified, and deleted files (ACMRD)* |
| <a name="output_other_modified_files"></a>[other\_modified\_files](#output_other_modified_files) | string | Returns all other modified files <br>not listed in the files <br>input i.e. *a combination of all added, copied, modified, and deleted files (ACMRD)* |
| <a name="output_other_modified_files_count"></a>[other\_modified\_files\_count](#output_other_modified_files_count) | string | Returns the number of `other_modified_files` |
| <a name="output_renamed_files"></a>[renamed\_files](#output_renamed_files) | string | Returns only files that are <br>Renamed (R). |
| <a name="output_renamed_files_count"></a>[renamed\_files\_count](#output_renamed_files_count) | string | Returns the number of `renamed_files` |
@@ -349,7 +350,7 @@ Support this project with a :star:
<!-- AUTO-DOC-OUTPUT:END -->
## Inputs
## Inputs ⚙️
<!-- AUTO-DOC-INPUT:START - Do not remove or modify this section -->
@@ -364,6 +365,8 @@ Support this project with a :star:
| <a name="input_dir_names_include_files_separator"></a>[dir\_names\_include\_files\_separator](#input_dir_names_include_files_separator) | string | false | `"\n"` | Separator used to split the <br>`dir_names_include_files` input |
| <a name="input_dir_names_max_depth"></a>[dir\_names\_max\_depth](#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`. |
| <a name="input_escape_json"></a>[escape\_json](#input_escape_json) | string | false | `"true"` | Escape JSON output. |
| <a name="input_fail_on_initial_diff_error"></a>[fail\_on\_initial\_diff\_error](#input_fail_on_initial_diff_error) | string | false | `"false"` | Fail when the initial diff <br>fails. |
| <a name="input_fail_on_submodule_diff_error"></a>[fail\_on\_submodule\_diff\_error](#input_fail_on_submodule_diff_error) | string | false | `"false"` | Fail when the submodule diff <br>fails. |
| <a name="input_fetch_additional_submodule_history"></a>[fetch\_additional\_submodule\_history](#input_fetch_additional_submodule_history) | string | false | `"false"` | Fetch additional history for submodules. |
| <a name="input_fetch_depth"></a>[fetch\_depth](#input_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. |
| <a name="input_files"></a>[files](#input_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. |
@@ -381,7 +384,7 @@ Support this project with a :star:
| <a name="input_files_yaml_from_source_file"></a>[files\_yaml\_from\_source\_file](#input_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) |
| <a name="input_files_yaml_from_source_file_separator"></a>[files\_yaml\_from\_source\_file\_separator](#input_files_yaml_from_source_file_separator) | string | false | `"\n"` | Separator used to split the <br>`files_yaml_from_source_file` input |
| <a name="input_include_all_old_new_renamed_files"></a>[include\_all\_old\_new\_renamed\_files](#input_include_all_old_new_renamed_files) | string | false | `"false"` | Include `all_old_new_renamed_files` output. Note this <br>can generate a large output <br>See: [#501](https://github.com/tj-actions/changed-files/issues/501). |
| <a name="input_json"></a>[json](#input_json) | string | false | `"false"` | Output list of changed files <br>in a JSON formatted string <br>which can be used for <br>matrix jobs. |
| <a name="input_json"></a>[json](#input_json) | string | false | `"false"` | Output list of changed files <br>in a JSON formatted string <br>which can be used for <br>matrix jobs. [Example](https://github.com/tj-actions/changed-files/blob/main/.github/workflows/matrix-test.yml) |
| <a name="input_old_new_files_separator"></a>[old\_new\_files\_separator](#input_old_new_files_separator) | string | false | `" "` | Split character for old and <br>new renamed filename pairs. |
| <a name="input_old_new_separator"></a>[old\_new\_separator](#input_old_new_separator) | string | false | `","` | Split character for old and <br>new filename pairs. |
| <a name="input_output_dir"></a>[output\_dir](#input_output_dir) | string | false | `".github/outputs"` | Directory to store output files. |
@@ -405,7 +408,7 @@ Support this project with a :star:
<!-- AUTO-DOC-INPUT:END -->
## Versioning
## Versioning 🏷️
This GitHub Action follows the principles of [Semantic Versioning](https://semver.org) for versioning releases.
@@ -417,7 +420,7 @@ The format of the version string is as follows:
* patch: indicates bug fixes or other small changes that are backward compatible.
## Examples
## Examples 📄
<details>
<summary>Get all changed files in the current branch</summary>
@@ -426,7 +429,7 @@ The format of the version string is as follows:
...
- name: Get changed files
id: changed-files
uses: tj-actions/changed-files@v38
uses: tj-actions/changed-files@v39
...
```
@@ -439,7 +442,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@v38
uses: tj-actions/changed-files@v39
with:
separator: ","
...
@@ -456,7 +459,7 @@ See [inputs](#inputs) for more information.
...
- name: Get changed files
id: changed-files
uses: tj-actions/changed-files@v38
uses: tj-actions/changed-files@v39
- name: List all added files
run: |
@@ -477,7 +480,7 @@ See [outputs](#outputs) for a list of all available outputs.
...
- name: Get changed files
id: changed-files
uses: tj-actions/changed-files@v38
uses: tj-actions/changed-files@v39
- name: Run a step if my-file.txt was modified
if: contains(steps.changed-files.outputs.modified_files, 'my-file.txt')
@@ -537,7 +540,7 @@ See [outputs](#outputs) for a list of all available outputs.
...
- name: Get changed files
id: changed-files
uses: tj-actions/changed-files@v38
uses: tj-actions/changed-files@v39
with:
files: |
my-file.txt
@@ -560,7 +563,7 @@ See [inputs](#inputs) for more information.
...
- name: Get changed files
id: changed-files-specific
uses: tj-actions/changed-files@v38
uses: tj-actions/changed-files@v39
with:
files: |
my-file.txt
@@ -607,7 +610,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@v38
uses: tj-actions/changed-files@v39
with:
files_from_source_file: test/changed-files-list.txt
...
@@ -624,7 +627,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@v38
uses: tj-actions/changed-files@v39
with:
files_from_source_file: |
test/changed-files-list.txt
@@ -645,7 +648,7 @@ See [inputs](#inputs) for more information.
...
- name: Get changed files using a different SHA
id: changed-files
uses: tj-actions/changed-files@v38
uses: tj-actions/changed-files@v39
with:
sha: ${{ github.event.pull_request.head.sha }}
...
@@ -662,7 +665,7 @@ See [inputs](#inputs) for more information.
...
- name: Get changed files using a different base SHA
id: changed-files
uses: tj-actions/changed-files@v38
uses: tj-actions/changed-files@v39
with:
base_sha: ${{ github.event.pull_request.base.sha }}
...
@@ -688,17 +691,17 @@ jobs:
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v3
uses: actions/checkout@v4
with:
fetch-depth: 0
- name: Get changed files
id: changed-files
uses: tj-actions/changed-files@v38
uses: tj-actions/changed-files@v39
- name: Get changed files in the .github folder
id: changed-files-specific
uses: tj-actions/changed-files@v38
uses: tj-actions/changed-files@v39
with:
base_sha: ${{ steps.get-base-sha.outputs.base_sha }}
files: .github/**
@@ -721,14 +724,14 @@ See [inputs](#inputs) for more information.
```yaml
...
- name: Checkout into dir1
uses: actions/checkout@v3
uses: actions/checkout@v4
with:
fetch-depth: 0
path: dir1
- name: Run changed-files with defaults in dir1
id: changed-files-for-dir1
uses: tj-actions/changed-files@v38
uses: tj-actions/changed-files@v39
with:
path: dir1
@@ -751,7 +754,7 @@ See [inputs](#inputs) for more information.
...
- name: Run changed-files with quotepath disabled
id: changed-files-quotepath
uses: tj-actions/changed-files@v38
uses: tj-actions/changed-files@v39
with:
quotepath: "false"
@@ -790,7 +793,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@v38
uses: tj-actions/changed-files@v39
with:
base_sha: ${{ steps.last_successful_commit_push.outputs.base }}
...
@@ -817,7 +820,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@v38
uses: tj-actions/changed-files@v39
with:
base_sha: ${{ steps.last_successful_commit_pull_request.outputs.base }}
...
@@ -843,7 +846,7 @@ See [inputs](#inputs) for more information.
...
- name: Run changed-files with dir_names
id: changed-files-dir-names
uses: tj-actions/changed-files@v38
uses: tj-actions/changed-files@v39
with:
dir_names: "true"
...
@@ -860,7 +863,7 @@ See [inputs](#inputs) for more information.
...
- name: Run changed-files with JSON output
id: changed-files-json
uses: tj-actions/changed-files@v38
uses: tj-actions/changed-files@v39
with:
json: "true"
...
@@ -877,13 +880,13 @@ See [inputs](#inputs) for more information.
...
- name: Get changed-files since 2022-08-19
id: changed-files-since
uses: tj-actions/changed-files@v38
uses: tj-actions/changed-files@v39
with:
since: "2022-08-19"
- name: Get changed-files until 2022-08-20
id: changed-files-until
uses: tj-actions/changed-files@v38
uses: tj-actions/changed-files@v39
with:
until: "2022-08-20"
...
@@ -893,9 +896,9 @@ See [inputs](#inputs) for more information.
</details>
## Real-world usage
## Real-world usage 🌐
### Open source projects
### Open source projects 📦
* [vitejs/vite: uses tj-actions/changed-files to automate testing](https://github.com/vitejs/vite/blob/8da04227d6f818a8ad9efc0056101968037c2e36/.github/workflows/ci.yml#L61)
@@ -917,11 +920,11 @@ See [inputs](#inputs) for more information.
And many more...
### Scalability Example
### Scalability Example 📈
![image](https://github.com/tj-actions/changed-files/assets/17484350/23767413-4c51-42fb-ab1c-39ef72c44904)
## Known Limitation
## Known Limitation ⚠️
> **Warning**
>
@@ -930,7 +933,7 @@ And many more...
>
> ![Screen Shot 2021-10-23 at 9 37 34 AM](https://user-images.githubusercontent.com/17484350/138558767-b13c90bf-a1ae-4e86-9520-70a6a4624f41.png)
## Migration guide
## Migration guide 🔄
With the switch from using grep's Extended regex to match files to the natively supported workflow glob pattern matching syntax introduced in [v13](https://github.com/tj-actions/changed-files/releases/tag/v13) you'll need to modify patterns used to match `files`.
@@ -950,7 +953,7 @@ With the switch from using grep's Extended regex to match files to the natively
* Free software: [MIT license](LICENSE)
## Credits
## Credits 👏
This package was created with [cookiecutter-action](https://github.com/tj-actions/cookiecutter-action).
@@ -961,7 +964,7 @@ This package was created with [cookiecutter-action](https://github.com/tj-action
* [tj-actions/demo3](https://github.com/tj-actions/demo3)
* [tj-actions/release-tagger](https://github.com/tj-actions/release-tagger)
## Report Bugs
## Report Bugs 🐛
Report bugs at https://github.com/tj-actions/changed-files/issues.
@@ -1008,6 +1011,7 @@ Thanks goes to these wonderful people ([emoji key](https://allcontributors.org/d
<td align="center" valign="top" width="14.28%"><a href="https://github.com/adonisgarciac"><img src="https://avatars.githubusercontent.com/u/71078987?v=4?s=100" width="100px;" alt="adonisgarciac"/><br /><sub><b>adonisgarciac</b></sub></a><br /><a href="https://github.com/tj-actions/changed-files/commits?author=adonisgarciac" title="Code">💻</a> <a href="https://github.com/tj-actions/changed-files/commits?author=adonisgarciac" title="Documentation">📖</a></td>
<td align="center" valign="top" width="14.28%"><a href="https://github.com/cfernhout"><img src="https://avatars.githubusercontent.com/u/22294606?v=4?s=100" width="100px;" alt="Chiel Fernhout"/><br /><sub><b>Chiel Fernhout</b></sub></a><br /><a href="https://github.com/tj-actions/changed-files/commits?author=cfernhout" title="Documentation">📖</a></td>
<td align="center" valign="top" width="14.28%"><a href="https://github.com/albertoperdomo2"><img src="https://avatars.githubusercontent.com/u/62241095?v=4?s=100" width="100px;" alt="Alberto Perdomo"/><br /><sub><b>Alberto Perdomo</b></sub></a><br /><a href="https://github.com/tj-actions/changed-files/commits?author=albertoperdomo2" title="Documentation">📖</a></td>
<td align="center" valign="top" width="14.28%"><a href="https://arthurvolant.com"><img src="https://avatars.githubusercontent.com/u/37664438?v=4?s=100" width="100px;" alt="Arthur"/><br /><sub><b>Arthur</b></sub></a><br /><a href="https://github.com/tj-actions/changed-files/issues?q=author%3AV0lantis" title="Bug reports">🐛</a> <a href="https://github.com/tj-actions/changed-files/commits?author=V0lantis" title="Code">💻</a></td>
</tr>
</tbody>
</table>

View File

@@ -121,7 +121,7 @@ inputs:
default: "\n"
required: false
json:
description: "Output list of changed files in a JSON formatted string which can be used for matrix jobs."
description: "Output list of changed files in a JSON formatted string which can be used for matrix jobs. [Example](https://github.com/tj-actions/changed-files/blob/main/.github/workflows/matrix-test.yml)"
required: false
default: "false"
escape_json:
@@ -188,6 +188,14 @@ inputs:
description: "Github API URL."
required: false
default: ${{ github.api_url }}
fail_on_initial_diff_error:
description: "Fail when the initial diff fails."
required: false
default: "false"
fail_on_submodule_diff_error:
description: "Fail when the submodule diff fails."
required: false
default: "false"
outputs:
added_files:
@@ -235,11 +243,11 @@ outputs:
all_changed_files_count:
description: "Returns the number of `all_changed_files`"
any_changed:
description: "Returns `true` when any of the filenames provided using the `files*` or `files_ignore*` inputs has changed. i.e. *using a combination of all added, copied, modified and renamed files (ACMR)*."
description: "Returns `true` when any of the filenames provided using the `files*` or `files_ignore*` inputs has changed. i.e. *includes a combination of all added, copied, modified and renamed files (ACMR)*."
only_changed:
description: "Returns `true` when only files provided using the `files*` or `files_ignore*` inputs has changed. i.e. *using a combination of all added, copied, modified and renamed files (ACMR)*."
description: "Returns `true` when only files provided using the `files*` or `files_ignore*` inputs has changed. i.e. *includes a combination of all added, copied, modified and renamed files (ACMR)*."
other_changed_files:
description: "Returns all other changed files not listed in the files input i.e. *using a combination of all added, copied, modified and renamed files (ACMR)*."
description: "Returns all other changed files not listed in the files input i.e. *includes a combination of all added, copied, modified and renamed files (ACMR)*."
other_changed_files_count:
description: "Returns the number of `other_changed_files`"
all_modified_files:
@@ -247,11 +255,11 @@ outputs:
all_modified_files_count:
description: "Returns the number of `all_modified_files`"
any_modified:
description: "Returns `true` when any of the filenames provided using the `files*` or `files_ignore*` inputs has been modified. i.e. *using a combination of all added, copied, modified, renamed, and deleted files (ACMRD)*."
description: "Returns `true` when any of the filenames provided using the `files*` or `files_ignore*` inputs has been modified. i.e. *includes a combination of all added, copied, modified, renamed, and deleted files (ACMRD)*."
only_modified:
description: "Returns `true` when only files provided using the `files*` or `files_ignore*` inputs has been modified. (ACMRD)."
other_modified_files:
description: "Returns all other modified files not listed in the files input i.e. *a combination of all added, copied, modified, and deleted files (ACMRD)*"
description: "Returns all other modified files not listed in the files input i.e. *a combination of all added, copied, modified, and deleted files (ACMRD)*"
other_modified_files_count:
description: "Returns the number of `other_modified_files`"
any_deleted:
@@ -262,9 +270,13 @@ outputs:
description: "Returns all other deleted files not listed in the files input i.e. *a combination of all deleted files (D)*"
other_deleted_files_count:
description: "Returns the number of `other_deleted_files`"
modified_keys:
description: "Returns all modified YAML keys when the `files_yaml` input is used. i.e. *key that contains any path that has either been added, copied, modified, and deleted (ACMRD)*"
changed_keys:
description: "Returns all changed YAML keys when the `files_yaml` input is used. i.e. *key that contains any path that has either been added, copied, modified, and renamed (ACMR)*"
runs:
using: 'node16'
using: 'node20'
main: 'dist/index.js'
branding:

534
dist/index.js generated vendored
View File

@@ -49,13 +49,84 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
return (mod && mod.__esModule) ? mod : { "default": mod };
};
Object.defineProperty(exports, "__esModule", ({ value: true }));
exports.getChangedFilesFromGithubAPI = exports.getAllChangeTypeFiles = exports.getChangeTypeFiles = exports.getAllDiffFiles = exports.ChangeTypeEnum = exports.getRenamedFiles = void 0;
exports.getChangedFilesFromGithubAPI = exports.getAllChangeTypeFiles = exports.getChangeTypeFiles = exports.getAllDiffFiles = exports.ChangeTypeEnum = exports.getRenamedFiles = exports.processChangedFiles = void 0;
const core = __importStar(__nccwpck_require__(2186));
const github = __importStar(__nccwpck_require__(5438));
const flatten_1 = __importDefault(__nccwpck_require__(2394));
const micromatch_1 = __importDefault(__nccwpck_require__(6228));
const path = __importStar(__nccwpck_require__(1017));
const changedFilesOutput_1 = __nccwpck_require__(8930);
const utils_1 = __nccwpck_require__(918);
const processChangedFiles = ({ filePatterns, allDiffFiles, inputs, yamlFilePatterns }) => __awaiter(void 0, void 0, void 0, function* () {
if (filePatterns.length > 0) {
core.startGroup('changed-files-patterns');
const allFilteredDiffFiles = yield (0, utils_1.getFilteredChangedFiles)({
allDiffFiles,
filePatterns
});
core.debug(`All filtered diff files: ${JSON.stringify(allFilteredDiffFiles)}`);
yield (0, changedFilesOutput_1.setOutputsAndGetModifiedAndChangedFilesStatus)({
allDiffFiles,
allFilteredDiffFiles,
inputs,
filePatterns
});
core.info('All Done!');
core.endGroup();
}
if (Object.keys(yamlFilePatterns).length > 0) {
const modifiedKeys = [];
const changedKeys = [];
for (const key of Object.keys(yamlFilePatterns)) {
core.startGroup(`changed-files-yaml-${key}`);
const allFilteredDiffFiles = yield (0, utils_1.getFilteredChangedFiles)({
allDiffFiles,
filePatterns: yamlFilePatterns[key]
});
core.debug(`All filtered diff files for ${key}: ${JSON.stringify(allFilteredDiffFiles)}`);
const { anyChanged, anyModified } = yield (0, changedFilesOutput_1.setOutputsAndGetModifiedAndChangedFilesStatus)({
allDiffFiles,
allFilteredDiffFiles,
inputs,
filePatterns: yamlFilePatterns[key],
outputPrefix: key
});
if (anyModified) {
modifiedKeys.push(key);
}
if (anyChanged) {
changedKeys.push(key);
}
core.info('All Done!');
core.endGroup();
}
if (modifiedKeys.length > 0) {
yield (0, utils_1.setArrayOutput)({
key: 'modified_keys',
inputs,
value: modifiedKeys
});
}
if (changedKeys.length > 0) {
yield (0, utils_1.setArrayOutput)({
key: 'changed_keys',
inputs,
value: changedKeys
});
}
}
if (filePatterns.length === 0 && Object.keys(yamlFilePatterns).length === 0) {
core.startGroup('changed-files-all');
yield (0, changedFilesOutput_1.setOutputsAndGetModifiedAndChangedFilesStatus)({
allDiffFiles,
allFilteredDiffFiles: allDiffFiles,
inputs
});
core.info('All Done!');
core.endGroup();
}
});
exports.processChangedFiles = processChangedFiles;
const getRenamedFiles = ({ inputs, workingDirectory, hasSubmodule, diffResult, submodulePaths }) => __awaiter(void 0, void 0, void 0, function* () {
const renamedFiles = yield (0, utils_1.gitRenamedFiles)({
cwd: workingDirectory,
@@ -125,13 +196,14 @@ var ChangeTypeEnum;
ChangeTypeEnum["Unmerged"] = "U";
ChangeTypeEnum["Unknown"] = "X";
})(ChangeTypeEnum || (exports.ChangeTypeEnum = ChangeTypeEnum = {}));
const getAllDiffFiles = ({ workingDirectory, hasSubmodule, diffResult, submodulePaths, outputRenamedFilesAsDeletedAndAdded, fetchSubmoduleHistory }) => __awaiter(void 0, void 0, void 0, function* () {
const getAllDiffFiles = ({ workingDirectory, hasSubmodule, diffResult, submodulePaths, outputRenamedFilesAsDeletedAndAdded, fetchSubmoduleHistory, failOnInitialDiffError, failOnSubmoduleDiffError }) => __awaiter(void 0, void 0, void 0, function* () {
const files = yield (0, utils_1.getAllChangedFiles)({
cwd: workingDirectory,
sha1: diffResult.previousSha,
sha2: diffResult.currentSha,
diff: diffResult.diff,
outputRenamedFilesAsDeletedAndAdded
outputRenamedFilesAsDeletedAndAdded,
failOnInitialDiffError
});
if (hasSubmodule) {
for (const submodulePath of submodulePaths) {
@@ -165,7 +237,8 @@ const getAllDiffFiles = ({ workingDirectory, hasSubmodule, diffResult, submodule
diff,
isSubmodule: true,
parentDir: submodulePath,
outputRenamedFilesAsDeletedAndAdded
outputRenamedFilesAsDeletedAndAdded,
failOnSubmoduleDiffError
});
for (const changeType of Object.keys(submoduleFiles)) {
if (!files[changeType]) {
@@ -218,14 +291,9 @@ const getChangeTypeFiles = ({ inputs, changedFiles, changeTypes }) => __awaiter(
const files = [
...new Set(getChangeTypeFilesGenerator({ inputs, changedFiles, changeTypes }))
].filter(Boolean);
if (inputs.json) {
return {
paths: (0, utils_1.jsonOutput)({ value: files, shouldEscape: inputs.escapeJson }),
count: files.length.toString()
};
}
const paths = inputs.json ? files : files.join(inputs.separator);
return {
paths: files.join(inputs.separator),
paths,
count: files.length.toString()
};
});
@@ -246,14 +314,9 @@ const getAllChangeTypeFiles = ({ inputs, changedFiles }) => __awaiter(void 0, vo
const files = [
...new Set(getAllChangeTypeFilesGenerator({ inputs, changedFiles }))
].filter(Boolean);
if (inputs.json) {
return {
paths: (0, utils_1.jsonOutput)({ value: files, shouldEscape: inputs.escapeJson }),
count: files.length.toString()
};
}
const paths = inputs.json ? files : files.join(inputs.separator);
return {
paths: files.join(inputs.separator),
paths,
count: files.length.toString()
};
});
@@ -364,14 +427,14 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge
});
};
Object.defineProperty(exports, "__esModule", ({ value: true }));
exports.setChangedFilesOutput = void 0;
exports.setOutputsAndGetModifiedAndChangedFilesStatus = void 0;
const core = __importStar(__nccwpck_require__(2186));
const changedFiles_1 = __nccwpck_require__(7358);
const utils_1 = __nccwpck_require__(918);
const getOutputKey = (key, outputPrefix) => {
return outputPrefix ? `${outputPrefix}_${key}` : key;
const getArrayFromPaths = (paths, inputs) => {
return Array.isArray(paths) ? paths : paths.split(inputs.separator);
};
const setChangedFilesOutput = ({ allDiffFiles, allFilteredDiffFiles, inputs, filePatterns = [], outputPrefix = '' }) => __awaiter(void 0, void 0, void 0, function* () {
const setOutputsAndGetModifiedAndChangedFilesStatus = ({ allDiffFiles, allFilteredDiffFiles, inputs, filePatterns = [], outputPrefix = '' }) => __awaiter(void 0, void 0, void 0, function* () {
const addedFiles = yield (0, changedFiles_1.getChangeTypeFiles)({
inputs,
changedFiles: allFilteredDiffFiles,
@@ -379,14 +442,18 @@ const setChangedFilesOutput = ({ allDiffFiles, allFilteredDiffFiles, inputs, fil
});
core.debug(`Added files: ${JSON.stringify(addedFiles)}`);
yield (0, utils_1.setOutput)({
key: getOutputKey('added_files', outputPrefix),
key: (0, utils_1.getOutputKey)('added_files', outputPrefix),
value: addedFiles.paths,
inputs
writeOutputFiles: inputs.writeOutputFiles,
outputDir: inputs.outputDir,
json: inputs.json,
shouldEscape: inputs.escapeJson
});
yield (0, utils_1.setOutput)({
key: getOutputKey('added_files_count', outputPrefix),
key: (0, utils_1.getOutputKey)('added_files_count', outputPrefix),
value: addedFiles.count,
inputs
writeOutputFiles: inputs.writeOutputFiles,
outputDir: inputs.outputDir
});
const copiedFiles = yield (0, changedFiles_1.getChangeTypeFiles)({
inputs,
@@ -395,14 +462,18 @@ const setChangedFilesOutput = ({ allDiffFiles, allFilteredDiffFiles, inputs, fil
});
core.debug(`Copied files: ${JSON.stringify(copiedFiles)}`);
yield (0, utils_1.setOutput)({
key: getOutputKey('copied_files', outputPrefix),
key: (0, utils_1.getOutputKey)('copied_files', outputPrefix),
value: copiedFiles.paths,
inputs
writeOutputFiles: inputs.writeOutputFiles,
outputDir: inputs.outputDir,
json: inputs.json,
shouldEscape: inputs.escapeJson
});
yield (0, utils_1.setOutput)({
key: getOutputKey('copied_files_count', outputPrefix),
key: (0, utils_1.getOutputKey)('copied_files_count', outputPrefix),
value: copiedFiles.count,
inputs
writeOutputFiles: inputs.writeOutputFiles,
outputDir: inputs.outputDir
});
const modifiedFiles = yield (0, changedFiles_1.getChangeTypeFiles)({
inputs,
@@ -411,14 +482,18 @@ const setChangedFilesOutput = ({ allDiffFiles, allFilteredDiffFiles, inputs, fil
});
core.debug(`Modified files: ${JSON.stringify(modifiedFiles)}`);
yield (0, utils_1.setOutput)({
key: getOutputKey('modified_files', outputPrefix),
key: (0, utils_1.getOutputKey)('modified_files', outputPrefix),
value: modifiedFiles.paths,
inputs
writeOutputFiles: inputs.writeOutputFiles,
outputDir: inputs.outputDir,
json: inputs.json,
shouldEscape: inputs.escapeJson
});
yield (0, utils_1.setOutput)({
key: getOutputKey('modified_files_count', outputPrefix),
key: (0, utils_1.getOutputKey)('modified_files_count', outputPrefix),
value: modifiedFiles.count,
inputs
writeOutputFiles: inputs.writeOutputFiles,
outputDir: inputs.outputDir
});
const renamedFiles = yield (0, changedFiles_1.getChangeTypeFiles)({
inputs,
@@ -427,14 +502,18 @@ const setChangedFilesOutput = ({ allDiffFiles, allFilteredDiffFiles, inputs, fil
});
core.debug(`Renamed files: ${JSON.stringify(renamedFiles)}`);
yield (0, utils_1.setOutput)({
key: getOutputKey('renamed_files', outputPrefix),
key: (0, utils_1.getOutputKey)('renamed_files', outputPrefix),
value: renamedFiles.paths,
inputs
writeOutputFiles: inputs.writeOutputFiles,
outputDir: inputs.outputDir,
json: inputs.json,
shouldEscape: inputs.escapeJson
});
yield (0, utils_1.setOutput)({
key: getOutputKey('renamed_files_count', outputPrefix),
key: (0, utils_1.getOutputKey)('renamed_files_count', outputPrefix),
value: renamedFiles.count,
inputs
writeOutputFiles: inputs.writeOutputFiles,
outputDir: inputs.outputDir
});
const typeChangedFiles = yield (0, changedFiles_1.getChangeTypeFiles)({
inputs,
@@ -443,14 +522,18 @@ const setChangedFilesOutput = ({ allDiffFiles, allFilteredDiffFiles, inputs, fil
});
core.debug(`Type changed files: ${JSON.stringify(typeChangedFiles)}`);
yield (0, utils_1.setOutput)({
key: getOutputKey('type_changed_files', outputPrefix),
key: (0, utils_1.getOutputKey)('type_changed_files', outputPrefix),
value: typeChangedFiles.paths,
inputs
writeOutputFiles: inputs.writeOutputFiles,
outputDir: inputs.outputDir,
json: inputs.json,
shouldEscape: inputs.escapeJson
});
yield (0, utils_1.setOutput)({
key: getOutputKey('type_changed_files_count', outputPrefix),
key: (0, utils_1.getOutputKey)('type_changed_files_count', outputPrefix),
value: typeChangedFiles.count,
inputs
writeOutputFiles: inputs.writeOutputFiles,
outputDir: inputs.outputDir
});
const unmergedFiles = yield (0, changedFiles_1.getChangeTypeFiles)({
inputs,
@@ -459,14 +542,18 @@ const setChangedFilesOutput = ({ allDiffFiles, allFilteredDiffFiles, inputs, fil
});
core.debug(`Unmerged files: ${JSON.stringify(unmergedFiles)}`);
yield (0, utils_1.setOutput)({
key: getOutputKey('unmerged_files', outputPrefix),
key: (0, utils_1.getOutputKey)('unmerged_files', outputPrefix),
value: unmergedFiles.paths,
inputs
writeOutputFiles: inputs.writeOutputFiles,
outputDir: inputs.outputDir,
json: inputs.json,
shouldEscape: inputs.escapeJson
});
yield (0, utils_1.setOutput)({
key: getOutputKey('unmerged_files_count', outputPrefix),
key: (0, utils_1.getOutputKey)('unmerged_files_count', outputPrefix),
value: unmergedFiles.count,
inputs
writeOutputFiles: inputs.writeOutputFiles,
outputDir: inputs.outputDir
});
const unknownFiles = yield (0, changedFiles_1.getChangeTypeFiles)({
inputs,
@@ -475,14 +562,18 @@ const setChangedFilesOutput = ({ allDiffFiles, allFilteredDiffFiles, inputs, fil
});
core.debug(`Unknown files: ${JSON.stringify(unknownFiles)}`);
yield (0, utils_1.setOutput)({
key: getOutputKey('unknown_files', outputPrefix),
key: (0, utils_1.getOutputKey)('unknown_files', outputPrefix),
value: unknownFiles.paths,
inputs
writeOutputFiles: inputs.writeOutputFiles,
outputDir: inputs.outputDir,
json: inputs.json,
shouldEscape: inputs.escapeJson
});
yield (0, utils_1.setOutput)({
key: getOutputKey('unknown_files_count', outputPrefix),
key: (0, utils_1.getOutputKey)('unknown_files_count', outputPrefix),
value: unknownFiles.count,
inputs
writeOutputFiles: inputs.writeOutputFiles,
outputDir: inputs.outputDir
});
const allChangedAndModifiedFiles = yield (0, changedFiles_1.getAllChangeTypeFiles)({
inputs,
@@ -490,14 +581,18 @@ const setChangedFilesOutput = ({ allDiffFiles, allFilteredDiffFiles, inputs, fil
});
core.debug(`All changed and modified files: ${JSON.stringify(allChangedAndModifiedFiles)}`);
yield (0, utils_1.setOutput)({
key: getOutputKey('all_changed_and_modified_files', outputPrefix),
key: (0, utils_1.getOutputKey)('all_changed_and_modified_files', outputPrefix),
value: allChangedAndModifiedFiles.paths,
inputs
writeOutputFiles: inputs.writeOutputFiles,
outputDir: inputs.outputDir,
json: inputs.json,
shouldEscape: inputs.escapeJson
});
yield (0, utils_1.setOutput)({
key: getOutputKey('all_changed_and_modified_files_count', outputPrefix),
key: (0, utils_1.getOutputKey)('all_changed_and_modified_files_count', outputPrefix),
value: allChangedAndModifiedFiles.count,
inputs
writeOutputFiles: inputs.writeOutputFiles,
outputDir: inputs.outputDir
});
const allChangedFiles = yield (0, changedFiles_1.getChangeTypeFiles)({
inputs,
@@ -511,19 +606,25 @@ const setChangedFilesOutput = ({ allDiffFiles, allFilteredDiffFiles, inputs, fil
});
core.debug(`All changed files: ${JSON.stringify(allChangedFiles)}`);
yield (0, utils_1.setOutput)({
key: getOutputKey('all_changed_files', outputPrefix),
key: (0, utils_1.getOutputKey)('all_changed_files', outputPrefix),
value: allChangedFiles.paths,
inputs
writeOutputFiles: inputs.writeOutputFiles,
outputDir: inputs.outputDir,
json: inputs.json,
shouldEscape: inputs.escapeJson
});
yield (0, utils_1.setOutput)({
key: getOutputKey('all_changed_files_count', outputPrefix),
key: (0, utils_1.getOutputKey)('all_changed_files_count', outputPrefix),
value: allChangedFiles.count,
inputs
writeOutputFiles: inputs.writeOutputFiles,
outputDir: inputs.outputDir
});
yield (0, utils_1.setOutput)({
key: getOutputKey('any_changed', outputPrefix),
key: (0, utils_1.getOutputKey)('any_changed', outputPrefix),
value: allChangedFiles.paths.length > 0 && filePatterns.length > 0,
inputs
writeOutputFiles: inputs.writeOutputFiles,
outputDir: inputs.outputDir,
json: inputs.json
});
const allOtherChangedFiles = yield (0, changedFiles_1.getChangeTypeFiles)({
inputs,
@@ -536,26 +637,30 @@ const setChangedFilesOutput = ({ allDiffFiles, allFilteredDiffFiles, inputs, fil
]
});
core.debug(`All other changed files: ${JSON.stringify(allOtherChangedFiles)}`);
const otherChangedFiles = allOtherChangedFiles.paths
.split(inputs.separator)
.filter((filePath) => !allChangedFiles.paths.split(inputs.separator).includes(filePath));
const allOtherChangedFilesPaths = getArrayFromPaths(allOtherChangedFiles.paths, inputs);
const allChangedFilesPaths = getArrayFromPaths(allChangedFiles.paths, inputs);
const otherChangedFiles = allOtherChangedFilesPaths.filter((filePath) => !allChangedFilesPaths.includes(filePath));
const onlyChanged = otherChangedFiles.length === 0 &&
allChangedFiles.paths.length > 0 &&
filePatterns.length > 0;
yield (0, utils_1.setOutput)({
key: getOutputKey('only_changed', outputPrefix),
key: (0, utils_1.getOutputKey)('only_changed', outputPrefix),
value: onlyChanged,
inputs
writeOutputFiles: inputs.writeOutputFiles,
outputDir: inputs.outputDir,
json: inputs.json
});
yield (0, utils_1.setArrayOutput)({
key: 'other_changed_files',
inputs,
value: otherChangedFiles,
outputPrefix
});
yield (0, utils_1.setOutput)({
key: getOutputKey('other_changed_files', outputPrefix),
value: otherChangedFiles.join(inputs.separator),
inputs
});
yield (0, utils_1.setOutput)({
key: getOutputKey('other_changed_files_count', outputPrefix),
key: (0, utils_1.getOutputKey)('other_changed_files_count', outputPrefix),
value: otherChangedFiles.length.toString(),
inputs
writeOutputFiles: inputs.writeOutputFiles,
outputDir: inputs.outputDir
});
const allModifiedFiles = yield (0, changedFiles_1.getChangeTypeFiles)({
inputs,
@@ -570,19 +675,25 @@ const setChangedFilesOutput = ({ allDiffFiles, allFilteredDiffFiles, inputs, fil
});
core.debug(`All modified files: ${JSON.stringify(allModifiedFiles)}`);
yield (0, utils_1.setOutput)({
key: getOutputKey('all_modified_files', outputPrefix),
key: (0, utils_1.getOutputKey)('all_modified_files', outputPrefix),
value: allModifiedFiles.paths,
inputs
writeOutputFiles: inputs.writeOutputFiles,
outputDir: inputs.outputDir,
json: inputs.json,
shouldEscape: inputs.escapeJson
});
yield (0, utils_1.setOutput)({
key: getOutputKey('all_modified_files_count', outputPrefix),
key: (0, utils_1.getOutputKey)('all_modified_files_count', outputPrefix),
value: allModifiedFiles.count,
inputs
writeOutputFiles: inputs.writeOutputFiles,
outputDir: inputs.outputDir
});
yield (0, utils_1.setOutput)({
key: getOutputKey('any_modified', outputPrefix),
key: (0, utils_1.getOutputKey)('any_modified', outputPrefix),
value: allModifiedFiles.paths.length > 0 && filePatterns.length > 0,
inputs
writeOutputFiles: inputs.writeOutputFiles,
outputDir: inputs.outputDir,
json: inputs.json
});
const allOtherModifiedFiles = yield (0, changedFiles_1.getChangeTypeFiles)({
inputs,
@@ -595,26 +706,30 @@ const setChangedFilesOutput = ({ allDiffFiles, allFilteredDiffFiles, inputs, fil
changedFiles_1.ChangeTypeEnum.Deleted
]
});
const otherModifiedFiles = allOtherModifiedFiles.paths
.split(inputs.separator)
.filter((filePath) => !allModifiedFiles.paths.split(inputs.separator).includes(filePath));
const allOtherModifiedFilesPaths = getArrayFromPaths(allOtherModifiedFiles.paths, inputs);
const allModifiedFilesPaths = getArrayFromPaths(allModifiedFiles.paths, inputs);
const otherModifiedFiles = allOtherModifiedFilesPaths.filter((filePath) => !allModifiedFilesPaths.includes(filePath));
const onlyModified = otherModifiedFiles.length === 0 &&
allModifiedFiles.paths.length > 0 &&
filePatterns.length > 0;
yield (0, utils_1.setOutput)({
key: getOutputKey('only_modified', outputPrefix),
key: (0, utils_1.getOutputKey)('only_modified', outputPrefix),
value: onlyModified,
inputs
writeOutputFiles: inputs.writeOutputFiles,
outputDir: inputs.outputDir,
json: inputs.json
});
yield (0, utils_1.setArrayOutput)({
key: 'other_modified_files',
inputs,
value: otherModifiedFiles,
outputPrefix
});
yield (0, utils_1.setOutput)({
key: getOutputKey('other_modified_files', outputPrefix),
value: otherModifiedFiles.join(inputs.separator),
inputs
});
yield (0, utils_1.setOutput)({
key: getOutputKey('other_modified_files_count', outputPrefix),
key: (0, utils_1.getOutputKey)('other_modified_files_count', outputPrefix),
value: otherModifiedFiles.length.toString(),
inputs
writeOutputFiles: inputs.writeOutputFiles,
outputDir: inputs.outputDir
});
const deletedFiles = yield (0, changedFiles_1.getChangeTypeFiles)({
inputs,
@@ -623,48 +738,62 @@ const setChangedFilesOutput = ({ allDiffFiles, allFilteredDiffFiles, inputs, fil
});
core.debug(`Deleted files: ${JSON.stringify(deletedFiles)}`);
yield (0, utils_1.setOutput)({
key: getOutputKey('deleted_files', outputPrefix),
key: (0, utils_1.getOutputKey)('deleted_files', outputPrefix),
value: deletedFiles.paths,
inputs
writeOutputFiles: inputs.writeOutputFiles,
outputDir: inputs.outputDir,
json: inputs.json,
shouldEscape: inputs.escapeJson
});
yield (0, utils_1.setOutput)({
key: getOutputKey('deleted_files_count', outputPrefix),
key: (0, utils_1.getOutputKey)('deleted_files_count', outputPrefix),
value: deletedFiles.count,
inputs
writeOutputFiles: inputs.writeOutputFiles,
outputDir: inputs.outputDir
});
yield (0, utils_1.setOutput)({
key: getOutputKey('any_deleted', outputPrefix),
key: (0, utils_1.getOutputKey)('any_deleted', outputPrefix),
value: deletedFiles.paths.length > 0 && filePatterns.length > 0,
inputs
writeOutputFiles: inputs.writeOutputFiles,
outputDir: inputs.outputDir,
json: inputs.json
});
const allOtherDeletedFiles = yield (0, changedFiles_1.getChangeTypeFiles)({
inputs,
changedFiles: allDiffFiles,
changeTypes: [changedFiles_1.ChangeTypeEnum.Deleted]
});
const otherDeletedFiles = allOtherDeletedFiles.paths
.split(inputs.separator)
.filter(filePath => !deletedFiles.paths.split(inputs.separator).includes(filePath));
const allOtherDeletedFilesPaths = getArrayFromPaths(allOtherDeletedFiles.paths, inputs);
const deletedFilesPaths = getArrayFromPaths(deletedFiles.paths, inputs);
const otherDeletedFiles = allOtherDeletedFilesPaths.filter(filePath => !deletedFilesPaths.includes(filePath));
const onlyDeleted = otherDeletedFiles.length === 0 &&
deletedFiles.paths.length > 0 &&
filePatterns.length > 0;
yield (0, utils_1.setOutput)({
key: getOutputKey('only_deleted', outputPrefix),
key: (0, utils_1.getOutputKey)('only_deleted', outputPrefix),
value: onlyDeleted,
inputs
writeOutputFiles: inputs.writeOutputFiles,
outputDir: inputs.outputDir,
json: inputs.json
});
yield (0, utils_1.setArrayOutput)({
key: 'other_deleted_files',
inputs,
value: otherDeletedFiles,
outputPrefix
});
yield (0, utils_1.setOutput)({
key: getOutputKey('other_deleted_files', outputPrefix),
value: otherDeletedFiles.join(inputs.separator),
inputs
});
yield (0, utils_1.setOutput)({
key: getOutputKey('other_deleted_files_count', outputPrefix),
key: (0, utils_1.getOutputKey)('other_deleted_files_count', outputPrefix),
value: otherDeletedFiles.length.toString(),
inputs
writeOutputFiles: inputs.writeOutputFiles,
outputDir: inputs.outputDir
});
return {
anyModified: allModifiedFiles.paths.length > 0 && filePatterns.length > 0,
anyChanged: allChangedFiles.paths.length > 0 && filePatterns.length > 0
};
});
exports.setChangedFilesOutput = setChangedFilesOutput;
exports.setOutputsAndGetModifiedAndChangedFilesStatus = setOutputsAndGetModifiedAndChangedFilesStatus;
/***/ }),
@@ -1033,25 +1162,50 @@ const getSHAForPullRequestEvent = (inputs, env, workingDirectory, isShallow, has
previousSha = github.context.payload.before;
if (!previousSha ||
(previousSha &&
(yield (0, utils_1.verifyCommitSha)({ sha: previousSha, cwd: workingDirectory })) !==
0)) {
core.warning('Unable to locate the remote branch head sha. Falling back to the previous commit in the local history.');
(yield (0, utils_1.verifyCommitSha)({
sha: previousSha,
cwd: workingDirectory,
showAsErrorMessage: false
})) !== 0)) {
core.info(`Unable to locate the previous commit in the local history for ${github.context.eventName} (${github.context.payload.action}) event. Falling back to the previous commit in the local history.`);
previousSha = yield (0, utils_1.getParentSha)({
cwd: workingDirectory
});
if (!previousSha) {
core.warning('Unable to locate the previous commit in the local history. Falling back to the pull request base sha.');
previousSha = (_w = (_v = github.context.payload.pull_request) === null || _v === void 0 ? void 0 : _v.base) === null || _w === void 0 ? void 0 : _w.sha;
if (github.context.payload.action &&
github.context.payload.action === 'synchronize' &&
previousSha &&
(!previousSha ||
(previousSha &&
(yield (0, utils_1.verifyCommitSha)({
sha: previousSha,
cwd: workingDirectory,
showAsErrorMessage: false
})) !== 0))) {
throw new Error('Unable to locate the previous commit in the local history. Please ensure to checkout pull request HEAD commit instead of the merge commit. See: https://github.com/actions/checkout/blob/main/README.md#checkout-pull-request-head-commit-instead-of-merge-commit');
}
if (!previousSha ||
(previousSha &&
(yield (0, utils_1.verifyCommitSha)({
sha: previousSha,
cwd: workingDirectory,
showAsErrorMessage: false
})) !== 0)) {
throw new Error('Unable to locate the previous commit in the local history. Please ensure to checkout pull request HEAD commit instead of the merge commit. See: https://github.com/actions/checkout/blob/main/README.md#checkout-pull-request-head-commit-instead-of-merge-commit');
}
}
}
else {
previousSha = yield (0, utils_1.getRemoteBranchHeadSha)({
cwd: workingDirectory,
branch: targetBranch
});
if (!previousSha) {
previousSha = (_y = (_x = github.context.payload.pull_request) === null || _x === void 0 ? void 0 : _x.base) === null || _y === void 0 ? void 0 : _y.sha;
if (github.context.payload.action === 'closed') {
previousSha = (_w = (_v = github.context.payload.pull_request) === null || _v === void 0 ? void 0 : _v.base) === null || _w === void 0 ? void 0 : _w.sha;
}
else {
previousSha = yield (0, utils_1.getRemoteBranchHeadSha)({
cwd: workingDirectory,
branch: targetBranch
});
if (!previousSha) {
previousSha = (_y = (_x = github.context.payload.pull_request) === null || _x === void 0 ? void 0 : _x.base) === null || _y === void 0 ? void 0 : _y.sha;
}
}
if (isShallow) {
if (!(yield (0, utils_1.canDiffCommits)({
@@ -1331,6 +1485,12 @@ const getInputs = () => {
const fetchSubmoduleHistory = core.getBooleanInput('fetch_additional_submodule_history', {
required: false
});
const failOnInitialDiffError = core.getBooleanInput('fail_on_initial_diff_error', {
required: false
});
const failOnSubmoduleDiffError = core.getBooleanInput('fail_on_submodule_diff_error', {
required: false
});
const inputs = {
files,
filesSeparator,
@@ -1346,6 +1506,8 @@ const getInputs = () => {
filesIgnoreYaml,
filesIgnoreYamlFromSourceFile,
filesIgnoreYamlFromSourceFileSeparator,
failOnInitialDiffError,
failOnSubmoduleDiffError,
separator,
// Not Supported via REST API
sha,
@@ -1439,59 +1601,11 @@ const core = __importStar(__nccwpck_require__(2186));
const github = __importStar(__nccwpck_require__(5438));
const path_1 = __importDefault(__nccwpck_require__(1017));
const changedFiles_1 = __nccwpck_require__(7358);
const changedFilesOutput_1 = __nccwpck_require__(8930);
const commitSha_1 = __nccwpck_require__(8613);
const env_1 = __nccwpck_require__(9763);
const inputs_1 = __nccwpck_require__(6180);
const utils_1 = __nccwpck_require__(918);
const changedFilesOutput = ({ filePatterns, allDiffFiles, inputs, yamlFilePatterns }) => __awaiter(void 0, void 0, void 0, function* () {
if (filePatterns.length > 0) {
core.startGroup('changed-files-patterns');
const allFilteredDiffFiles = yield (0, utils_1.getFilteredChangedFiles)({
allDiffFiles,
filePatterns
});
core.debug(`All filtered diff files: ${JSON.stringify(allFilteredDiffFiles)}`);
yield (0, changedFilesOutput_1.setChangedFilesOutput)({
allDiffFiles,
allFilteredDiffFiles,
inputs,
filePatterns
});
core.info('All Done!');
core.endGroup();
}
if (Object.keys(yamlFilePatterns).length > 0) {
for (const key of Object.keys(yamlFilePatterns)) {
core.startGroup(`changed-files-yaml-${key}`);
const allFilteredDiffFiles = yield (0, utils_1.getFilteredChangedFiles)({
allDiffFiles,
filePatterns: yamlFilePatterns[key]
});
core.debug(`All filtered diff files for ${key}: ${JSON.stringify(allFilteredDiffFiles)}`);
yield (0, changedFilesOutput_1.setChangedFilesOutput)({
allDiffFiles,
allFilteredDiffFiles,
inputs,
filePatterns: yamlFilePatterns[key],
outputPrefix: key
});
core.info('All Done!');
core.endGroup();
}
}
if (filePatterns.length === 0 && Object.keys(yamlFilePatterns).length === 0) {
core.startGroup('changed-files-all');
yield (0, changedFilesOutput_1.setChangedFilesOutput)({
allDiffFiles,
allFilteredDiffFiles: allDiffFiles,
inputs
});
core.info('All Done!');
core.endGroup();
}
});
const getChangedFilesFromLocalGit = ({ inputs, env, workingDirectory, filePatterns, yamlFilePatterns }) => __awaiter(void 0, void 0, void 0, function* () {
const getChangedFilesFromLocalGitHistory = ({ inputs, env, workingDirectory, filePatterns, yamlFilePatterns }) => __awaiter(void 0, void 0, void 0, function* () {
var _a, _b, _c;
yield (0, utils_1.verifyMinimumGitVersion)();
let quotePathValue = 'on';
@@ -1541,7 +1655,9 @@ const getChangedFilesFromLocalGit = ({ inputs, env, workingDirectory, filePatter
diffResult,
submodulePaths,
outputRenamedFilesAsDeletedAndAdded,
fetchSubmoduleHistory: inputs.fetchSubmoduleHistory
fetchSubmoduleHistory: inputs.fetchSubmoduleHistory,
failOnInitialDiffError: inputs.failOnInitialDiffError,
failOnSubmoduleDiffError: inputs.failOnSubmoduleDiffError
});
core.debug(`All diff files: ${JSON.stringify(allDiffFiles)}`);
core.info('All Done!');
@@ -1560,7 +1676,7 @@ const getChangedFilesFromLocalGit = ({ inputs, env, workingDirectory, filePatter
sha: diffResult.previousSha
});
}
yield changedFilesOutput({
yield (0, changedFiles_1.processChangedFiles)({
filePatterns,
allDiffFiles,
inputs,
@@ -1579,12 +1695,16 @@ const getChangedFilesFromLocalGit = ({ inputs, env, workingDirectory, filePatter
yield (0, utils_1.setOutput)({
key: 'all_old_new_renamed_files',
value: allOldNewRenamedFiles.paths,
inputs
writeOutputFiles: inputs.writeOutputFiles,
outputDir: inputs.outputDir,
json: inputs.json
});
yield (0, utils_1.setOutput)({
key: 'all_old_new_renamed_files_count',
value: allOldNewRenamedFiles.count,
inputs
writeOutputFiles: inputs.writeOutputFiles,
outputDir: inputs.outputDir,
json: inputs.json
});
core.info('All Done!');
core.endGroup();
@@ -1596,7 +1716,7 @@ const getChangedFilesFromRESTAPI = ({ inputs, filePatterns, yamlFilePatterns })
});
core.debug(`All diff files: ${JSON.stringify(allDiffFiles)}`);
core.info('All Done!');
yield changedFilesOutput({
yield (0, changedFiles_1.processChangedFiles)({
filePatterns,
allDiffFiles,
inputs,
@@ -1661,7 +1781,7 @@ function run() {
return;
}
core.info('Using local .git directory');
yield getChangedFilesFromLocalGit({
yield getChangedFilesFromLocalGitHistory({
inputs,
env,
workingDirectory,
@@ -1743,7 +1863,7 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
return (mod && mod.__esModule) ? mod : { "default": mod };
};
Object.defineProperty(exports, "__esModule", ({ value: true }));
exports.hasLocalGitDirectory = exports.recoverDeletedFiles = exports.setOutput = exports.getRecoverFilePatterns = exports.getYamlFilePatterns = exports.getFilePatterns = exports.getDirNamesIncludeFilesPattern = exports.jsonOutput = exports.getDirnameMaxDepth = exports.canDiffCommits = exports.getPreviousGitTag = exports.verifyCommitSha = exports.getParentSha = exports.getRemoteBranchHeadSha = exports.isInsideWorkTree = exports.getHeadSha = exports.gitLog = exports.getFilteredChangedFiles = exports.getAllChangedFiles = exports.gitRenamedFiles = exports.gitSubmoduleDiffSHA = exports.getSubmodulePath = exports.gitFetchSubmodules = exports.gitFetch = exports.submoduleExists = exports.isRepoShallow = exports.updateGitGlobalConfig = exports.verifyMinimumGitVersion = exports.getDirname = exports.normalizeSeparators = exports.isWindows = void 0;
exports.hasLocalGitDirectory = exports.recoverDeletedFiles = exports.setOutput = exports.setArrayOutput = exports.getOutputKey = exports.getRecoverFilePatterns = exports.getYamlFilePatterns = exports.getFilePatterns = exports.getDirNamesIncludeFilesPattern = exports.jsonOutput = exports.getDirnameMaxDepth = exports.canDiffCommits = exports.getPreviousGitTag = exports.verifyCommitSha = exports.getParentSha = exports.getRemoteBranchHeadSha = exports.isInsideWorkTree = exports.getHeadSha = exports.gitLog = exports.getFilteredChangedFiles = exports.getAllChangedFiles = exports.gitRenamedFiles = exports.gitSubmoduleDiffSHA = exports.getSubmodulePath = exports.gitFetchSubmodules = exports.gitFetch = exports.submoduleExists = exports.isRepoShallow = exports.updateGitGlobalConfig = exports.verifyMinimumGitVersion = exports.getDirname = exports.normalizeSeparators = exports.isWindows = void 0;
/*global AsyncIterableIterator*/
const core = __importStar(__nccwpck_require__(2186));
const exec = __importStar(__nccwpck_require__(1514));
@@ -2114,8 +2234,10 @@ exports.gitRenamedFiles = gitRenamedFiles;
* @param isSubmodule - is the repo a submodule
* @param parentDir - parent directory of the submodule
* @param outputRenamedFilesAsDeletedAndAdded - output renamed files as deleted and added
* @param failOnInitialDiffError - fail if the initial diff fails
* @param failOnSubmoduleDiffError - fail if the submodule diff fails
*/
const getAllChangedFiles = ({ cwd, sha1, sha2, diff, isSubmodule = false, parentDir = '', outputRenamedFilesAsDeletedAndAdded = false }) => __awaiter(void 0, void 0, void 0, function* () {
const getAllChangedFiles = ({ cwd, sha1, sha2, diff, isSubmodule = false, parentDir = '', outputRenamedFilesAsDeletedAndAdded = false, failOnInitialDiffError = false, failOnSubmoduleDiffError = false }) => __awaiter(void 0, void 0, void 0, function* () {
const { exitCode, stdout, stderr } = yield exec.getExecOutput('git', [
'diff',
'--name-status',
@@ -2137,6 +2259,14 @@ const getAllChangedFiles = ({ cwd, sha1, sha2, diff, isSubmodule = false, parent
[changedFiles_1.ChangeTypeEnum.Unmerged]: [],
[changedFiles_1.ChangeTypeEnum.Unknown]: []
};
if (exitCode !== 0) {
if (failOnInitialDiffError && !isSubmodule) {
throw new Error(`Failed to get changed files between: ${sha1}${diff}${sha2}: ${stderr}`);
}
else if (failOnSubmoduleDiffError && isSubmodule) {
throw new Error(`Failed to get changed files for submodule between: ${sha1}${diff}${sha2}: ${stderr}`);
}
}
if (exitCode !== 0) {
if (isSubmodule) {
core.warning(stderr ||
@@ -2416,7 +2546,7 @@ const getFilePatterns = ({ inputs, workingDirectory }) => __awaiter(void 0, void
else {
const pathParts = pattern.split('/');
const lastPart = pathParts[pathParts.length - 1];
if (!lastPart.includes('.') && !lastPart.includes('*')) {
if (!lastPart.includes('.')) {
return `${pattern}/**`;
}
else {
@@ -2554,12 +2684,33 @@ const getRecoverFilePatterns = ({ inputs }) => {
return filePatterns.filter(Boolean);
};
exports.getRecoverFilePatterns = getRecoverFilePatterns;
const setOutput = ({ key, value, inputs }) => __awaiter(void 0, void 0, void 0, function* () {
const cleanedValue = value.toString().trim();
const getOutputKey = (key, outputPrefix) => {
return outputPrefix ? `${outputPrefix}_${key}` : key;
};
exports.getOutputKey = getOutputKey;
const setArrayOutput = ({ key, inputs, value, outputPrefix }) => __awaiter(void 0, void 0, void 0, function* () {
core.debug(`${key}: ${JSON.stringify(value)}`);
yield (0, exports.setOutput)({
key: outputPrefix ? (0, exports.getOutputKey)(key, outputPrefix) : key,
value: inputs.json ? value : value.join(inputs.separator),
writeOutputFiles: inputs.writeOutputFiles,
outputDir: inputs.outputDir,
json: inputs.json,
shouldEscape: inputs.escapeJson
});
});
exports.setArrayOutput = setArrayOutput;
const setOutput = ({ key, value, writeOutputFiles, outputDir, json = false, shouldEscape = false }) => __awaiter(void 0, void 0, void 0, function* () {
let cleanedValue;
if (json) {
cleanedValue = (0, exports.jsonOutput)({ value, shouldEscape });
}
else {
cleanedValue = value.toString().trim();
}
core.setOutput(key, cleanedValue);
if (inputs.writeOutputFiles) {
const outputDir = inputs.outputDir;
const extension = inputs.json ? 'json' : 'txt';
if (writeOutputFiles) {
const extension = json ? 'json' : 'txt';
const outputFilePath = path.join(outputDir, `${key}.${extension}`);
if (!(yield exists(outputDir))) {
yield fs_1.promises.mkdir(outputDir, { recursive: true });
@@ -3174,7 +3325,7 @@ class OidcClient {
.catch(error => {
throw new Error(`Failed to get ID Token. \n
Error Code : ${error.statusCode}\n
Error Message: ${error.result.message}`);
Error Message: ${error.message}`);
});
const id_token = (_a = res.result) === null || _a === void 0 ? void 0 : _a.value;
if (!id_token) {
@@ -38004,6 +38155,8 @@ function debug(logLevel, ...messages) {
}
function warn(logLevel, warning) {
if (logLevel === 'debug' || logLevel === 'warn') {
// https://github.com/typescript-eslint/typescript-eslint/issues/7478
// eslint-disable-next-line @typescript-eslint/prefer-optional-chain
if (typeof process !== 'undefined' && process.emitWarning)
process.emitWarning(warning);
else
@@ -38785,7 +38938,7 @@ function stringifyKey(key, jsKey, ctx) {
return '';
if (typeof jsKey !== 'object')
return String(jsKey);
if (identity.isNode(key) && ctx && ctx.doc) {
if (identity.isNode(key) && ctx?.doc) {
const strCtx = stringify.createStringifyContext(ctx.doc, {});
strCtx.anchors = new Set();
for (const node of ctx.anchors.keys())
@@ -42164,8 +42317,9 @@ function createPairs(schema, iterable, ctx) {
key = keys[0];
value = it[key];
}
else
throw new TypeError(`Expected { key: value } tuple: ${it}`);
else {
throw new TypeError(`Expected tuple with one key, not ${keys.length} keys`);
}
}
else {
key = it;
@@ -42840,7 +42994,7 @@ function stringifyFlowCollection({ comment, items }, ctx, { flowChars, itemInden
if (iv.commentBefore)
reqNewline = true;
}
else if (item.value == null && ik && ik.comment) {
else if (item.value == null && ik?.comment) {
comment = ik.comment;
}
}
@@ -43466,7 +43620,7 @@ function blockString({ comment, type, value }, ctx, onComment, onChompKeep) {
function plainString(item, ctx, onComment, onChompKeep) {
const { type, value } = item;
const { actualString, implicitKey, indent, indentStep, inFlow } = ctx;
if ((implicitKey && /[\n[\]{},]/.test(value)) ||
if ((implicitKey && value.includes('\n')) ||
(inFlow && /[[\]{},]/.test(value))) {
return quotedString(value, ctx);
}

2
dist/index.js.map generated vendored

File diff suppressed because one or more lines are too long

View File

@@ -1,6 +1,6 @@
{
"name": "@tj-actions/changed-files",
"version": "37.4.0",
"version": "39.1.0",
"description": "Github action to retrieve all (added, copied, modified, deleted, renamed, type changed, unmerged, unknown) files and directories.",
"main": "lib/main.js",
"publishConfig": {
@@ -35,7 +35,7 @@
"@actions/core": "^1.10.0",
"@actions/exec": "^1.1.1",
"@actions/github": "^5.1.1",
"@octokit/rest": "^19.0.13",
"@octokit/rest": "^20.0.1",
"lodash": "^4.17.21",
"micromatch": "^4.0.5",
"yaml": "^2.3.1"
@@ -48,7 +48,7 @@
"@types/uuid": "^9.0.2",
"@typescript-eslint/eslint-plugin": "^6.0.0",
"@typescript-eslint/parser": "^6.0.0",
"@vercel/ncc": "^0.36.1",
"@vercel/ncc": "^0.38.0",
"eslint": "^8.43.0",
"eslint-plugin-github": "^4.8.0",
"eslint-plugin-jest": "^27.2.2",

View File

@@ -4,7 +4,7 @@ import type {RestEndpointMethodTypes} from '@octokit/rest'
import flatten from 'lodash/flatten'
import mm from 'micromatch'
import * as path from 'path'
import {setOutputsAndGetModifiedAndChangedFilesStatus} from './changedFilesOutput'
import {DiffResult} from './commitSha'
import {Inputs} from './inputs'
import {
@@ -12,12 +12,107 @@ import {
getAllChangedFiles,
getDirnameMaxDepth,
getDirNamesIncludeFilesPattern,
getFilteredChangedFiles,
gitRenamedFiles,
gitSubmoduleDiffSHA,
isWindows,
jsonOutput
jsonOutput,
setArrayOutput
} from './utils'
export const processChangedFiles = async ({
filePatterns,
allDiffFiles,
inputs,
yamlFilePatterns
}: {
filePatterns: string[]
allDiffFiles: ChangedFiles
inputs: Inputs
yamlFilePatterns: Record<string, string[]>
}): Promise<void> => {
if (filePatterns.length > 0) {
core.startGroup('changed-files-patterns')
const allFilteredDiffFiles = await getFilteredChangedFiles({
allDiffFiles,
filePatterns
})
core.debug(
`All filtered diff files: ${JSON.stringify(allFilteredDiffFiles)}`
)
await setOutputsAndGetModifiedAndChangedFilesStatus({
allDiffFiles,
allFilteredDiffFiles,
inputs,
filePatterns
})
core.info('All Done!')
core.endGroup()
}
if (Object.keys(yamlFilePatterns).length > 0) {
const modifiedKeys: string[] = []
const changedKeys: string[] = []
for (const key of Object.keys(yamlFilePatterns)) {
core.startGroup(`changed-files-yaml-${key}`)
const allFilteredDiffFiles = await getFilteredChangedFiles({
allDiffFiles,
filePatterns: yamlFilePatterns[key]
})
core.debug(
`All filtered diff files for ${key}: ${JSON.stringify(
allFilteredDiffFiles
)}`
)
const {anyChanged, anyModified} =
await setOutputsAndGetModifiedAndChangedFilesStatus({
allDiffFiles,
allFilteredDiffFiles,
inputs,
filePatterns: yamlFilePatterns[key],
outputPrefix: key
})
if (anyModified) {
modifiedKeys.push(key)
}
if (anyChanged) {
changedKeys.push(key)
}
core.info('All Done!')
core.endGroup()
}
if (modifiedKeys.length > 0) {
await setArrayOutput({
key: 'modified_keys',
inputs,
value: modifiedKeys
})
}
if (changedKeys.length > 0) {
await setArrayOutput({
key: 'changed_keys',
inputs,
value: changedKeys
})
}
}
if (filePatterns.length === 0 && Object.keys(yamlFilePatterns).length === 0) {
core.startGroup('changed-files-all')
await setOutputsAndGetModifiedAndChangedFilesStatus({
allDiffFiles,
allFilteredDiffFiles: allDiffFiles,
inputs
})
core.info('All Done!')
core.endGroup()
}
}
export const getRenamedFiles = async ({
inputs,
workingDirectory,
@@ -121,7 +216,9 @@ export const getAllDiffFiles = async ({
diffResult,
submodulePaths,
outputRenamedFilesAsDeletedAndAdded,
fetchSubmoduleHistory
fetchSubmoduleHistory,
failOnInitialDiffError,
failOnSubmoduleDiffError
}: {
workingDirectory: string
hasSubmodule: boolean
@@ -129,13 +226,16 @@ export const getAllDiffFiles = async ({
submodulePaths: string[]
outputRenamedFilesAsDeletedAndAdded: boolean
fetchSubmoduleHistory: boolean
failOnInitialDiffError: boolean
failOnSubmoduleDiffError: boolean
}): Promise<ChangedFiles> => {
const files = await getAllChangedFiles({
cwd: workingDirectory,
sha1: diffResult.previousSha,
sha2: diffResult.currentSha,
diff: diffResult.diff,
outputRenamedFilesAsDeletedAndAdded
outputRenamedFilesAsDeletedAndAdded,
failOnInitialDiffError
})
if (hasSubmodule) {
@@ -179,7 +279,8 @@ export const getAllDiffFiles = async ({
diff,
isSubmodule: true,
parentDir: submodulePath,
outputRenamedFilesAsDeletedAndAdded
outputRenamedFilesAsDeletedAndAdded,
failOnSubmoduleDiffError
})
for (const changeType of Object.keys(
@@ -262,20 +363,15 @@ export const getChangeTypeFiles = async ({
inputs: Inputs
changedFiles: ChangedFiles
changeTypes: ChangeTypeEnum[]
}): Promise<{paths: string; count: string}> => {
}): Promise<{paths: string[] | string; count: string}> => {
const files = [
...new Set(getChangeTypeFilesGenerator({inputs, changedFiles, changeTypes}))
].filter(Boolean)
if (inputs.json) {
return {
paths: jsonOutput({value: files, shouldEscape: inputs.escapeJson}),
count: files.length.toString()
}
}
const paths = inputs.json ? files : files.join(inputs.separator)
return {
paths: files.join(inputs.separator),
paths,
count: files.length.toString()
}
}
@@ -311,20 +407,15 @@ export const getAllChangeTypeFiles = async ({
}: {
inputs: Inputs
changedFiles: ChangedFiles
}): Promise<{paths: string; count: string}> => {
}): Promise<{paths: string[] | string; count: string}> => {
const files = [
...new Set(getAllChangeTypeFilesGenerator({inputs, changedFiles}))
].filter(Boolean)
if (inputs.json) {
return {
paths: jsonOutput({value: files, shouldEscape: inputs.escapeJson}),
count: files.length.toString()
}
}
const paths = inputs.json ? files : files.join(inputs.separator)
return {
paths: files.join(inputs.separator),
paths,
count: files.length.toString()
}
}

View File

@@ -6,13 +6,16 @@ import {
getChangeTypeFiles
} from './changedFiles'
import {Inputs} from './inputs'
import {setOutput} from './utils'
import {getOutputKey, setArrayOutput, setOutput} from './utils'
const getOutputKey = (key: string, outputPrefix: string): string => {
return outputPrefix ? `${outputPrefix}_${key}` : key
const getArrayFromPaths = (
paths: string | string[],
inputs: Inputs
): string[] => {
return Array.isArray(paths) ? paths : paths.split(inputs.separator)
}
export const setChangedFilesOutput = async ({
export const setOutputsAndGetModifiedAndChangedFilesStatus = async ({
allDiffFiles,
allFilteredDiffFiles,
inputs,
@@ -24,7 +27,7 @@ export const setChangedFilesOutput = async ({
inputs: Inputs
filePatterns?: string[]
outputPrefix?: string
}): Promise<void> => {
}): Promise<{anyModified: boolean; anyChanged: boolean}> => {
const addedFiles = await getChangeTypeFiles({
inputs,
changedFiles: allFilteredDiffFiles,
@@ -34,12 +37,16 @@ export const setChangedFilesOutput = async ({
await setOutput({
key: getOutputKey('added_files', outputPrefix),
value: addedFiles.paths,
inputs
writeOutputFiles: inputs.writeOutputFiles,
outputDir: inputs.outputDir,
json: inputs.json,
shouldEscape: inputs.escapeJson
})
await setOutput({
key: getOutputKey('added_files_count', outputPrefix),
value: addedFiles.count,
inputs
writeOutputFiles: inputs.writeOutputFiles,
outputDir: inputs.outputDir
})
const copiedFiles = await getChangeTypeFiles({
@@ -51,13 +58,17 @@ export const setChangedFilesOutput = async ({
await setOutput({
key: getOutputKey('copied_files', outputPrefix),
value: copiedFiles.paths,
inputs
writeOutputFiles: inputs.writeOutputFiles,
outputDir: inputs.outputDir,
json: inputs.json,
shouldEscape: inputs.escapeJson
})
await setOutput({
key: getOutputKey('copied_files_count', outputPrefix),
value: copiedFiles.count,
inputs
writeOutputFiles: inputs.writeOutputFiles,
outputDir: inputs.outputDir
})
const modifiedFiles = await getChangeTypeFiles({
@@ -69,13 +80,17 @@ export const setChangedFilesOutput = async ({
await setOutput({
key: getOutputKey('modified_files', outputPrefix),
value: modifiedFiles.paths,
inputs
writeOutputFiles: inputs.writeOutputFiles,
outputDir: inputs.outputDir,
json: inputs.json,
shouldEscape: inputs.escapeJson
})
await setOutput({
key: getOutputKey('modified_files_count', outputPrefix),
value: modifiedFiles.count,
inputs
writeOutputFiles: inputs.writeOutputFiles,
outputDir: inputs.outputDir
})
const renamedFiles = await getChangeTypeFiles({
@@ -87,13 +102,17 @@ export const setChangedFilesOutput = async ({
await setOutput({
key: getOutputKey('renamed_files', outputPrefix),
value: renamedFiles.paths,
inputs
writeOutputFiles: inputs.writeOutputFiles,
outputDir: inputs.outputDir,
json: inputs.json,
shouldEscape: inputs.escapeJson
})
await setOutput({
key: getOutputKey('renamed_files_count', outputPrefix),
value: renamedFiles.count,
inputs
writeOutputFiles: inputs.writeOutputFiles,
outputDir: inputs.outputDir
})
const typeChangedFiles = await getChangeTypeFiles({
@@ -105,13 +124,17 @@ export const setChangedFilesOutput = async ({
await setOutput({
key: getOutputKey('type_changed_files', outputPrefix),
value: typeChangedFiles.paths,
inputs
writeOutputFiles: inputs.writeOutputFiles,
outputDir: inputs.outputDir,
json: inputs.json,
shouldEscape: inputs.escapeJson
})
await setOutput({
key: getOutputKey('type_changed_files_count', outputPrefix),
value: typeChangedFiles.count,
inputs
writeOutputFiles: inputs.writeOutputFiles,
outputDir: inputs.outputDir
})
const unmergedFiles = await getChangeTypeFiles({
@@ -123,13 +146,17 @@ export const setChangedFilesOutput = async ({
await setOutput({
key: getOutputKey('unmerged_files', outputPrefix),
value: unmergedFiles.paths,
inputs
writeOutputFiles: inputs.writeOutputFiles,
outputDir: inputs.outputDir,
json: inputs.json,
shouldEscape: inputs.escapeJson
})
await setOutput({
key: getOutputKey('unmerged_files_count', outputPrefix),
value: unmergedFiles.count,
inputs
writeOutputFiles: inputs.writeOutputFiles,
outputDir: inputs.outputDir
})
const unknownFiles = await getChangeTypeFiles({
@@ -141,13 +168,17 @@ export const setChangedFilesOutput = async ({
await setOutput({
key: getOutputKey('unknown_files', outputPrefix),
value: unknownFiles.paths,
inputs
writeOutputFiles: inputs.writeOutputFiles,
outputDir: inputs.outputDir,
json: inputs.json,
shouldEscape: inputs.escapeJson
})
await setOutput({
key: getOutputKey('unknown_files_count', outputPrefix),
value: unknownFiles.count,
inputs
writeOutputFiles: inputs.writeOutputFiles,
outputDir: inputs.outputDir
})
const allChangedAndModifiedFiles = await getAllChangeTypeFiles({
@@ -162,13 +193,17 @@ export const setChangedFilesOutput = async ({
await setOutput({
key: getOutputKey('all_changed_and_modified_files', outputPrefix),
value: allChangedAndModifiedFiles.paths,
inputs
writeOutputFiles: inputs.writeOutputFiles,
outputDir: inputs.outputDir,
json: inputs.json,
shouldEscape: inputs.escapeJson
})
await setOutput({
key: getOutputKey('all_changed_and_modified_files_count', outputPrefix),
value: allChangedAndModifiedFiles.count,
inputs
writeOutputFiles: inputs.writeOutputFiles,
outputDir: inputs.outputDir
})
const allChangedFiles = await getChangeTypeFiles({
@@ -185,19 +220,25 @@ export const setChangedFilesOutput = async ({
await setOutput({
key: getOutputKey('all_changed_files', outputPrefix),
value: allChangedFiles.paths,
inputs
writeOutputFiles: inputs.writeOutputFiles,
outputDir: inputs.outputDir,
json: inputs.json,
shouldEscape: inputs.escapeJson
})
await setOutput({
key: getOutputKey('all_changed_files_count', outputPrefix),
value: allChangedFiles.count,
inputs
writeOutputFiles: inputs.writeOutputFiles,
outputDir: inputs.outputDir
})
await setOutput({
key: getOutputKey('any_changed', outputPrefix),
value: allChangedFiles.paths.length > 0 && filePatterns.length > 0,
inputs
writeOutputFiles: inputs.writeOutputFiles,
outputDir: inputs.outputDir,
json: inputs.json
})
const allOtherChangedFiles = await getChangeTypeFiles({
@@ -212,12 +253,18 @@ export const setChangedFilesOutput = async ({
})
core.debug(`All other changed files: ${JSON.stringify(allOtherChangedFiles)}`)
const otherChangedFiles = allOtherChangedFiles.paths
.split(inputs.separator)
.filter(
(filePath: string) =>
!allChangedFiles.paths.split(inputs.separator).includes(filePath)
)
const allOtherChangedFilesPaths: string[] = getArrayFromPaths(
allOtherChangedFiles.paths,
inputs
)
const allChangedFilesPaths: string[] = getArrayFromPaths(
allChangedFiles.paths,
inputs
)
const otherChangedFiles = allOtherChangedFilesPaths.filter(
(filePath: string) => !allChangedFilesPaths.includes(filePath)
)
const onlyChanged =
otherChangedFiles.length === 0 &&
@@ -227,19 +274,23 @@ export const setChangedFilesOutput = async ({
await setOutput({
key: getOutputKey('only_changed', outputPrefix),
value: onlyChanged,
inputs
writeOutputFiles: inputs.writeOutputFiles,
outputDir: inputs.outputDir,
json: inputs.json
})
await setOutput({
key: getOutputKey('other_changed_files', outputPrefix),
value: otherChangedFiles.join(inputs.separator),
inputs
await setArrayOutput({
key: 'other_changed_files',
inputs,
value: otherChangedFiles,
outputPrefix
})
await setOutput({
key: getOutputKey('other_changed_files_count', outputPrefix),
value: otherChangedFiles.length.toString(),
inputs
writeOutputFiles: inputs.writeOutputFiles,
outputDir: inputs.outputDir
})
const allModifiedFiles = await getChangeTypeFiles({
@@ -257,19 +308,25 @@ export const setChangedFilesOutput = async ({
await setOutput({
key: getOutputKey('all_modified_files', outputPrefix),
value: allModifiedFiles.paths,
inputs
writeOutputFiles: inputs.writeOutputFiles,
outputDir: inputs.outputDir,
json: inputs.json,
shouldEscape: inputs.escapeJson
})
await setOutput({
key: getOutputKey('all_modified_files_count', outputPrefix),
value: allModifiedFiles.count,
inputs
writeOutputFiles: inputs.writeOutputFiles,
outputDir: inputs.outputDir
})
await setOutput({
key: getOutputKey('any_modified', outputPrefix),
value: allModifiedFiles.paths.length > 0 && filePatterns.length > 0,
inputs
writeOutputFiles: inputs.writeOutputFiles,
outputDir: inputs.outputDir,
json: inputs.json
})
const allOtherModifiedFiles = await getChangeTypeFiles({
@@ -284,12 +341,19 @@ export const setChangedFilesOutput = async ({
]
})
const otherModifiedFiles = allOtherModifiedFiles.paths
.split(inputs.separator)
.filter(
(filePath: string) =>
!allModifiedFiles.paths.split(inputs.separator).includes(filePath)
)
const allOtherModifiedFilesPaths: string[] = getArrayFromPaths(
allOtherModifiedFiles.paths,
inputs
)
const allModifiedFilesPaths: string[] = getArrayFromPaths(
allModifiedFiles.paths,
inputs
)
const otherModifiedFiles = allOtherModifiedFilesPaths.filter(
(filePath: string) => !allModifiedFilesPaths.includes(filePath)
)
const onlyModified =
otherModifiedFiles.length === 0 &&
@@ -299,19 +363,23 @@ export const setChangedFilesOutput = async ({
await setOutput({
key: getOutputKey('only_modified', outputPrefix),
value: onlyModified,
inputs
writeOutputFiles: inputs.writeOutputFiles,
outputDir: inputs.outputDir,
json: inputs.json
})
await setOutput({
key: getOutputKey('other_modified_files', outputPrefix),
value: otherModifiedFiles.join(inputs.separator),
inputs
await setArrayOutput({
key: 'other_modified_files',
inputs,
value: otherModifiedFiles,
outputPrefix
})
await setOutput({
key: getOutputKey('other_modified_files_count', outputPrefix),
value: otherModifiedFiles.length.toString(),
inputs
writeOutputFiles: inputs.writeOutputFiles,
outputDir: inputs.outputDir
})
const deletedFiles = await getChangeTypeFiles({
@@ -323,19 +391,25 @@ export const setChangedFilesOutput = async ({
await setOutput({
key: getOutputKey('deleted_files', outputPrefix),
value: deletedFiles.paths,
inputs
writeOutputFiles: inputs.writeOutputFiles,
outputDir: inputs.outputDir,
json: inputs.json,
shouldEscape: inputs.escapeJson
})
await setOutput({
key: getOutputKey('deleted_files_count', outputPrefix),
value: deletedFiles.count,
inputs
writeOutputFiles: inputs.writeOutputFiles,
outputDir: inputs.outputDir
})
await setOutput({
key: getOutputKey('any_deleted', outputPrefix),
value: deletedFiles.paths.length > 0 && filePatterns.length > 0,
inputs
writeOutputFiles: inputs.writeOutputFiles,
outputDir: inputs.outputDir,
json: inputs.json
})
const allOtherDeletedFiles = await getChangeTypeFiles({
@@ -344,11 +418,19 @@ export const setChangedFilesOutput = async ({
changeTypes: [ChangeTypeEnum.Deleted]
})
const otherDeletedFiles = allOtherDeletedFiles.paths
.split(inputs.separator)
.filter(
filePath => !deletedFiles.paths.split(inputs.separator).includes(filePath)
)
const allOtherDeletedFilesPaths: string[] = getArrayFromPaths(
allOtherDeletedFiles.paths,
inputs
)
const deletedFilesPaths: string[] = getArrayFromPaths(
deletedFiles.paths,
inputs
)
const otherDeletedFiles = allOtherDeletedFilesPaths.filter(
filePath => !deletedFilesPaths.includes(filePath)
)
const onlyDeleted =
otherDeletedFiles.length === 0 &&
@@ -358,18 +440,27 @@ export const setChangedFilesOutput = async ({
await setOutput({
key: getOutputKey('only_deleted', outputPrefix),
value: onlyDeleted,
inputs
writeOutputFiles: inputs.writeOutputFiles,
outputDir: inputs.outputDir,
json: inputs.json
})
await setOutput({
key: getOutputKey('other_deleted_files', outputPrefix),
value: otherDeletedFiles.join(inputs.separator),
inputs
await setArrayOutput({
key: 'other_deleted_files',
inputs,
value: otherDeletedFiles,
outputPrefix
})
await setOutput({
key: getOutputKey('other_deleted_files_count', outputPrefix),
value: otherDeletedFiles.length.toString(),
inputs
writeOutputFiles: inputs.writeOutputFiles,
outputDir: inputs.outputDir
})
return {
anyModified: allModifiedFiles.paths.length > 0 && filePatterns.length > 0,
anyChanged: allChangedFiles.paths.length > 0 && filePatterns.length > 0
}
}

View File

@@ -419,31 +419,63 @@ export const getSHAForPullRequestEvent = async (
if (
!previousSha ||
(previousSha &&
(await verifyCommitSha({sha: previousSha, cwd: workingDirectory})) !==
0)
(await verifyCommitSha({
sha: previousSha,
cwd: workingDirectory,
showAsErrorMessage: false
})) !== 0)
) {
core.warning(
'Unable to locate the remote branch head sha. Falling back to the previous commit in the local history.'
core.info(
`Unable to locate the previous commit in the local history for ${github.context.eventName} (${github.context.payload.action}) event. Falling back to the previous commit in the local history.`
)
previousSha = await getParentSha({
cwd: workingDirectory
})
if (!previousSha) {
core.warning(
'Unable to locate the previous commit in the local history. Falling back to the pull request base sha.'
if (
github.context.payload.action &&
github.context.payload.action === 'synchronize' &&
previousSha &&
(!previousSha ||
(previousSha &&
(await verifyCommitSha({
sha: previousSha,
cwd: workingDirectory,
showAsErrorMessage: false
})) !== 0))
) {
throw new Error(
'Unable to locate the previous commit in the local history. Please ensure to checkout pull request HEAD commit instead of the merge commit. See: https://github.com/actions/checkout/blob/main/README.md#checkout-pull-request-head-commit-instead-of-merge-commit'
)
}
if (
!previousSha ||
(previousSha &&
(await verifyCommitSha({
sha: previousSha,
cwd: workingDirectory,
showAsErrorMessage: false
})) !== 0)
) {
throw new Error(
'Unable to locate the previous commit in the local history. Please ensure to checkout pull request HEAD commit instead of the merge commit. See: https://github.com/actions/checkout/blob/main/README.md#checkout-pull-request-head-commit-instead-of-merge-commit'
)
previousSha = github.context.payload.pull_request?.base?.sha
}
}
} else {
previousSha = await getRemoteBranchHeadSha({
cwd: workingDirectory,
branch: targetBranch
})
if (!previousSha) {
if (github.context.payload.action === 'closed') {
previousSha = github.context.payload.pull_request?.base?.sha
} else {
previousSha = await getRemoteBranchHeadSha({
cwd: workingDirectory,
branch: targetBranch
})
if (!previousSha) {
previousSha = github.context.payload.pull_request?.base?.sha
}
}
if (isShallow) {

View File

@@ -48,6 +48,8 @@ export type Inputs = {
token: string
apiUrl: string
skipInitialFetch: boolean
failOnInitialDiffError: boolean
failOnSubmoduleDiffError: boolean
}
export const getInputs = (): Inputs => {
@@ -196,6 +198,18 @@ export const getInputs = (): Inputs => {
required: false
}
)
const failOnInitialDiffError = core.getBooleanInput(
'fail_on_initial_diff_error',
{
required: false
}
)
const failOnSubmoduleDiffError = core.getBooleanInput(
'fail_on_submodule_diff_error',
{
required: false
}
)
const inputs: Inputs = {
files,
@@ -212,6 +226,8 @@ export const getInputs = (): Inputs => {
filesIgnoreYaml,
filesIgnoreYamlFromSourceFile,
filesIgnoreYamlFromSourceFileSeparator,
failOnInitialDiffError,
failOnSubmoduleDiffError,
separator,
// Not Supported via REST API
sha,

View File

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

View File

@@ -9,7 +9,6 @@ import * as path from 'path'
import {createInterface} from 'readline'
import {parseDocument} from 'yaml'
import {ChangedFiles, ChangeTypeEnum} from './changedFiles'
import {Inputs} from './inputs'
const MINIMUM_GIT_VERSION = '2.18.0'
@@ -490,6 +489,8 @@ export const gitRenamedFiles = async ({
* @param isSubmodule - is the repo a submodule
* @param parentDir - parent directory of the submodule
* @param outputRenamedFilesAsDeletedAndAdded - output renamed files as deleted and added
* @param failOnInitialDiffError - fail if the initial diff fails
* @param failOnSubmoduleDiffError - fail if the submodule diff fails
*/
export const getAllChangedFiles = async ({
cwd,
@@ -498,7 +499,9 @@ export const getAllChangedFiles = async ({
diff,
isSubmodule = false,
parentDir = '',
outputRenamedFilesAsDeletedAndAdded = false
outputRenamedFilesAsDeletedAndAdded = false,
failOnInitialDiffError = false,
failOnSubmoduleDiffError = false
}: {
cwd: string
sha1: string
@@ -507,6 +510,8 @@ export const getAllChangedFiles = async ({
isSubmodule?: boolean
parentDir?: string
outputRenamedFilesAsDeletedAndAdded?: boolean
failOnInitialDiffError?: boolean
failOnSubmoduleDiffError?: boolean
}): Promise<ChangedFiles> => {
const {exitCode, stdout, stderr} = await exec.getExecOutput(
'git',
@@ -534,6 +539,18 @@ export const getAllChangedFiles = async ({
[ChangeTypeEnum.Unknown]: []
}
if (exitCode !== 0) {
if (failOnInitialDiffError && !isSubmodule) {
throw new Error(
`Failed to get changed files between: ${sha1}${diff}${sha2}: ${stderr}`
)
} else if (failOnSubmoduleDiffError && isSubmodule) {
throw new Error(
`Failed to get changed files for submodule between: ${sha1}${diff}${sha2}: ${stderr}`
)
}
}
if (exitCode !== 0) {
if (isSubmodule) {
core.warning(
@@ -874,7 +891,7 @@ export const jsonOutput = ({
value,
shouldEscape
}: {
value: string | string[]
value: string | string[] | boolean
shouldEscape: boolean
}): string => {
const result = JSON.stringify(value)
@@ -979,7 +996,7 @@ export const getFilePatterns = async ({
} else {
const pathParts = pattern.split('/')
const lastPart = pathParts[pathParts.length - 1]
if (!lastPart.includes('.') && !lastPart.includes('*')) {
if (!lastPart.includes('.')) {
return `${pattern}/**`
} else {
return pattern
@@ -1205,21 +1222,58 @@ export const getRecoverFilePatterns = ({
return filePatterns.filter(Boolean)
}
export const getOutputKey = (key: string, outputPrefix: string): string => {
return outputPrefix ? `${outputPrefix}_${key}` : key
}
export const setArrayOutput = async ({
key,
inputs,
value,
outputPrefix
}: {
key: string
inputs: Inputs
value: string[]
outputPrefix?: string
}): Promise<void> => {
core.debug(`${key}: ${JSON.stringify(value)}`)
await setOutput({
key: outputPrefix ? getOutputKey(key, outputPrefix) : key,
value: inputs.json ? value : value.join(inputs.separator),
writeOutputFiles: inputs.writeOutputFiles,
outputDir: inputs.outputDir,
json: inputs.json,
shouldEscape: inputs.escapeJson
})
}
export const setOutput = async ({
key,
value,
inputs
writeOutputFiles,
outputDir,
json = false,
shouldEscape = false
}: {
key: string
value: string | boolean
inputs: Inputs
value: string | string[] | boolean
writeOutputFiles: boolean
outputDir: string
json?: boolean
shouldEscape?: boolean
}): Promise<void> => {
const cleanedValue = value.toString().trim()
let cleanedValue
if (json) {
cleanedValue = jsonOutput({value, shouldEscape})
} else {
cleanedValue = value.toString().trim()
}
core.setOutput(key, cleanedValue)
if (inputs.writeOutputFiles) {
const outputDir = inputs.outputDir
const extension = inputs.json ? 'json' : 'txt'
if (writeOutputFiles) {
const extension = json ? 'json' : 'txt'
const outputFilePath = path.join(outputDir, `${key}.${extension}`)
if (!(await exists(outputDir))) {

1392
yarn.lock

File diff suppressed because it is too large Load Diff