Compare commits
242 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
aa08304bd4 | ||
|
|
008ba8ceec | ||
|
|
fe6c3ea0ca | ||
|
|
7fc073d922 | ||
|
|
7e4bfc2f1f | ||
|
|
ef3a7f51d6 | ||
|
|
a65c2f2100 | ||
|
|
ea042d8095 | ||
|
|
8293f8c984 | ||
|
|
0ff732eeb3 | ||
|
|
8df6fc260f | ||
|
|
d516645658 | ||
|
|
2c97e7ea24 | ||
|
|
1c8e606958 | ||
|
|
74605cb326 | ||
|
|
aa15b58e8a | ||
|
|
0a392e7438 | ||
|
|
85efc7df8e | ||
|
|
2a095d24c2 | ||
|
|
ac3dc5e392 | ||
|
|
dd7e9d3b17 | ||
|
|
0647a31f54 | ||
|
|
9d67dd3dbe | ||
|
|
5acd7e3646 | ||
|
|
9f4af73d05 | ||
|
|
800a282599 | ||
|
|
31c4d150e6 | ||
|
|
2a2a5b6b9c | ||
|
|
d8dcc13244 | ||
|
|
639ce0e105 | ||
|
|
9d447b9959 | ||
|
|
83bfc72efa | ||
|
|
879c8388c8 | ||
|
|
bb7502bd15 | ||
|
|
5c5539ced9 | ||
|
|
c2039de114 | ||
|
|
0cbc9bc448 | ||
|
|
9ef20a69dd | ||
|
|
a617853c0f | ||
|
|
5c1bceb76c | ||
|
|
3f54ebb830 | ||
|
|
6f070cff38 | ||
|
|
ec75ae5ab7 | ||
|
|
4333ab5b20 | ||
|
|
e3cac49049 | ||
|
|
68bd4537bd | ||
|
|
f0ce41b71c | ||
|
|
ce451bf430 | ||
|
|
7592e9e855 | ||
|
|
999653c672 | ||
|
|
6cf4c21fdf | ||
|
|
09ee51bee3 | ||
|
|
8eced8a5df | ||
|
|
13fa1402a7 | ||
|
|
07ac0ac168 | ||
|
|
049d7fd639 | ||
|
|
2e90fbb74b | ||
|
|
2a9db54a6d | ||
|
|
d0d5671ef7 | ||
|
|
97120ff1f5 | ||
|
|
b2d4e1b488 | ||
|
|
9299962a59 | ||
|
|
ea35f7ea00 | ||
|
|
3399f8837f | ||
|
|
ac897da4f1 | ||
|
|
8e56bc097a | ||
|
|
f6d3fe5179 | ||
|
|
efa99ea361 | ||
|
|
6d8f9bd379 | ||
|
|
589fb70c81 | ||
|
|
7daee9e7cf | ||
|
|
99c80bdd47 | ||
|
|
5e7cbf5fdb | ||
|
|
b4d6d28988 | ||
|
|
8370e6e6ef | ||
|
|
aa31060851 | ||
|
|
54c56103aa | ||
|
|
e57fb1b8eb | ||
|
|
926735a61e | ||
|
|
d3ac2a064b | ||
|
|
91df40b882 | ||
|
|
28396e9658 | ||
|
|
3a66e2a7e4 | ||
|
|
35f3202fd5 | ||
|
|
2b30af482a | ||
|
|
a93bcf46e0 | ||
|
|
6d4c555c7d | ||
|
|
507a8c703d | ||
|
|
3a7052c24a | ||
|
|
782eb123a9 | ||
|
|
9134dac8f6 | ||
|
|
df12603b45 | ||
|
|
bb9b5e8363 | ||
|
|
31b9c0a541 | ||
|
|
ba0a561b13 | ||
|
|
8d35cbb00f | ||
|
|
82dd6547dc | ||
|
|
6d42539842 | ||
|
|
08dedfb681 | ||
|
|
f6d9fa10e0 | ||
|
|
9eb0d763ae | ||
|
|
51d2f88f07 | ||
|
|
90a06d6ba9 | ||
|
|
2cb2c9234e | ||
|
|
ac21d93904 | ||
|
|
a4637ea6e7 | ||
|
|
fd9998cf5f | ||
|
|
ea024b2d7f | ||
|
|
db4e584844 | ||
|
|
c6543c497a | ||
|
|
88f9f3efbb | ||
|
|
3af07c2040 | ||
|
|
3680129aa2 | ||
|
|
5d866cbe77 | ||
|
|
346f237a17 | ||
|
|
c037f1e7c5 | ||
|
|
ae82ed4ae0 | ||
|
|
cbd59070e8 | ||
|
|
6c9dcea443 | ||
|
|
79b060d445 | ||
|
|
434b67ebc3 | ||
|
|
cbda684547 | ||
|
|
3f8189989b | ||
|
|
67a1f54f6f | ||
|
|
99248a4438 | ||
|
|
878743189b | ||
|
|
98d1d84e2f | ||
|
|
a60bf3759e | ||
|
|
bc46e4c422 | ||
|
|
fba4067348 | ||
|
|
e4b8674732 | ||
|
|
bc2b5aef20 | ||
|
|
63c36a563a | ||
|
|
44b77505fe | ||
|
|
62f4729b5d | ||
|
|
e0579abf95 | ||
|
|
8e0194b29b | ||
|
|
3649d2842d | ||
|
|
0ca1c07b47 | ||
|
|
a57f4dcc81 | ||
|
|
9c39b0b6e9 | ||
|
|
8b141f3906 | ||
|
|
17e07d8bc0 | ||
|
|
13fa1c06fc | ||
|
|
0deb29d192 | ||
|
|
28267ee8b7 | ||
|
|
094d3441f8 | ||
|
|
aeec36b035 | ||
|
|
2d0270c489 | ||
|
|
0e0adfa0d3 | ||
|
|
5313e6bbe3 | ||
|
|
54789be3a1 | ||
|
|
1675238cfd | ||
|
|
3fbf5fb588 | ||
|
|
95230678db | ||
|
|
fdccafbb6e | ||
|
|
0e8d796ee0 | ||
|
|
0c6f2ac488 | ||
|
|
1db97adba4 | ||
|
|
fb8f6db383 | ||
|
|
efd7ecef11 | ||
|
|
4f8e12c098 | ||
|
|
032add13e8 | ||
|
|
0f0747e79d | ||
|
|
0c2a758b81 | ||
|
|
1b6d7b6fb6 | ||
|
|
716b1e1304 | ||
|
|
7aaf10d9ee | ||
|
|
cc08e170f4 | ||
|
|
6e79d6e3db | ||
|
|
d13ac1942f | ||
|
|
bb89f97963 | ||
|
|
1864078d0a | ||
|
|
f495a0321d | ||
|
|
47371c50e9 | ||
|
|
4f573fed06 | ||
|
|
ff2f6e6b91 | ||
|
|
0102c07446 | ||
|
|
089842a7a8 | ||
|
|
787db0612e | ||
|
|
4ef6b56482 | ||
|
|
f9480db177 | ||
|
|
c9ae347dbb | ||
|
|
56284d8081 | ||
|
|
35ad6787f5 | ||
|
|
ca0db0ea03 | ||
|
|
03fcd0b3bb | ||
|
|
35da2a2e01 | ||
|
|
2329d9fb48 | ||
|
|
154ca89d2e | ||
|
|
449352f10e | ||
|
|
7c1826332f | ||
|
|
af2816c654 | ||
|
|
88be287f56 | ||
|
|
5513a5e205 | ||
|
|
e7023fa1da | ||
|
|
46550b6fd9 | ||
|
|
9454999946 | ||
|
|
7611ff348d | ||
|
|
187cf1e88c | ||
|
|
e1e532cff0 | ||
|
|
dfecec4fb7 | ||
|
|
c116f52a15 | ||
|
|
0b0b6429e1 | ||
|
|
f732c371a4 | ||
|
|
04c00459a2 | ||
|
|
5cee511ba5 | ||
|
|
399525a994 | ||
|
|
c075bd2719 | ||
|
|
208b83f295 | ||
|
|
ccb109a584 | ||
|
|
2918913341 | ||
|
|
a66176714d | ||
|
|
95642a1ebb | ||
|
|
726e06f8ef | ||
|
|
d96fe5d997 | ||
|
|
4ae611e5c5 | ||
|
|
1c938490c8 | ||
|
|
ba558db977 | ||
|
|
bf19fa23a6 | ||
|
|
66b77cbd0c | ||
|
|
10bfa980b7 | ||
|
|
9e46b4f7f7 | ||
|
|
3bf6172534 | ||
|
|
45581f0044 | ||
|
|
9ebb48b57a | ||
|
|
4e2dca3ba5 | ||
|
|
af6bdde59a | ||
|
|
fc1fb2b582 | ||
|
|
883b4ccbdb | ||
|
|
f91c9fe8b1 | ||
|
|
3ca6b80013 | ||
|
|
ee5ef758aa | ||
|
|
42fe158594 | ||
|
|
48427afe26 | ||
|
|
5c74583cb3 | ||
|
|
742ed362b6 | ||
|
|
44d340e48c | ||
|
|
2561448da0 | ||
|
|
86cabf5ea2 | ||
|
|
b5fc67a4f5 | ||
|
|
0b22a52bff |
@@ -197,6 +197,54 @@
|
||||
"bug",
|
||||
"code"
|
||||
]
|
||||
},
|
||||
{
|
||||
"login": "rodrigorfk",
|
||||
"name": "Rodrigo Fior Kuntzer",
|
||||
"avatar_url": "https://avatars.githubusercontent.com/u/1995033?v=4",
|
||||
"profile": "https://github.com/rodrigorfk",
|
||||
"contributions": [
|
||||
"code",
|
||||
"test",
|
||||
"bug"
|
||||
]
|
||||
},
|
||||
{
|
||||
"login": "levenleven",
|
||||
"name": "Aleksey Levenstein",
|
||||
"avatar_url": "https://avatars.githubusercontent.com/u/6463364?v=4",
|
||||
"profile": "https://github.com/levenleven",
|
||||
"contributions": [
|
||||
"doc"
|
||||
]
|
||||
},
|
||||
{
|
||||
"login": "dan-hill2802",
|
||||
"name": "Daniel Hill",
|
||||
"avatar_url": "https://avatars.githubusercontent.com/u/5046322?v=4",
|
||||
"profile": "https://github.com/dan-hill2802",
|
||||
"contributions": [
|
||||
"doc"
|
||||
]
|
||||
},
|
||||
{
|
||||
"login": "KeisukeYamashita",
|
||||
"name": "KeisukeYamashita",
|
||||
"avatar_url": "https://avatars.githubusercontent.com/u/23056537?v=4",
|
||||
"profile": "https://keisukeyamashita.com",
|
||||
"contributions": [
|
||||
"doc"
|
||||
]
|
||||
},
|
||||
{
|
||||
"login": "codesculpture",
|
||||
"name": "Aravind",
|
||||
"avatar_url": "https://avatars.githubusercontent.com/u/63452117?v=4",
|
||||
"profile": "https://github.com/codesculpture",
|
||||
"contributions": [
|
||||
"code",
|
||||
"bug"
|
||||
]
|
||||
}
|
||||
],
|
||||
"contributorsPerLine": 7,
|
||||
|
||||
33
.github/workflows/auto-approve.yml
vendored
33
.github/workflows/auto-approve.yml
vendored
@@ -1,33 +0,0 @@
|
||||
name: Auto approve
|
||||
|
||||
on:
|
||||
pull_request_target
|
||||
|
||||
|
||||
jobs:
|
||||
auto-approve:
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- uses: hmarr/auto-approve-action@v3
|
||||
if: |
|
||||
(
|
||||
github.event.pull_request.user.login == 'dependabot[bot]' ||
|
||||
github.event.pull_request.user.login == 'dependabot' ||
|
||||
github.event.pull_request.user.login == 'dependabot-preview[bot]' ||
|
||||
github.event.pull_request.user.login == 'dependabot-preview' ||
|
||||
github.event.pull_request.user.login == 'renovate[bot]' ||
|
||||
github.event.pull_request.user.login == 'renovate' ||
|
||||
github.event.pull_request.user.login == 'github-actions[bot]'
|
||||
)
|
||||
&&
|
||||
(
|
||||
github.actor == 'dependabot[bot]' ||
|
||||
github.actor == 'dependabot' ||
|
||||
github.actor == 'dependabot-preview[bot]' ||
|
||||
github.actor == 'dependabot-preview' ||
|
||||
github.actor == 'renovate[bot]' ||
|
||||
github.actor == 'renovate' ||
|
||||
github.actor == 'github-actions[bot]'
|
||||
)
|
||||
with:
|
||||
github-token: ${{ secrets.PAT_TOKEN }}
|
||||
14
.github/workflows/codacy-analysis.yml
vendored
14
.github/workflows/codacy-analysis.yml
vendored
@@ -17,13 +17,13 @@ on:
|
||||
schedule:
|
||||
- cron: '15 16 * * 2'
|
||||
|
||||
permissions:
|
||||
actions: read
|
||||
contents: read
|
||||
security-events: write
|
||||
|
||||
jobs:
|
||||
codacy-security-scan:
|
||||
# Cancel other workflows that are running for the same branch
|
||||
# https://docs.github.com/en/actions/reference/workflow-syntax-for-github-actions#concurrency
|
||||
concurrency:
|
||||
group: ${{ github.workflow }}-${{ github.ref }}
|
||||
cancel-in-progress: true
|
||||
name: Codacy Security Scan
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
@@ -34,7 +34,7 @@ jobs:
|
||||
# Execute Codacy Analysis CLI and generate a SARIF output with the security issues identified during the analysis
|
||||
- name: Run Codacy Analysis CLI
|
||||
continue-on-error: true
|
||||
uses: codacy/codacy-analysis-cli-action@v4.3.0
|
||||
uses: codacy/codacy-analysis-cli-action@v4.4.0
|
||||
with:
|
||||
# Check https://github.com/codacy/codacy-analysis-cli#project-token to get your project token from your Codacy repository
|
||||
# You can also omit the token and run the tools that support default configurations
|
||||
@@ -51,6 +51,6 @@ jobs:
|
||||
# Upload the SARIF file generated in the previous step
|
||||
- name: Upload SARIF results file
|
||||
continue-on-error: true
|
||||
uses: github/codeql-action/upload-sarif@v2
|
||||
uses: github/codeql-action/upload-sarif@v3
|
||||
with:
|
||||
sarif_file: results.sarif
|
||||
|
||||
11
.github/workflows/codeql.yml
vendored
11
.github/workflows/codeql.yml
vendored
@@ -20,6 +20,11 @@ on:
|
||||
schedule:
|
||||
- cron: '44 20 * * 0'
|
||||
|
||||
permissions:
|
||||
actions: read
|
||||
contents: read
|
||||
security-events: write
|
||||
|
||||
jobs:
|
||||
analyze:
|
||||
name: Analyze
|
||||
@@ -42,7 +47,7 @@ jobs:
|
||||
|
||||
# Initializes the CodeQL tools for scanning.
|
||||
- name: Initialize CodeQL
|
||||
uses: github/codeql-action/init@v2
|
||||
uses: github/codeql-action/init@v3
|
||||
with:
|
||||
languages: ${{ matrix.language }}
|
||||
# If you wish to specify custom queries, you can do so here or in a config file.
|
||||
@@ -56,7 +61,7 @@ jobs:
|
||||
# Autobuild attempts to build any compiled languages (C/C++, C#, or Java).
|
||||
# If this step fails, then you should remove it and run the build manually (see below)
|
||||
- name: Autobuild
|
||||
uses: github/codeql-action/autobuild@v2
|
||||
uses: github/codeql-action/autobuild@v3
|
||||
|
||||
# ℹ️ Command-line programs to run using the OS shell.
|
||||
# 📚 See https://docs.github.com/en/actions/using-workflows/workflow-syntax-for-github-actions#jobsjob_idstepsrun
|
||||
@@ -69,6 +74,6 @@ jobs:
|
||||
# ./location_of_script_within_repo/buildscript.sh
|
||||
|
||||
- name: Perform CodeQL Analysis
|
||||
uses: github/codeql-action/analyze@v2
|
||||
uses: github/codeql-action/analyze@v3
|
||||
with:
|
||||
category: "/language:${{matrix.language}}"
|
||||
|
||||
6
.github/workflows/greetings.yml
vendored
6
.github/workflows/greetings.yml
vendored
@@ -2,6 +2,10 @@ name: Greetings
|
||||
|
||||
on: [pull_request_target, issues]
|
||||
|
||||
permissions:
|
||||
pull-requests: write
|
||||
issues: write
|
||||
|
||||
jobs:
|
||||
greeting:
|
||||
runs-on: ubuntu-latest
|
||||
@@ -9,6 +13,6 @@ jobs:
|
||||
- uses: actions/first-interaction@v1
|
||||
continue-on-error: true
|
||||
with:
|
||||
repo-token: ${{ secrets.GITHUB_TOKEN }}
|
||||
repo-token: ${{ secrets.PAT_TOKEN }}
|
||||
issue-message: "Thanks for reporting this issue, don't forget to star this project if you haven't already to help us reach a wider audience."
|
||||
pr-message: "Thanks for implementing a fix, could you ensure that the test covers your changes if applicable."
|
||||
|
||||
@@ -1,4 +1,8 @@
|
||||
name: Issue Comment Test
|
||||
name: Issue Comment Job Example
|
||||
|
||||
permissions:
|
||||
contents: read
|
||||
|
||||
on:
|
||||
issue_comment:
|
||||
|
||||
@@ -1,9 +1,11 @@
|
||||
name: Manual Test
|
||||
name: Manual Triggered Job Example
|
||||
|
||||
permissions:
|
||||
contents: read
|
||||
|
||||
on:
|
||||
workflow_dispatch:
|
||||
|
||||
|
||||
jobs:
|
||||
test:
|
||||
name: Test changed-files
|
||||
@@ -1,4 +1,7 @@
|
||||
name: Matrix Test
|
||||
name: Matrix Example
|
||||
|
||||
permissions:
|
||||
contents: read
|
||||
|
||||
on:
|
||||
workflow_dispatch:
|
||||
@@ -21,9 +24,7 @@ jobs:
|
||||
id: changed-files
|
||||
uses: ./
|
||||
with:
|
||||
json: true
|
||||
quotepath: false
|
||||
escape_json: false
|
||||
matrix: true
|
||||
- name: List all changed files
|
||||
run: echo '${{ steps.changed-files.outputs.all_changed_files }}'
|
||||
|
||||
67
.github/workflows/multi-job-example.yml
vendored
Normal file
67
.github/workflows/multi-job-example.yml
vendored
Normal file
@@ -0,0 +1,67 @@
|
||||
name: Multi Job Example
|
||||
|
||||
permissions:
|
||||
contents: read
|
||||
|
||||
on:
|
||||
push:
|
||||
branches:
|
||||
- "**"
|
||||
pull_request:
|
||||
branches:
|
||||
- "**"
|
||||
|
||||
jobs:
|
||||
changed-files:
|
||||
name: Get changed files
|
||||
runs-on: ubuntu-latest
|
||||
outputs:
|
||||
all_changed_files: ${{ steps.changed-files.outputs.all_changed_files }}
|
||||
steps:
|
||||
- name: Checkout
|
||||
uses: actions/checkout@v4
|
||||
with:
|
||||
fetch-depth: 0
|
||||
- name: Get changed files
|
||||
id: changed-files
|
||||
uses: ./
|
||||
- name: List all changed files
|
||||
run: echo '${{ steps.changed-files.outputs.all_changed_files }}'
|
||||
|
||||
view-changed-files:
|
||||
name: View all changed files
|
||||
runs-on: ubuntu-latest
|
||||
needs: [changed-files]
|
||||
steps:
|
||||
- name: List all changed files
|
||||
run: |
|
||||
echo '${{ needs.changed-files.outputs.all_changed_files }}'
|
||||
|
||||
|
||||
changed-files-rest-api:
|
||||
name: Get changed files using REST API
|
||||
runs-on: ubuntu-latest
|
||||
outputs:
|
||||
all_changed_files: ${{ steps.changed-files.outputs.all_changed_files }}
|
||||
steps:
|
||||
- name: Checkout
|
||||
uses: actions/checkout@v4
|
||||
with:
|
||||
fetch-depth: 0
|
||||
- name: Get changed files
|
||||
id: changed-files
|
||||
continue-on-error: ${{ github.event_name == 'push' }}
|
||||
uses: ./
|
||||
with:
|
||||
use_rest_api: true
|
||||
- name: List all changed files
|
||||
run: echo '${{ steps.changed-files.outputs.all_changed_files }}'
|
||||
|
||||
view-changed-files-rest-api:
|
||||
name: View all changed files using REST API
|
||||
runs-on: ubuntu-latest
|
||||
needs: [changed-files-rest-api]
|
||||
steps:
|
||||
- name: List all changed files
|
||||
run: |
|
||||
echo '${{ needs.changed-files-rest-api.outputs.all_changed_files }}'
|
||||
9
.github/workflows/sync-release-version.yml
vendored
9
.github/workflows/sync-release-version.yml
vendored
@@ -1,4 +1,9 @@
|
||||
name: Update release version.
|
||||
name: Update release version
|
||||
|
||||
permissions:
|
||||
contents: write
|
||||
pull-requests: write
|
||||
|
||||
on:
|
||||
release:
|
||||
types: [published]
|
||||
@@ -32,7 +37,7 @@ jobs:
|
||||
- name: Run git-cliff
|
||||
uses: tj-actions/git-cliff@v1
|
||||
- name: Create Pull Request
|
||||
uses: peter-evans/create-pull-request@v5.0.2
|
||||
uses: peter-evans/create-pull-request@v6.0.1
|
||||
with:
|
||||
base: "main"
|
||||
labels: "merge when passing"
|
||||
|
||||
224
.github/workflows/test.yml
vendored
224
.github/workflows/test.yml
vendored
@@ -1,12 +1,12 @@
|
||||
name: CI
|
||||
|
||||
permissions:
|
||||
contents: read
|
||||
|
||||
on:
|
||||
push:
|
||||
branches:
|
||||
- "**"
|
||||
pull_request_review:
|
||||
types: [edited, dismissed, submitted]
|
||||
pull_request_target:
|
||||
pull_request:
|
||||
types:
|
||||
- assigned
|
||||
@@ -27,24 +27,16 @@ on:
|
||||
- auto_merge_enabled
|
||||
- auto_merge_disabled
|
||||
branches:
|
||||
- main
|
||||
|
||||
- "**"
|
||||
|
||||
jobs:
|
||||
shellcheck:
|
||||
name: Run shellcheck
|
||||
runs-on: ubuntu-latest
|
||||
|
||||
steps:
|
||||
- name: Checkout branch
|
||||
uses: actions/checkout@v4
|
||||
- name: shellcheck
|
||||
uses: reviewdog/action-shellcheck@v1.19
|
||||
|
||||
build:
|
||||
runs-on: ubuntu-latest
|
||||
outputs:
|
||||
files_changed: ${{ steps.changed_files.outputs.files_changed }}
|
||||
permissions:
|
||||
contents: read
|
||||
pull-requests: write
|
||||
steps:
|
||||
- uses: actions/checkout@v4
|
||||
with:
|
||||
@@ -53,7 +45,7 @@ jobs:
|
||||
repository: ${{ github.event.pull_request.head.repo.full_name }}
|
||||
|
||||
- name: Use Node.js 20.x
|
||||
uses: actions/setup-node@v4.0.0
|
||||
uses: actions/setup-node@v4.0.2
|
||||
with:
|
||||
cache: 'yarn'
|
||||
node-version: '20.x'
|
||||
@@ -68,7 +60,7 @@ jobs:
|
||||
yarn install
|
||||
|
||||
- name: Run eslint on changed files
|
||||
uses: tj-actions/eslint-changed-files@v21
|
||||
uses: tj-actions/eslint-changed-files@v23
|
||||
if: github.event_name == 'pull_request'
|
||||
with:
|
||||
token: ${{ secrets.PAT_TOKEN }}
|
||||
@@ -80,7 +72,7 @@ jobs:
|
||||
yarn all
|
||||
|
||||
- name: Verify Changed files
|
||||
uses: tj-actions/verify-changed-files@v16
|
||||
uses: tj-actions/verify-changed-files@v19
|
||||
id: changed_files
|
||||
with:
|
||||
files: |
|
||||
@@ -104,7 +96,7 @@ jobs:
|
||||
branch: ${{ github.head_ref }}
|
||||
|
||||
- name: Upload build assets
|
||||
uses: actions/upload-artifact@v3
|
||||
uses: actions/upload-artifact@v4
|
||||
with:
|
||||
name: build-assets
|
||||
path: dist
|
||||
@@ -121,6 +113,8 @@ jobs:
|
||||
runs-on: ubuntu-latest
|
||||
needs: build
|
||||
if: needs.build.outputs.files_changed != 'true'
|
||||
permissions:
|
||||
contents: read
|
||||
steps:
|
||||
- name: Checkout into dir1
|
||||
uses: actions/checkout@v4
|
||||
@@ -131,7 +125,7 @@ jobs:
|
||||
path: dir1
|
||||
|
||||
- name: Download build assets
|
||||
uses: actions/download-artifact@v3
|
||||
uses: actions/download-artifact@v4
|
||||
with:
|
||||
name: build-assets
|
||||
path: dir1/dist
|
||||
@@ -157,7 +151,7 @@ jobs:
|
||||
bash
|
||||
|
||||
- name: Download build assets
|
||||
uses: actions/download-artifact@v3
|
||||
uses: actions/download-artifact@v4
|
||||
with:
|
||||
name: build-assets
|
||||
path: dir2/dist
|
||||
@@ -195,7 +189,8 @@ jobs:
|
||||
needs: build
|
||||
runs-on: ubuntu-latest
|
||||
if: github.event_name == 'push' && needs.build.outputs.files_changed != 'true'
|
||||
|
||||
permissions:
|
||||
contents: read
|
||||
steps:
|
||||
- name: Checkout branch
|
||||
uses: actions/checkout@v4
|
||||
@@ -204,7 +199,7 @@ jobs:
|
||||
fetch-depth: 0
|
||||
|
||||
- name: Download build assets
|
||||
uses: actions/download-artifact@v3
|
||||
uses: actions/download-artifact@v4
|
||||
with:
|
||||
name: build-assets
|
||||
|
||||
@@ -253,6 +248,8 @@ jobs:
|
||||
runs-on: ubuntu-latest
|
||||
needs: build
|
||||
if: needs.build.outputs.files_changed != 'true'
|
||||
permissions:
|
||||
contents: read
|
||||
|
||||
steps:
|
||||
- name: Checkout branch
|
||||
@@ -262,7 +259,7 @@ jobs:
|
||||
fetch-depth: 0
|
||||
|
||||
- name: Download build assets
|
||||
uses: actions/download-artifact@v3
|
||||
uses: actions/download-artifact@v4
|
||||
with:
|
||||
name: build-assets
|
||||
|
||||
@@ -295,6 +292,8 @@ jobs:
|
||||
github.event_name == 'push' ||
|
||||
github.event_name == 'pull_request'
|
||||
) && needs.build.outputs.files_changed != 'true'
|
||||
permissions:
|
||||
contents: read
|
||||
|
||||
steps:
|
||||
- name: Checkout branch
|
||||
@@ -304,7 +303,7 @@ jobs:
|
||||
fetch-depth: 0
|
||||
|
||||
- name: Download build assets
|
||||
uses: actions/download-artifact@v3
|
||||
uses: actions/download-artifact@v4
|
||||
with:
|
||||
name: build-assets
|
||||
|
||||
@@ -325,6 +324,8 @@ jobs:
|
||||
runs-on: ubuntu-latest
|
||||
needs: build
|
||||
if: needs.build.outputs.files_changed != 'true'
|
||||
permissions:
|
||||
contents: read
|
||||
|
||||
strategy:
|
||||
fail-fast: false
|
||||
@@ -341,7 +342,7 @@ jobs:
|
||||
fetch-depth: ${{ matrix.fetch-depth }}
|
||||
|
||||
- name: Download build assets
|
||||
uses: actions/download-artifact@v3
|
||||
uses: actions/download-artifact@v4
|
||||
with:
|
||||
name: build-assets
|
||||
|
||||
@@ -364,6 +365,8 @@ jobs:
|
||||
runs-on: ubuntu-latest
|
||||
needs: build
|
||||
if: github.event_name != 'push' && needs.build.outputs.files_changed != 'true'
|
||||
permissions:
|
||||
contents: read
|
||||
|
||||
steps:
|
||||
- name: Checkout branch
|
||||
@@ -372,7 +375,7 @@ jobs:
|
||||
ref: ${{ github.event.pull_request.head.sha }}
|
||||
|
||||
- name: Download build assets
|
||||
uses: actions/download-artifact@v3
|
||||
uses: actions/download-artifact@v4
|
||||
with:
|
||||
name: build-assets
|
||||
|
||||
@@ -391,6 +394,8 @@ jobs:
|
||||
runs-on: ubuntu-latest
|
||||
needs: build
|
||||
if: github.event_name != 'push' && needs.build.outputs.files_changed != 'true'
|
||||
permissions:
|
||||
contents: read
|
||||
strategy:
|
||||
fail-fast: false
|
||||
max-parallel: 4
|
||||
@@ -406,7 +411,7 @@ jobs:
|
||||
repository: ${{ github.event.pull_request.head.repo.full_name }}
|
||||
|
||||
- name: Download build assets
|
||||
uses: actions/download-artifact@v3
|
||||
uses: actions/download-artifact@v4
|
||||
with:
|
||||
name: build-assets
|
||||
|
||||
@@ -425,13 +430,14 @@ jobs:
|
||||
runs-on: ubuntu-latest
|
||||
needs: build
|
||||
if: needs.build.outputs.files_changed != 'true'
|
||||
|
||||
permissions:
|
||||
contents: read
|
||||
steps:
|
||||
- name: Checkout branch
|
||||
uses: actions/checkout@v4
|
||||
|
||||
- name: Download build assets
|
||||
uses: actions/download-artifact@v3
|
||||
uses: actions/download-artifact@v4
|
||||
with:
|
||||
name: build-assets
|
||||
|
||||
@@ -479,13 +485,14 @@ jobs:
|
||||
runs-on: ubuntu-latest
|
||||
needs: build
|
||||
if: needs.build.outputs.files_changed != 'true'
|
||||
|
||||
permissions:
|
||||
contents: read
|
||||
steps:
|
||||
- name: Checkout branch
|
||||
uses: actions/checkout@v4
|
||||
|
||||
- name: Download build assets
|
||||
uses: actions/download-artifact@v3
|
||||
uses: actions/download-artifact@v4
|
||||
with:
|
||||
name: build-assets
|
||||
|
||||
@@ -545,7 +552,7 @@ jobs:
|
||||
path: dir1
|
||||
|
||||
- name: Download build assets
|
||||
uses: actions/download-artifact@v3
|
||||
uses: actions/download-artifact@v4
|
||||
with:
|
||||
name: build-assets
|
||||
path: dir1/dist
|
||||
@@ -560,11 +567,83 @@ jobs:
|
||||
shell:
|
||||
bash
|
||||
|
||||
test-dir-names-nested-folder:
|
||||
name: Test changed-files with dir-names in a nested folder
|
||||
runs-on: ubuntu-latest
|
||||
needs: build
|
||||
if: needs.build.outputs.files_changed != 'true'
|
||||
permissions:
|
||||
contents: read
|
||||
steps:
|
||||
- name: Checkout branch
|
||||
uses: actions/checkout@v4
|
||||
with:
|
||||
repository: ${{ github.event.pull_request.head.repo.full_name }}
|
||||
submodules: true
|
||||
fetch-depth: 0
|
||||
|
||||
- name: Download build assets
|
||||
uses: actions/download-artifact@v4
|
||||
with:
|
||||
name: build-assets
|
||||
path: dist
|
||||
|
||||
- name: Get changed files in the .github folder
|
||||
id: changed-files
|
||||
uses: ./
|
||||
with:
|
||||
path: .github
|
||||
json: true
|
||||
escape_json: false
|
||||
dir_names: true
|
||||
dir_names_exclude_current_dir: true
|
||||
|
||||
- name: Show output
|
||||
run: |
|
||||
echo "${{ toJSON(steps.changed-files.outputs) }}"
|
||||
shell:
|
||||
bash
|
||||
|
||||
test-non-existing-repository:
|
||||
name: Test changed-files with non existing repository
|
||||
runs-on: ubuntu-latest
|
||||
needs: build
|
||||
if: github.event_name == 'push' && needs.build.outputs.files_changed != 'true'
|
||||
permissions:
|
||||
contents: read
|
||||
steps:
|
||||
- name: Checkout into dir1
|
||||
uses: actions/checkout@v4
|
||||
with:
|
||||
repository: ${{ github.event.pull_request.head.repo.full_name }}
|
||||
submodules: true
|
||||
fetch-depth: 0
|
||||
path: dir1
|
||||
|
||||
- name: Download build assets
|
||||
uses: actions/download-artifact@v4
|
||||
with:
|
||||
name: build-assets
|
||||
path: dir1/dist
|
||||
|
||||
- name: Run changed-files with non existing repository
|
||||
id: changed-files
|
||||
continue-on-error: true
|
||||
uses: ./dir1
|
||||
|
||||
- name: Verify failed
|
||||
if: steps.changed-files.outcome != 'failure'
|
||||
run: |
|
||||
echo "Expected: (failure) got ${{ steps.changed-files.outcome }}"
|
||||
exit 1
|
||||
|
||||
test-submodules:
|
||||
name: Test changed-files with submodule
|
||||
runs-on: ubuntu-latest
|
||||
needs: build
|
||||
if: needs.build.outputs.files_changed != 'true'
|
||||
permissions:
|
||||
contents: read
|
||||
strategy:
|
||||
fail-fast: false
|
||||
max-parallel: 4
|
||||
@@ -580,7 +659,7 @@ jobs:
|
||||
fetch-depth: ${{ matrix.fetch-depth }}
|
||||
|
||||
- name: Download build assets
|
||||
uses: actions/download-artifact@v3
|
||||
uses: actions/download-artifact@v4
|
||||
with:
|
||||
name: build-assets
|
||||
|
||||
@@ -608,6 +687,8 @@ jobs:
|
||||
runs-on: ubuntu-latest
|
||||
needs: build
|
||||
if: needs.build.outputs.files_changed != 'true'
|
||||
permissions:
|
||||
contents: read
|
||||
strategy:
|
||||
fail-fast: false
|
||||
max-parallel: 4
|
||||
@@ -623,7 +704,7 @@ jobs:
|
||||
fetch-depth: ${{ matrix.fetch-depth }}
|
||||
|
||||
- name: Download build assets
|
||||
uses: actions/download-artifact@v3
|
||||
uses: actions/download-artifact@v4
|
||||
with:
|
||||
name: build-assets
|
||||
|
||||
@@ -655,11 +736,36 @@ jobs:
|
||||
shell:
|
||||
bash
|
||||
|
||||
- name: Run changed-files with files_yaml, json and write_output_files
|
||||
id: changed-files-json-write-output-files
|
||||
uses: ./
|
||||
with:
|
||||
files_yaml: |
|
||||
test:
|
||||
- .github/workflows/test.yml
|
||||
json: true
|
||||
write_output_files: true
|
||||
|
||||
- name: Show all outputs
|
||||
run: |
|
||||
echo "${{ toJSON(steps.changed-files-json-write-output-files.outputs) }}"
|
||||
shell:
|
||||
bash
|
||||
|
||||
- name: Show all_changed_files output and list .github/outputs
|
||||
run: |
|
||||
echo '${{ toJSON(steps.changed-files-json-write-output-files.outputs.test_all_changed_files) }}'
|
||||
cat .github/outputs/test_all_changed_files.json
|
||||
shell:
|
||||
bash
|
||||
|
||||
test-recover-deleted-file:
|
||||
name: Test changed-files recover deleted file
|
||||
runs-on: ubuntu-latest
|
||||
needs: build
|
||||
if: needs.build.outputs.files_changed != 'true'
|
||||
permissions:
|
||||
contents: read
|
||||
strategy:
|
||||
fail-fast: false
|
||||
max-parallel: 4
|
||||
@@ -675,7 +781,7 @@ jobs:
|
||||
fetch-depth: ${{ matrix.fetch-depth }}
|
||||
|
||||
- name: Download build assets
|
||||
uses: actions/download-artifact@v3
|
||||
uses: actions/download-artifact@v4
|
||||
with:
|
||||
name: build-assets
|
||||
|
||||
@@ -815,11 +921,43 @@ jobs:
|
||||
cat "deleted_files/test/test deleted.txt"
|
||||
fi
|
||||
|
||||
- name: Run changed-files with recover_deleted_files for an expected git submodule file
|
||||
id: changed-files-recover-deleted-files-within-submodule
|
||||
uses: ./
|
||||
with:
|
||||
base_sha: "3be651e99d3d4eae395694f6c6f3b9d18457f6c8"
|
||||
sha: "d90c240f2ad4ec04d8f0f48e5ac290ad96ebe850"
|
||||
recover_deleted_files: true
|
||||
fetch_depth: 60000
|
||||
|
||||
- name: Show output
|
||||
run: |
|
||||
echo "${{ toJSON(steps.changed-files-recover-deleted-files-within-submodule.outputs) }}"
|
||||
shell:
|
||||
bash
|
||||
|
||||
- name: Verify deleted files
|
||||
if: steps.changed-files-recover-deleted-files-within-submodule.outputs.deleted_files != 'test/demo/.github/FUNDING.yml'
|
||||
run: |
|
||||
echo "Expected: (test/demo/.github/FUNDING.yml) got ${{ steps.changed-files-recover-deleted-files-within-submodule.outputs.deleted_files }}"
|
||||
exit 1
|
||||
- name: Verify that test/demo/.github/FUNDING.yml is restored
|
||||
run: |
|
||||
if [ ! -f "test/demo/.github/FUNDING.yml" ]; then
|
||||
echo "Expected: (test/demo/.github/FUNDING.yml) to exist"
|
||||
exit 1
|
||||
else
|
||||
cat "test/demo/.github/FUNDING.yml"
|
||||
rm "test/demo/.github/FUNDING.yml"
|
||||
fi
|
||||
|
||||
test-dir-names-deleted-files-include-only-deleted-dirs-single-file:
|
||||
name: Test dir names deleted files include only deleted dirs single file
|
||||
runs-on: ubuntu-latest
|
||||
needs: build
|
||||
if: needs.build.outputs.files_changed != 'true'
|
||||
permissions:
|
||||
contents: read
|
||||
steps:
|
||||
- name: Checkout branch
|
||||
uses: actions/checkout@v4
|
||||
@@ -853,6 +991,8 @@ jobs:
|
||||
runs-on: ubuntu-latest
|
||||
needs: build
|
||||
if: needs.build.outputs.files_changed != 'true'
|
||||
permissions:
|
||||
contents: read
|
||||
steps:
|
||||
- name: Checkout branch
|
||||
uses: actions/checkout@v4
|
||||
@@ -894,6 +1034,8 @@ jobs:
|
||||
runs-on: ubuntu-latest
|
||||
needs: build
|
||||
if: needs.build.outputs.files_changed != 'true'
|
||||
permissions:
|
||||
contents: read
|
||||
strategy:
|
||||
fail-fast: false
|
||||
max-parallel: 4
|
||||
@@ -910,7 +1052,7 @@ jobs:
|
||||
fetch-depth: ${{ matrix.fetch-depth }}
|
||||
|
||||
- name: Download build assets
|
||||
uses: actions/download-artifact@v3
|
||||
uses: actions/download-artifact@v4
|
||||
with:
|
||||
name: build-assets
|
||||
|
||||
@@ -944,6 +1086,8 @@ jobs:
|
||||
runs-on: ${{ matrix.platform }}
|
||||
needs: build
|
||||
if: needs.build.outputs.files_changed != 'true'
|
||||
permissions:
|
||||
contents: read
|
||||
strategy:
|
||||
fail-fast: false
|
||||
max-parallel: 4
|
||||
@@ -959,7 +1103,7 @@ jobs:
|
||||
repository: ${{ github.event.pull_request.head.repo.full_name }}
|
||||
fetch-depth: ${{ matrix.fetch-depth }}
|
||||
- name: Download build assets
|
||||
uses: actions/download-artifact@v3
|
||||
uses: actions/download-artifact@v4
|
||||
with:
|
||||
name: build-assets
|
||||
- name: Dump GitHub context
|
||||
@@ -974,7 +1118,7 @@ jobs:
|
||||
echo '${{ toJSON(steps.changed-files.outputs) }}'
|
||||
shell:
|
||||
bash
|
||||
- name: Run changed-files with dir name
|
||||
- name: Run changed-files with dir name pattern
|
||||
id: changed-files-dir-name
|
||||
uses: ./
|
||||
with:
|
||||
@@ -1944,7 +2088,7 @@ jobs:
|
||||
bash
|
||||
- name: Get branch name
|
||||
id: branch-name
|
||||
uses: tj-actions/branch-names@v7
|
||||
uses: tj-actions/branch-names@v8
|
||||
if: github.event_name == 'pull_request' && matrix.fetch-depth == 0
|
||||
- uses: nrwl/nx-set-shas@v4
|
||||
id: last_successful_commit
|
||||
|
||||
8
.github/workflows/update-readme.yml
vendored
8
.github/workflows/update-readme.yml
vendored
@@ -1,5 +1,9 @@
|
||||
name: Format README.md
|
||||
|
||||
permissions:
|
||||
contents: read
|
||||
pull-requests: write
|
||||
|
||||
on:
|
||||
push:
|
||||
branches:
|
||||
@@ -23,7 +27,7 @@ jobs:
|
||||
uses: tj-actions/remark@v3
|
||||
|
||||
- name: Verify Changed files
|
||||
uses: tj-actions/verify-changed-files@v16
|
||||
uses: tj-actions/verify-changed-files@v19
|
||||
id: verify_changed_files
|
||||
with:
|
||||
files: |
|
||||
@@ -37,7 +41,7 @@ jobs:
|
||||
|
||||
- name: Create Pull Request
|
||||
if: failure()
|
||||
uses: peter-evans/create-pull-request@v5
|
||||
uses: peter-evans/create-pull-request@v6
|
||||
with:
|
||||
base: "main"
|
||||
labels: "merge when passing"
|
||||
|
||||
41
.github/workflows/workflow-run-example.yml
vendored
Normal file
41
.github/workflows/workflow-run-example.yml
vendored
Normal file
@@ -0,0 +1,41 @@
|
||||
name: Workflow Run Example
|
||||
on:
|
||||
workflow_run:
|
||||
workflows: [Matrix Example]
|
||||
types: [completed]
|
||||
|
||||
permissions:
|
||||
contents: read
|
||||
|
||||
jobs:
|
||||
on-success:
|
||||
runs-on: ubuntu-latest
|
||||
if: ${{ github.event.workflow_run.conclusion == 'success' }}
|
||||
steps:
|
||||
- name: Checkout code
|
||||
uses: actions/checkout@v4
|
||||
|
||||
- name: Get changed files
|
||||
id: changed-files
|
||||
uses: ./
|
||||
|
||||
- name: Echo list of changed files on success
|
||||
run: |
|
||||
echo "Changed files on success:"
|
||||
echo "${{ steps.changed-files.outputs.all_changed_files }}"
|
||||
|
||||
on-failure:
|
||||
runs-on: ubuntu-latest
|
||||
if: ${{ github.event.workflow_run.conclusion == 'failure' }}
|
||||
steps:
|
||||
- name: Checkout code
|
||||
uses: actions/checkout@v4
|
||||
|
||||
- name: Get changed files
|
||||
id: changed-files
|
||||
uses: ./
|
||||
|
||||
- name: Echo list of changed files on failure
|
||||
run: |
|
||||
echo "Changed files on failure:"
|
||||
echo "${{ steps.changed-files.outputs.all_changed_files }}"
|
||||
1014
HISTORY.md
1014
HISTORY.md
File diff suppressed because it is too large
Load Diff
363
README.md
363
README.md
@@ -1,25 +1,25 @@
|
||||
[](https://docs.github.com/en/actions/reference/workflow-syntax-for-github-actions#jobsjob_idruns-on)
|
||||
[](https://docs.github.com/en/actions/reference/workflow-syntax-for-github-actions#jobsjob_idruns-on)
|
||||
[](https://docs.github.com/en/actions/reference/workflow-syntax-for-github-actions#jobsjob_idruns-on)
|
||||
[](https://github.com/search?o=desc\&q=tj-actions+changed-files+language%3AYAML\&s=\&type=Code)
|
||||
[](https://github.com/search?o=desc\&q=tj-actions+changed-files+language%3AYAML\&s=\&type=Code)
|
||||
|
||||
[](https://www.codacy.com/gh/tj-actions/changed-files/dashboard?utm_source=github.com\&utm_medium=referral\&utm_content=tj-actions/changed-files\&utm_campaign=Badge_Grade)
|
||||
[](https://app.codacy.com/gh/tj-actions/changed-files/dashboard?utm_source=gh\&utm_medium=referral\&utm_content=\&utm_campaign=Badge_grade)
|
||||
[](https://github.com/tj-actions/changed-files/actions/workflows/test.yml)
|
||||
[](https://github.com/tj-actions/changed-files/actions/workflows/sync-release-version.yml)
|
||||
|
||||
<!-- ALL-CONTRIBUTORS-BADGE:START - Do not remove or modify this section -->
|
||||
|
||||
[](#contributors-)
|
||||
[](#contributors-)
|
||||
|
||||
<!-- ALL-CONTRIBUTORS-BADGE:END -->
|
||||
|
||||
## changed-files
|
||||
|
||||
Effortlessly track all changed files and directories relative to a target branch, preceding commit or the last remote commit returning **relative paths** from the project root using this GitHub action.
|
||||
Effortlessly track all changed files and directories relative to a target branch, the current branch (preceding commit or the last remote commit), multiple branches, or custom commits returning **relative paths** from the project root using this GitHub action.
|
||||
|
||||
> **Note** :exclamation:
|
||||
> \[!NOTE]
|
||||
>
|
||||
> * This action solely identifies files that have undergone changes within the context of events such as `pull_request*`, `push`, and more. However, it doesn't detect pending uncommitted changes created during the workflow execution.
|
||||
> * This action solely identifies files that have changed for events such as [`pull_request*`, `push`, `merge_group`, `release`, and many more](#other-supported-events-electron). However, it doesn't detect pending uncommitted changes created during the workflow execution.
|
||||
>
|
||||
> See: https://github.com/tj-actions/verify-changed-files instead
|
||||
|
||||
@@ -28,13 +28,13 @@ Effortlessly track all changed files and directories relative to a target branch
|
||||
* [Features 🚀](#features-)
|
||||
* [Usage 💻](#usage-)
|
||||
* [On `pull_request` 🔀](#on-pull_request-)
|
||||
* [Using local .git history 📁](#using-local-git-history-)
|
||||
* [Using local .git directory 📁](#using-local-git-directory-)
|
||||
* [Using Github's API :octocat:](#using-githubs-api-octocat)
|
||||
* [On `push` ⬆️](#on-push-️)
|
||||
* [Other supported events :electron:](#other-supported-events-electron)
|
||||
* [Inputs ⚙️](#inputs-️)
|
||||
* [Useful Acronyms 🧮](#useful-acronyms-)
|
||||
* [Outputs 📤](#outputs-)
|
||||
* [Inputs ⚙️](#inputs-️)
|
||||
* [Versioning 🏷️](#versioning-️)
|
||||
* [Examples 📄](#examples-)
|
||||
* [Real-world usage 🌐](#real-world-usage-)
|
||||
@@ -51,16 +51,16 @@ Effortlessly track all changed files and directories relative to a target branch
|
||||
* Fast execution, averaging 0-10 seconds.
|
||||
* Leverages either [Github's REST API](https://docs.github.com/en/rest/reference/repos#list-commits) or [Git's native diff](https://git-scm.com/docs/git-diff) to determine changed files.
|
||||
* Facilitates easy debugging.
|
||||
* Scales to handle large repositories.
|
||||
* Scales to handle large/mono repositories.
|
||||
* Supports Git submodules.
|
||||
* Supports [merge queues](https://docs.github.com/en/repositories/configuring-branches-and-merges-in-your-repository/configuring-pull-request-merges/managing-a-merge-queue) for pull requests.
|
||||
* Generates escaped [JSON output for running matrix jobs](https://github.com/tj-actions/changed-files/blob/main/.github/workflows/matrix-test.yml) based on changed files.
|
||||
* Generates escaped [JSON output for running matrix jobs](https://github.com/tj-actions/changed-files/blob/main/.github/workflows/matrix-example.yml) based on changed files.
|
||||
* Lists changed directories.
|
||||
* Limits matching changed directories to a specified maximum depth.
|
||||
* Optionally excludes the current directory.
|
||||
* Writes outputs to a designated `.txt` or `.json` file for further processing.
|
||||
* Restores deleted files to their previous location or a newly specified location.
|
||||
* Supports Monorepos by fetching a fixed number of commits.
|
||||
* Supports fetching a fixed number of commits which improves performance.
|
||||
* Compatible with all platforms (Linux, MacOS, Windows).
|
||||
* Supports [GitHub-hosted runners](https://docs.github.com/en/actions/using-github-hosted-runners/about-github-hosted-runners).
|
||||
* Supports [GitHub Enterprise Server](https://docs.github.com/en/enterprise-server@3.3/admin/github-actions/getting-started-with-github-actions-for-your-enterprise/getting-started-with-github-actions-for-github-enterprise-server).
|
||||
@@ -83,7 +83,7 @@ And many more...
|
||||
|
||||
## Usage 💻
|
||||
|
||||
> **Important** :bangbang:
|
||||
> \[!IMPORTANT]
|
||||
>
|
||||
> * **Push Events**: When configuring [`actions/checkout`](https://github.com/actions/checkout#usage), make sure to set [`fetch-depth`](https://github.com/actions/checkout#usage) to either `0` or `2`, depending on your use case.
|
||||
> * **Mono Repositories**: To avoid pulling the entire branch history, you can utilize the default [`actions/checkout`](https://github.com/actions/checkout#usage)'s [`fetch-depth`](https://github.com/actions/checkout#usage) of `1` for [`pull_request`](https://docs.github.com/en/actions/using-workflows/events-that-trigger-workflows#pull_request) events.
|
||||
@@ -97,7 +97,7 @@ Visit the [discussions for more information](https://github.com/tj-actions/chang
|
||||
|
||||
Detect changes to all files in a Pull request relative to the target branch or since the last pushed commit.
|
||||
|
||||
#### Using local .git history 📁
|
||||
#### Using local .git directory 📁
|
||||
|
||||
```yaml
|
||||
name: CI
|
||||
@@ -119,46 +119,55 @@ jobs:
|
||||
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@v40
|
||||
|
||||
uses: tj-actions/changed-files@v42
|
||||
# To compare changes between the current commit and the last pushed remote commit set `since_last_remote_commit: true`. e.g
|
||||
# with:
|
||||
# since_last_remote_commit: true
|
||||
|
||||
- name: List all changed files
|
||||
env:
|
||||
ALL_CHANGED_FILES: ${{ steps.changed-files.outputs.all_changed_files }}
|
||||
run: |
|
||||
for file in ${{ steps.changed-files.outputs.all_changed_files }}; do
|
||||
for file in ${ALL_CHANGED_FILES}; do
|
||||
echo "$file was changed"
|
||||
done
|
||||
|
||||
# -----------------------------------------------------------------------------------------------------------
|
||||
# Example 2
|
||||
# -----------------------------------------------------------------------------------------------------------
|
||||
- name: Get all changed markdown files
|
||||
id: changed-markdown-files
|
||||
uses: tj-actions/changed-files@v40
|
||||
uses: tj-actions/changed-files@v42
|
||||
with:
|
||||
# Avoid using single or double quotes for multiline patterns
|
||||
files: |
|
||||
**.md
|
||||
# Avoid using single or double quotes for multiline patterns
|
||||
|
||||
- name: List all changed files markdown files
|
||||
if: steps.changed-markdown-files.outputs.any_changed == 'true'
|
||||
env:
|
||||
ALL_CHANGED_FILES: ${{ steps.changed-markdown-files.outputs.all_changed_files }}
|
||||
run: |
|
||||
for file in ${{ steps.changed-markdown-files.outputs.all_changed_files }}; do
|
||||
for file in ${ALL_CHANGED_FILES}; do
|
||||
echo "$file was changed"
|
||||
done
|
||||
|
||||
# -----------------------------------------------------------------------------------------------------------
|
||||
# Example 3
|
||||
# -----------------------------------------------------------------------------------------------------------
|
||||
- name: Get all test, doc and src files that have changed
|
||||
id: changed-files-yaml
|
||||
uses: tj-actions/changed-files@v40
|
||||
uses: tj-actions/changed-files@v42
|
||||
with:
|
||||
files_yaml: |
|
||||
doc:
|
||||
- '**.md'
|
||||
- docs/**
|
||||
- README.md
|
||||
test:
|
||||
- test/**
|
||||
- '!test/**.md'
|
||||
@@ -169,29 +178,37 @@ jobs:
|
||||
- name: Run step if test file(s) change
|
||||
# NOTE: Ensure all outputs are prefixed by the same key used above e.g. `test_(...)` | `doc_(...)` | `src_(...)` when trying to access the `any_changed` output.
|
||||
if: steps.changed-files-yaml.outputs.test_any_changed == 'true'
|
||||
env:
|
||||
TEST_ALL_CHANGED_FILES: ${{ steps.changed-files-yaml.outputs.test_all_changed_files }}
|
||||
run: |
|
||||
echo "One or more test file(s) has changed."
|
||||
echo "List all the files that have changed: ${{ steps.changed-files-yaml.outputs.test_all_changed_files }}"
|
||||
echo "List all the files that have changed: $TEST_ALL_CHANGED_FILES"
|
||||
|
||||
- name: Run step if doc file(s) change
|
||||
if: steps.changed-files-yaml.outputs.doc_any_changed == 'true'
|
||||
env:
|
||||
DOC_ALL_CHANGED_FILES: ${{ steps.changed-files-yaml.outputs.doc_all_changed_files }}
|
||||
run: |
|
||||
echo "One or more doc file(s) has changed."
|
||||
echo "List all the files that have changed: ${{ steps.changed-files-yaml.outputs.doc_all_changed_files }}"
|
||||
echo "List all the files that have changed: $DOC_ALL_CHANGED_FILES"
|
||||
|
||||
# Example 3
|
||||
# -----------------------------------------------------------------------------------------------------------
|
||||
# Example 4
|
||||
# -----------------------------------------------------------------------------------------------------------
|
||||
- name: Get changed files in the docs folder
|
||||
id: changed-files-specific
|
||||
uses: tj-actions/changed-files@v40
|
||||
uses: tj-actions/changed-files@v42
|
||||
with:
|
||||
files: docs/*.{js,html} # Alternatively using: `docs/**`
|
||||
files_ignore: docs/static.js
|
||||
|
||||
- name: Run step if any file(s) in the docs folder change
|
||||
if: steps.changed-files-specific.outputs.any_changed == 'true'
|
||||
env:
|
||||
ALL_CHANGED_FILES: ${{ steps.changed-files-specific.outputs.all_changed_files }}
|
||||
run: |
|
||||
echo "One or more files in the docs folder has changed."
|
||||
echo "List all the files that have changed: ${{ steps.changed-files-specific.outputs.all_changed_files }}"
|
||||
echo "List all the files that have changed: $ALL_CHANGED_FILES"
|
||||
```
|
||||
|
||||
#### Using Github's API :octocat:
|
||||
@@ -222,11 +239,13 @@ jobs:
|
||||
steps:
|
||||
- name: Get changed files
|
||||
id: changed-files
|
||||
uses: tj-actions/changed-files@v40
|
||||
uses: tj-actions/changed-files@v42
|
||||
|
||||
- name: List all changed files
|
||||
env:
|
||||
ALL_CHANGED_FILES: ${{ steps.changed-files.outputs.all_changed_files }}
|
||||
run: |
|
||||
for file in ${{ steps.changed-files.outputs.all_changed_files }}; do
|
||||
for file in ${ALL_CHANGED_FILES}; do
|
||||
echo "$file was changed"
|
||||
done
|
||||
```
|
||||
@@ -263,13 +282,14 @@ jobs:
|
||||
|
||||
- name: Get changed files
|
||||
id: changed-files
|
||||
uses: tj-actions/changed-files@v40
|
||||
|
||||
uses: tj-actions/changed-files@v42
|
||||
# NOTE: `since_last_remote_commit: true` is implied by default and falls back to the previous local commit.
|
||||
|
||||
- name: List all changed files
|
||||
env:
|
||||
ALL_CHANGED_FILES: ${{ steps.changed-files.outputs.all_changed_files }}
|
||||
run: |
|
||||
for file in ${{ steps.changed-files.outputs.all_changed_files }}; do
|
||||
for file in ${ALL_CHANGED_FILES}; do
|
||||
echo "$file was changed"
|
||||
done
|
||||
...
|
||||
@@ -280,6 +300,7 @@ jobs:
|
||||
* [schedule](https://docs.github.com/en/actions/using-workflows/events-that-trigger-workflows#schedule)
|
||||
* [release](https://docs.github.com/en/actions/using-workflows/events-that-trigger-workflows#release)
|
||||
* [workflow\_dispatch](https://docs.github.com/en/actions/using-workflows/events-that-trigger-workflows#workflow_dispatch)
|
||||
* [workflow\_run](https://docs.github.com/en/actions/using-workflows/events-that-trigger-workflows#workflow_run)
|
||||
* [merge\_group](https://docs.github.com/en/actions/using-workflows/events-that-trigger-workflows#merge_group)
|
||||
* [issue\_comment](https://docs.github.com/en/actions/using-workflows/events-that-trigger-workflows#issue_comment)
|
||||
* ...and many more
|
||||
@@ -296,77 +317,19 @@ Support this project with a :star:
|
||||
|
||||
[buymeacoffee-shield]: https://www.buymeacoffee.com/assets/img/custom_images/orange_img.png
|
||||
|
||||
## Useful Acronyms 🧮
|
||||
|
||||
| Acronym | Meaning |
|
||||
|:---------:|:------------:|
|
||||
| A | Added |
|
||||
| C | Copied |
|
||||
| M | Modified |
|
||||
| D | Deleted |
|
||||
| R | Renamed |
|
||||
| T | Type changed |
|
||||
| U | Unmerged |
|
||||
| X | Unknown |
|
||||
|
||||
> **Warning** 🚨
|
||||
> \[!IMPORTANT]
|
||||
>
|
||||
> * 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 📤
|
||||
|
||||
<!-- AUTO-DOC-OUTPUT:START - Do not remove or modify this section -->
|
||||
|
||||
| OUTPUT | TYPE | DESCRIPTION |
|
||||
|------------------------------------------------------------------------------------------------------------------------------------------------|--------|-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|
|
||||
| <a name="output_added_files"></a>[added\_files](#output_added_files) | string | Returns only files that are <br>Added (A). |
|
||||
| <a name="output_added_files_count"></a>[added\_files\_count](#output_added_files_count) | string | Returns the number of `added_files` |
|
||||
| <a name="output_all_changed_and_modified_files"></a>[all\_changed\_and\_modified\_files](#output_all_changed_and_modified_files) | string | Returns all changed and modified <br>files i.e. *a combination of (ACMRDTUX)* |
|
||||
| <a name="output_all_changed_and_modified_files_count"></a>[all\_changed\_and\_modified\_files\_count](#output_all_changed_and_modified_files_count) | string | Returns the number of `all_changed_and_modified_files` |
|
||||
| <a name="output_all_changed_files"></a>[all\_changed\_files](#output_all_changed_files) | string | Returns all changed files i.e. <br>*a combination of all added, copied, modified and renamed files (ACMR)* |
|
||||
| <a name="output_all_changed_files_count"></a>[all\_changed\_files\_count](#output_all_changed_files_count) | string | Returns the number of `all_changed_files` |
|
||||
| <a name="output_all_modified_files"></a>[all\_modified\_files](#output_all_modified_files) | string | Returns all changed files i.e. <br>*a combination of all added, copied, modified, renamed and deleted files (ACMRD)*. |
|
||||
| <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>*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. *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_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. *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_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` |
|
||||
| <a name="output_type_changed_files"></a>[type\_changed\_files](#output_type_changed_files) | string | Returns only files that have <br>their file type changed (T). |
|
||||
| <a name="output_type_changed_files_count"></a>[type\_changed\_files\_count](#output_type_changed_files_count) | string | Returns the number of `type_changed_files` |
|
||||
| <a name="output_unknown_files"></a>[unknown\_files](#output_unknown_files) | string | Returns only files that are <br>Unknown (X). |
|
||||
| <a name="output_unknown_files_count"></a>[unknown\_files\_count](#output_unknown_files_count) | string | Returns the number of `unknown_files` |
|
||||
| <a name="output_unmerged_files"></a>[unmerged\_files](#output_unmerged_files) | string | Returns only files that are <br>Unmerged (U). |
|
||||
| <a name="output_unmerged_files_count"></a>[unmerged\_files\_count](#output_unmerged_files_count) | string | Returns the number of `unmerged_files` |
|
||||
|
||||
<!-- AUTO-DOC-OUTPUT:END -->
|
||||
> * When using `files_yaml*` inputs:
|
||||
> * All keys must start with a letter or `_` and contain only alphanumeric characters, `-`, or `_`.
|
||||
>
|
||||
> For example, `test` or `test_key` or `test-key` or `_test_key` are all valid.
|
||||
|
||||
## Inputs ⚙️
|
||||
|
||||
<!-- AUTO-DOC-INPUT:START - Do not remove or modify this section -->
|
||||
|
||||
```yaml
|
||||
- uses: tj-actions/changed-files@v40
|
||||
- uses: tj-actions/changed-files@v42
|
||||
id: changed-files
|
||||
with:
|
||||
# Github API URL.
|
||||
@@ -525,11 +488,18 @@ Support this project with a :star:
|
||||
|
||||
# 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
|
||||
# https://github.com/tj-actions/changed-files/blob/main/.github/workflows/matrix-example.yml
|
||||
# Type: boolean
|
||||
# Default: "false"
|
||||
json: ''
|
||||
|
||||
# Output changed files in a format that can be
|
||||
# used for matrix jobs. Alias for setting inputs `json`
|
||||
# to `true` and `escape_json` to `false`.
|
||||
# Type: boolean
|
||||
# Default: "false"
|
||||
matrix: ''
|
||||
|
||||
# Apply the negation patterns first. NOTE: This affects how
|
||||
# changed files are matched.
|
||||
# Type: boolean
|
||||
@@ -600,6 +570,12 @@ Support this project with a :star:
|
||||
# Default: "\n"
|
||||
recover_files_separator: ''
|
||||
|
||||
# Apply sanitization to output filenames before being set as
|
||||
# output.
|
||||
# Type: boolean
|
||||
# Default: "true"
|
||||
safe_output: ''
|
||||
|
||||
# Split character for output strings.
|
||||
# Type: string
|
||||
# Default: " "
|
||||
@@ -624,10 +600,10 @@ Support this project with a :star:
|
||||
# Default: "false"
|
||||
since_last_remote_commit: ''
|
||||
|
||||
# Skip the initial fetch to improve performance for shallow
|
||||
# repositories. NOTE: This could lead to errors with missing
|
||||
# history and the intended use is limited to when
|
||||
# you've fetched the history necessary to perform the diff.
|
||||
# Skip initially fetching additional history to improve performance for
|
||||
# shallow repositories. NOTE: This could lead to errors with
|
||||
# missing history. It's intended to be used when you've
|
||||
# fetched all necessary history to perform the diff.
|
||||
# Type: boolean
|
||||
# Default: "false"
|
||||
skip_initial_fetch: ''
|
||||
@@ -643,6 +619,12 @@ Support this project with a :star:
|
||||
# Type: string
|
||||
until: ''
|
||||
|
||||
# Force the use of Github's REST API even when
|
||||
# a local copy of the repository exists
|
||||
# Type: boolean
|
||||
# Default: "false"
|
||||
use_rest_api: ''
|
||||
|
||||
# Write outputs to the `output_dir` defaults to `.github/outputs` folder.
|
||||
# NOTE: This creates a `.txt` file by default and
|
||||
# a `.json` file if `json` is set to `true`.
|
||||
@@ -654,6 +636,73 @@ Support this project with a :star:
|
||||
|
||||
<!-- AUTO-DOC-INPUT:END -->
|
||||
|
||||
## Useful Acronyms 🧮
|
||||
|
||||
| Acronym | Meaning |
|
||||
|:---------:|:------------:|
|
||||
| A | Added |
|
||||
| C | Copied |
|
||||
| M | Modified |
|
||||
| D | Deleted |
|
||||
| R | Renamed |
|
||||
| T | Type changed |
|
||||
| U | Unmerged |
|
||||
| X | Unknown |
|
||||
|
||||
> \[!IMPORTANT]
|
||||
>
|
||||
> * When using `files_yaml*` inputs:
|
||||
> * it's required to prefix all outputs with the key to ensure that the correct outputs are accessible.
|
||||
>
|
||||
> For example, if you use `test` as the key, you can access outputs like `added_files`, `any_changed`, and so on by prefixing them with the key `test_added_files` or `test_any_changed` etc.
|
||||
|
||||
## Outputs 📤
|
||||
|
||||
<!-- AUTO-DOC-OUTPUT:START - Do not remove or modify this section -->
|
||||
|
||||
| OUTPUT | TYPE | DESCRIPTION |
|
||||
|------------------------------------------------------------------------------------------------------------------------------------------------|--------|-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|
|
||||
| <a name="output_added_files"></a>[added\_files](#output_added_files) | string | Returns only files that are <br>Added (A). |
|
||||
| <a name="output_added_files_count"></a>[added\_files\_count](#output_added_files_count) | string | Returns the number of `added_files` |
|
||||
| <a name="output_all_changed_and_modified_files"></a>[all\_changed\_and\_modified\_files](#output_all_changed_and_modified_files) | string | Returns all changed and modified <br>files i.e. *a combination of (ACMRDTUX)* |
|
||||
| <a name="output_all_changed_and_modified_files_count"></a>[all\_changed\_and\_modified\_files\_count](#output_all_changed_and_modified_files_count) | string | Returns the number of `all_changed_and_modified_files` |
|
||||
| <a name="output_all_changed_files"></a>[all\_changed\_files](#output_all_changed_files) | string | Returns all changed files i.e. <br>*a combination of all added, copied, modified and renamed files (ACMR)* |
|
||||
| <a name="output_all_changed_files_count"></a>[all\_changed\_files\_count](#output_all_changed_files_count) | string | Returns the number of `all_changed_files` |
|
||||
| <a name="output_all_modified_files"></a>[all\_modified\_files](#output_all_modified_files) | string | Returns all changed files i.e. <br>*a combination of all added, copied, modified, renamed and deleted files (ACMRD)*. |
|
||||
| <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 have 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. *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_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>have 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. *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_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` |
|
||||
| <a name="output_type_changed_files"></a>[type\_changed\_files](#output_type_changed_files) | string | Returns only files that have <br>their file type changed (T). |
|
||||
| <a name="output_type_changed_files_count"></a>[type\_changed\_files\_count](#output_type_changed_files_count) | string | Returns the number of `type_changed_files` |
|
||||
| <a name="output_unknown_files"></a>[unknown\_files](#output_unknown_files) | string | Returns only files that are <br>Unknown (X). |
|
||||
| <a name="output_unknown_files_count"></a>[unknown\_files\_count](#output_unknown_files_count) | string | Returns the number of `unknown_files` |
|
||||
| <a name="output_unmerged_files"></a>[unmerged\_files](#output_unmerged_files) | string | Returns only files that are <br>Unmerged (U). |
|
||||
| <a name="output_unmerged_files_count"></a>[unmerged\_files\_count](#output_unmerged_files_count) | string | Returns the number of `unmerged_files` |
|
||||
|
||||
<!-- AUTO-DOC-OUTPUT:END -->
|
||||
|
||||
## Versioning 🏷️
|
||||
|
||||
This GitHub Action follows the principles of [Semantic Versioning](https://semver.org) for versioning releases.
|
||||
@@ -675,7 +724,30 @@ The format of the version string is as follows:
|
||||
...
|
||||
- name: Get changed files
|
||||
id: changed-files
|
||||
uses: tj-actions/changed-files@v40
|
||||
uses: tj-actions/changed-files@v42
|
||||
...
|
||||
```
|
||||
|
||||
</details>
|
||||
|
||||
<details>
|
||||
<summary>Get all changed files without escaping unsafe filename characters</summary>
|
||||
|
||||
```yaml
|
||||
...
|
||||
- name: Get changed files
|
||||
id: changed-files
|
||||
uses: tj-actions/changed-files@v42
|
||||
with:
|
||||
safe_output: false # set to false because we are using an environment variable to store the output and avoid command injection.
|
||||
|
||||
- name: List all added files
|
||||
env:
|
||||
ADDED_FILES: ${{ steps.changed-files.outputs.added_files }}
|
||||
run: |
|
||||
for file in ${ADDED_FILES}; do
|
||||
echo "$file was added"
|
||||
done
|
||||
...
|
||||
```
|
||||
|
||||
@@ -688,7 +760,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@v40
|
||||
uses: tj-actions/changed-files@v42
|
||||
with:
|
||||
separator: ","
|
||||
...
|
||||
@@ -705,11 +777,13 @@ See [inputs](#inputs) for more information.
|
||||
...
|
||||
- name: Get changed files
|
||||
id: changed-files
|
||||
uses: tj-actions/changed-files@v40
|
||||
uses: tj-actions/changed-files@v42
|
||||
|
||||
- name: List all added files
|
||||
env:
|
||||
ADDED_FILES: ${{ steps.changed-files.outputs.added_files }}
|
||||
run: |
|
||||
for file in ${{ steps.changed-files.outputs.added_files }}; do
|
||||
for file in ${ADDED_FILES}; do
|
||||
echo "$file was added"
|
||||
done
|
||||
...
|
||||
@@ -726,7 +800,7 @@ See [outputs](#outputs) for a list of all available outputs.
|
||||
...
|
||||
- name: Get changed files
|
||||
id: changed-files
|
||||
uses: tj-actions/changed-files@v40
|
||||
uses: tj-actions/changed-files@v42
|
||||
|
||||
- name: Run a step if my-file.txt was modified
|
||||
if: contains(steps.changed-files.outputs.modified_files, 'my-file.txt')
|
||||
@@ -747,7 +821,7 @@ See [outputs](#outputs) for a list of all available outputs.
|
||||
|
||||
- name: Get changed files and write the outputs to a Txt file
|
||||
id: changed-files-write-output-files-txt
|
||||
uses: ./
|
||||
uses: tj-actions/changed-files@v42
|
||||
with:
|
||||
write_output_files: true
|
||||
|
||||
@@ -766,7 +840,7 @@ See [outputs](#outputs) for a list of all available outputs.
|
||||
...
|
||||
- name: Get changed files and write the outputs to a JSON file
|
||||
id: changed-files-write-output-files-json
|
||||
uses: ./
|
||||
uses: tj-actions/changed-files@v42
|
||||
with:
|
||||
json: true
|
||||
write_output_files: true
|
||||
@@ -786,7 +860,7 @@ See [outputs](#outputs) for a list of all available outputs.
|
||||
...
|
||||
- name: Get changed files
|
||||
id: changed-files
|
||||
uses: tj-actions/changed-files@v40
|
||||
uses: tj-actions/changed-files@v42
|
||||
with:
|
||||
files: |
|
||||
my-file.txt
|
||||
@@ -809,7 +883,7 @@ See [inputs](#inputs) for more information.
|
||||
...
|
||||
- name: Get changed files
|
||||
id: changed-files-specific
|
||||
uses: tj-actions/changed-files@v40
|
||||
uses: tj-actions/changed-files@v42
|
||||
with:
|
||||
files: |
|
||||
my-file.txt
|
||||
@@ -831,15 +905,19 @@ See [inputs](#inputs) for more information.
|
||||
|
||||
- name: Run step if any of the listed files above is deleted
|
||||
if: steps.changed-files-specific.outputs.any_deleted == 'true'
|
||||
env:
|
||||
DELETED_FILES: ${{ steps.changed-files-specific.outputs.deleted_files }}
|
||||
run: |
|
||||
for file in ${{ steps.changed-files-specific.outputs.deleted_files }}; do
|
||||
for file in ${DELETED_FILES}; do
|
||||
echo "$file was deleted"
|
||||
done
|
||||
|
||||
- name: Run step if all listed files above have been deleted
|
||||
if: steps.changed-files-specific.outputs.only_deleted == 'true'
|
||||
env:
|
||||
DELETED_FILES: ${{ steps.changed-files-specific.outputs.deleted_files }}
|
||||
run: |
|
||||
for file in ${{ steps.changed-files-specific.outputs.deleted_files }}; do
|
||||
for file in ${DELETED_FILES}; do
|
||||
echo "$file was deleted"
|
||||
done
|
||||
...
|
||||
@@ -856,7 +934,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@v40
|
||||
uses: tj-actions/changed-files@v42
|
||||
with:
|
||||
files_from_source_file: test/changed-files-list.txt
|
||||
...
|
||||
@@ -873,7 +951,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@v40
|
||||
uses: tj-actions/changed-files@v42
|
||||
with:
|
||||
files_from_source_file: |
|
||||
test/changed-files-list.txt
|
||||
@@ -894,7 +972,7 @@ See [inputs](#inputs) for more information.
|
||||
...
|
||||
- name: Get changed files using a different SHA
|
||||
id: changed-files
|
||||
uses: tj-actions/changed-files@v40
|
||||
uses: tj-actions/changed-files@v42
|
||||
with:
|
||||
sha: ${{ github.event.pull_request.head.sha }}
|
||||
...
|
||||
@@ -911,7 +989,7 @@ See [inputs](#inputs) for more information.
|
||||
...
|
||||
- name: Get changed files using a different base SHA
|
||||
id: changed-files
|
||||
uses: tj-actions/changed-files@v40
|
||||
uses: tj-actions/changed-files@v42
|
||||
with:
|
||||
base_sha: ${{ github.event.pull_request.base.sha }}
|
||||
...
|
||||
@@ -943,20 +1021,27 @@ jobs:
|
||||
|
||||
- name: Get changed files
|
||||
id: changed-files
|
||||
uses: tj-actions/changed-files@v40
|
||||
uses: tj-actions/changed-files@v42
|
||||
|
||||
- name: List changed files
|
||||
env:
|
||||
ALL_CHANGED_FILES: ${{ steps.changed-files.outputs.all_changed_files }}
|
||||
run: |
|
||||
echo "List all the files that have changed: $ALL_CHANGED_FILES"
|
||||
|
||||
- name: Get changed files in the .github folder
|
||||
id: changed-files-specific
|
||||
uses: tj-actions/changed-files@v40
|
||||
uses: tj-actions/changed-files@v42
|
||||
with:
|
||||
base_sha: ${{ steps.get-base-sha.outputs.base_sha }}
|
||||
files: .github/**
|
||||
|
||||
- name: Run step if any file(s) in the .github folder change
|
||||
if: steps.changed-files-specific.outputs.any_changed == 'true'
|
||||
env:
|
||||
ALL_CHANGED_FILES: ${{ steps.changed-files-specific.outputs.all_changed_files }}
|
||||
run: |
|
||||
echo "One or more files in the .github folder has changed."
|
||||
echo "List all the files that have changed: ${{ steps.changed-files-specific.outputs.all_changed_files }}"
|
||||
echo "List all the files that have changed: $ALL_CHANGED_FILES"
|
||||
...
|
||||
```
|
||||
|
||||
@@ -977,13 +1062,16 @@ See [inputs](#inputs) for more information.
|
||||
|
||||
- name: Run changed-files with defaults in dir1
|
||||
id: changed-files-for-dir1
|
||||
uses: tj-actions/changed-files@v40
|
||||
uses: tj-actions/changed-files@v42
|
||||
with:
|
||||
path: dir1
|
||||
|
||||
- name: List all added files in dir1
|
||||
env:
|
||||
ADDED_FILES: |-
|
||||
${{ steps.changed-files-for-dir1.outputs.added_files }}
|
||||
run: |
|
||||
for file in ${{ steps.changed-files-for-dir1.outputs.added_files }}; do
|
||||
for file in ${ADDED_FILES}; do
|
||||
echo "$file was added"
|
||||
done
|
||||
...
|
||||
@@ -1000,13 +1088,13 @@ See [inputs](#inputs) for more information.
|
||||
...
|
||||
- name: Run changed-files with quotepath disabled
|
||||
id: changed-files-quotepath
|
||||
uses: tj-actions/changed-files@v40
|
||||
uses: tj-actions/changed-files@v42
|
||||
with:
|
||||
quotepath: "false"
|
||||
|
||||
- name: Run changed-files with quotepath disabled for a specified list of file(s)
|
||||
id: changed-files-quotepath-specific
|
||||
uses: ./
|
||||
uses: tj-actions/changed-files@v42
|
||||
with:
|
||||
files: test/test-è.txt
|
||||
quotepath: "false"
|
||||
@@ -1039,7 +1127,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@v40
|
||||
uses: tj-actions/changed-files@v42
|
||||
with:
|
||||
base_sha: ${{ steps.last_successful_commit_push.outputs.base }}
|
||||
...
|
||||
@@ -1066,7 +1154,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@v40
|
||||
uses: tj-actions/changed-files@v42
|
||||
with:
|
||||
base_sha: ${{ steps.last_successful_commit_pull_request.outputs.base }}
|
||||
...
|
||||
@@ -1092,7 +1180,7 @@ See [inputs](#inputs) for more information.
|
||||
...
|
||||
- name: Run changed-files with dir_names
|
||||
id: changed-files-dir-names
|
||||
uses: tj-actions/changed-files@v40
|
||||
uses: tj-actions/changed-files@v42
|
||||
with:
|
||||
dir_names: "true"
|
||||
...
|
||||
@@ -1109,7 +1197,7 @@ See [inputs](#inputs) for more information.
|
||||
...
|
||||
- name: Run changed-files with JSON output
|
||||
id: changed-files-json
|
||||
uses: tj-actions/changed-files@v40
|
||||
uses: tj-actions/changed-files@v42
|
||||
with:
|
||||
json: "true"
|
||||
...
|
||||
@@ -1126,13 +1214,13 @@ See [inputs](#inputs) for more information.
|
||||
...
|
||||
- name: Get changed-files since 2022-08-19
|
||||
id: changed-files-since
|
||||
uses: tj-actions/changed-files@v40
|
||||
uses: tj-actions/changed-files@v42
|
||||
with:
|
||||
since: "2022-08-19"
|
||||
|
||||
- name: Get changed-files until 2022-08-20
|
||||
id: changed-files-until
|
||||
uses: tj-actions/changed-files@v40
|
||||
uses: tj-actions/changed-files@v42
|
||||
with:
|
||||
until: "2022-08-20"
|
||||
...
|
||||
@@ -1152,7 +1240,7 @@ See [inputs](#inputs) for more information.
|
||||
|
||||
* [coder/code-server: uses tj-actions/changed-files to automate detecting changes and run steps based on the outcome](https://github.com/coder/code-server/blob/c32a31d802f679846876b8ad9aacff6cf7b5361d/.github/workflows/build.yaml#L48)
|
||||
|
||||
* [tldr-pages/tldr: uses tj-actions/changed-files to automate detecting spelling errors](https://github.com/tldr-pages/tldr/blob/main/.github/workflows/codespell.yml#L14)
|
||||
* [tldr-pages/tldr: uses tj-actions/changed-files to automate detecting spelling errors](https://github.com/tldr-pages/tldr/blob/c1b714c55cb0048037b79a681a10d7f3ddb0164c/.github/workflows/codespell.yml#L18-L26)
|
||||
|
||||
* [nodejs/docker-node: uses tj-actions/changed-files to generate matrix jobs based on changes detected](https://github.com/nodejs/docker-node/blob/3c4fa6daf06a4786d202f2f610351837806a0380/.github/workflows/build-test.yml#L29)
|
||||
|
||||
@@ -1160,10 +1248,14 @@ See [inputs](#inputs) for more information.
|
||||
|
||||
* [aws-doc-sdk-examples: uses tj-actions/changed-files to automate testing](https://github.com/awsdocs/aws-doc-sdk-examples/blob/2393723ef6b0cad9502f4852f5c72f7be58ca89d/.github/workflows/javascript.yml#L22)
|
||||
|
||||
* [nhost: uses tj-actions/changed-files to automate testing based on changes detected](https://github.com/nhost/nhost/blob/main/.github/workflows/ci.yaml#L44-L48)
|
||||
* [nhost: uses tj-actions/changed-files to automate testing based on changes detected](https://github.com/nhost/nhost/blob/71a8ce444618a8ac4d660518172fba4883c4014b/.github/workflows/ci.yaml#L44-L48)
|
||||
|
||||
* [qmk\_firmware uses tj-actions/changed-files to run linters](https://github.com/qmk/qmk_firmware/blob/7a737235ffd49c32d2c5561e8fe53fd96baa7f96/.github/workflows/lint.yml#L30)
|
||||
|
||||
* [argo-cd uses tj-actions/chnaged-files to detect changed frontend or backend files](https://github.com/argoproj/argo-cd/blob/5bc1850aa1d26301043be9f2fb825d88c80c111c/.github/workflows/ci-build.yaml#L33)
|
||||
|
||||
* [argo-workflows uses tj-actions/changed-files to run specific jobs based on changes detected](https://github.com/argoproj/argo-workflows/blob/baef4856ff2603c76dbe277c825eaa3f9788fc91/.github/workflows/ci-build.yaml#L34)
|
||||
|
||||
And many more...
|
||||
|
||||
### Scalability Example 📈
|
||||
@@ -1172,7 +1264,7 @@ And many more...
|
||||
|
||||
## Important Notice ⚠️
|
||||
|
||||
> **Important** : :bangbang:
|
||||
> \[!IMPORTANT]
|
||||
>
|
||||
> * Spaces in file names can introduce bugs when using bash loops. See: [#216](https://github.com/tj-actions/changed-files/issues/216)
|
||||
> However, this action will handle spaces in file names, with a recommendation of using a separator to prevent any hidden issues.
|
||||
@@ -1259,6 +1351,13 @@ 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/albertoperdomo2"><img src="https://avatars.githubusercontent.com/u/62241095?v=4?s=100" width="100px;" alt="Alberto Perdomo"/><br /><sub><b>Alberto Perdomo</b></sub></a><br /><a href="https://github.com/tj-actions/changed-files/commits?author=albertoperdomo2" title="Documentation">📖</a></td>
|
||||
<td align="center" valign="top" width="14.28%"><a href="https://arthurvolant.com"><img src="https://avatars.githubusercontent.com/u/37664438?v=4?s=100" width="100px;" alt="Arthur"/><br /><sub><b>Arthur</b></sub></a><br /><a href="https://github.com/tj-actions/changed-files/issues?q=author%3AV0lantis" title="Bug reports">🐛</a> <a href="https://github.com/tj-actions/changed-files/commits?author=V0lantis" title="Code">💻</a></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td align="center" valign="top" width="14.28%"><a href="https://github.com/rodrigorfk"><img src="https://avatars.githubusercontent.com/u/1995033?v=4?s=100" width="100px;" alt="Rodrigo Fior Kuntzer"/><br /><sub><b>Rodrigo Fior Kuntzer</b></sub></a><br /><a href="https://github.com/tj-actions/changed-files/commits?author=rodrigorfk" title="Code">💻</a> <a href="https://github.com/tj-actions/changed-files/commits?author=rodrigorfk" title="Tests">⚠️</a> <a href="https://github.com/tj-actions/changed-files/issues?q=author%3Arodrigorfk" title="Bug reports">🐛</a></td>
|
||||
<td align="center" valign="top" width="14.28%"><a href="https://github.com/levenleven"><img src="https://avatars.githubusercontent.com/u/6463364?v=4?s=100" width="100px;" alt="Aleksey Levenstein"/><br /><sub><b>Aleksey Levenstein</b></sub></a><br /><a href="https://github.com/tj-actions/changed-files/commits?author=levenleven" title="Documentation">📖</a></td>
|
||||
<td align="center" valign="top" width="14.28%"><a href="https://github.com/dan-hill2802"><img src="https://avatars.githubusercontent.com/u/5046322?v=4?s=100" width="100px;" alt="Daniel Hill"/><br /><sub><b>Daniel Hill</b></sub></a><br /><a href="https://github.com/tj-actions/changed-files/commits?author=dan-hill2802" title="Documentation">📖</a></td>
|
||||
<td align="center" valign="top" width="14.28%"><a href="https://keisukeyamashita.com"><img src="https://avatars.githubusercontent.com/u/23056537?v=4?s=100" width="100px;" alt="KeisukeYamashita"/><br /><sub><b>KeisukeYamashita</b></sub></a><br /><a href="https://github.com/tj-actions/changed-files/commits?author=KeisukeYamashita" title="Documentation">📖</a></td>
|
||||
<td align="center" valign="top" width="14.28%"><a href="https://github.com/codesculpture"><img src="https://avatars.githubusercontent.com/u/63452117?v=4?s=100" width="100px;" alt="Aravind"/><br /><sub><b>Aravind</b></sub></a><br /><a href="https://github.com/tj-actions/changed-files/commits?author=codesculpture" title="Code">💻</a> <a href="https://github.com/tj-actions/changed-files/issues?q=author%3Acodesculpture" title="Bug reports">🐛</a></td>
|
||||
</tr>
|
||||
</tbody>
|
||||
</table>
|
||||
|
||||
|
||||
32
SECURITY.md
Normal file
32
SECURITY.md
Normal file
@@ -0,0 +1,32 @@
|
||||
# Security Policy
|
||||
|
||||
## Proactive Security Measures
|
||||
|
||||
To proactively detect and address security vulnerabilities, we utilize several robust tools and processes:
|
||||
|
||||
- **Dependency Updates:** We use [Renovate](https://renovatebot.com) and [Dependabot](https://docs.github.com/en/code-security/dependabot/dependabot-security-updates/about-dependabot-security-updates) to keep our dependencies updated and promptly patch detected vulnerabilities through automated PRs.
|
||||
- **[GitHub's Security Features](https://github.com/features/security):** Our repository and dependencies are continuously monitored via GitHub's security features, which include:
|
||||
- **Code Scanning:** Using GitHub's CodeQL, all pull requests are scanned to identify potential vulnerabilities in our source code.
|
||||
- **Automated Alerts:** Dependabot identifies vulnerabilities based on the GitHub Advisory Database and opens PRs with patches, while automated [secret scanning](https://docs.github.com/en/enterprise-cloud@latest/code-security/secret-scanning/about-secret-scanning#about-secret-scanning-for-partner-patterns) provides alerts for detected secrets.
|
||||
- **[GitGuardian Security Checks](https://www.gitguardian.com/):** We employ GitGuardian to ensure security checks are performed on the codebase, enhancing the overall security of our project.
|
||||
- **Code Analysis and Security Scanning:** With the help of [Codacy Static Code Analysis](https://www.codacy.com/) and [Codacy Security Scan](https://security.codacy.com/), we conduct thorough analyses and scans of our code for potential security risks.
|
||||
|
||||
## Reporting Security Vulnerabilities
|
||||
|
||||
Despite our best efforts to deliver secure software, we acknowledge the invaluable role of the community in identifying security breaches.
|
||||
|
||||
### Private Vulnerability Disclosures
|
||||
|
||||
We request all suspected vulnerabilities to be responsibly and privately disclosed by sending an email to [support@tj-actions.online](mailto:support@tj-actions.online).
|
||||
|
||||
### Public Vulnerability Disclosures
|
||||
|
||||
For publicly disclosed security vulnerabilities, please **IMMEDIATELY** email [support@tj-actions.online](mailto:support@tj-actions.online) with the details for prompt action.
|
||||
|
||||
Upon confirmation of a breach, reporters will receive full credit and recognition for their contribution. Please note, that we do not offer monetary compensation for reporting vulnerabilities.
|
||||
|
||||
## Communication of Security Breaches
|
||||
|
||||
We will utilize the [GitHub Security Advisory](https://github.com/tj-actions/changed-files/security/advisories) to communicate any security breaches. The advisory will be made public once a patch has been released to rectify the issue.
|
||||
|
||||
We appreciate your cooperation and contribution to maintaining the security of our software. Remember, a secure community is a strong community.
|
||||
22
action.yml
22
action.yml
@@ -127,21 +127,25 @@ inputs:
|
||||
required: false
|
||||
default: "false"
|
||||
json:
|
||||
description: "Output list of changed files in a JSON formatted string which can be used for matrix jobs. Example: https://github.com/tj-actions/changed-files/blob/main/.github/workflows/matrix-test.yml"
|
||||
description: "Output list of changed files in a JSON formatted string which can be used for matrix jobs. Example: https://github.com/tj-actions/changed-files/blob/main/.github/workflows/matrix-example.yml"
|
||||
required: false
|
||||
default: "false"
|
||||
escape_json:
|
||||
description: "Escape JSON output."
|
||||
required: false
|
||||
default: "true"
|
||||
safe_output:
|
||||
description: "Apply sanitization to output filenames before being set as output."
|
||||
required: false
|
||||
default: "true"
|
||||
fetch_depth:
|
||||
description: "Depth of additional branch history fetched. NOTE: This can be adjusted to resolve errors with insufficient history."
|
||||
required: false
|
||||
default: "50"
|
||||
skip_initial_fetch:
|
||||
description: |
|
||||
Skip the initial fetch to improve performance for shallow repositories.
|
||||
NOTE: This could lead to errors with missing history and the intended use is limited to when you've fetched the history necessary to perform the diff.
|
||||
Skip initially fetching additional history to improve performance for shallow repositories.
|
||||
NOTE: This could lead to errors with missing history. It's intended to be used when you've fetched all necessary history to perform the diff.
|
||||
required: false
|
||||
default: "false"
|
||||
fetch_additional_submodule_history:
|
||||
@@ -199,6 +203,10 @@ inputs:
|
||||
description: "Github API URL."
|
||||
required: false
|
||||
default: ${{ github.api_url }}
|
||||
use_rest_api:
|
||||
description: "Force the use of Github's REST API even when a local copy of the repository exists"
|
||||
required: false
|
||||
default: "false"
|
||||
fail_on_initial_diff_error:
|
||||
description: "Fail when the initial diff fails."
|
||||
required: false
|
||||
@@ -211,6 +219,10 @@ inputs:
|
||||
description: "Apply the negation patterns first. NOTE: This affects how changed files are matched."
|
||||
required: false
|
||||
default: "false"
|
||||
matrix:
|
||||
description: "Output changed files in a format that can be used for matrix jobs. Alias for setting inputs `json` to `true` and `escape_json` to `false`."
|
||||
required: false
|
||||
default: "false"
|
||||
|
||||
outputs:
|
||||
added_files:
|
||||
@@ -258,9 +270,9 @@ 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. *includes 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 have 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. *includes 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 have 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. *includes a combination of all added, copied, modified and renamed files (ACMR)*."
|
||||
other_changed_files_count:
|
||||
|
||||
845
dist/index.js
generated
vendored
845
dist/index.js
generated
vendored
File diff suppressed because it is too large
Load Diff
2
dist/index.js.map
generated
vendored
2
dist/index.js.map
generated
vendored
File diff suppressed because one or more lines are too long
@@ -10,4 +10,4 @@ module.exports = {
|
||||
setupFiles: [
|
||||
"<rootDir>/jest/setupEnv.cjs"
|
||||
]
|
||||
}
|
||||
};
|
||||
|
||||
14
package.json
14
package.json
@@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "@tj-actions/changed-files",
|
||||
"version": "40.1.1",
|
||||
"version": "42.0.7",
|
||||
"description": "Github action to retrieve all (added, copied, modified, deleted, renamed, type changed, unmerged, unknown) files and directories.",
|
||||
"main": "lib/main.js",
|
||||
"publishConfig": {
|
||||
@@ -8,10 +8,10 @@
|
||||
},
|
||||
"scripts": {
|
||||
"build": "tsc",
|
||||
"format": "prettier --write **/*.ts",
|
||||
"format-check": "prettier --check **/*.ts",
|
||||
"lint": "eslint **/*.ts --max-warnings 0",
|
||||
"lint:fix": "eslint --fix src/**/*.ts",
|
||||
"format": "prettier --write src/*.ts src/**/*.ts",
|
||||
"format-check": "prettier --check src/*.ts src/**/*.ts",
|
||||
"lint": "eslint src/*.ts src/**/*.ts --max-warnings 0",
|
||||
"lint:fix": "eslint --fix src/*.ts src/**/*.ts",
|
||||
"package": "ncc build lib/main.js --source-map --license licenses.txt",
|
||||
"test": "jest --coverage",
|
||||
"all": "yarn build && yarn format && yarn lint && yarn package && yarn test"
|
||||
@@ -46,8 +46,8 @@
|
||||
"@types/micromatch": "^4.0.2",
|
||||
"@types/node": "^20.3.2",
|
||||
"@types/uuid": "^9.0.2",
|
||||
"@typescript-eslint/eslint-plugin": "^6.0.0",
|
||||
"@typescript-eslint/parser": "^6.0.0",
|
||||
"@typescript-eslint/eslint-plugin": "^7.0.0",
|
||||
"@typescript-eslint/parser": "^7.0.0",
|
||||
"@vercel/ncc": "^0.38.0",
|
||||
"eslint": "^8.43.0",
|
||||
"eslint-plugin-github": "^4.8.0",
|
||||
|
||||
343
src/__tests__/__snapshots__/inputs.test.ts.snap
Normal file
343
src/__tests__/__snapshots__/inputs.test.ts.snap
Normal file
@@ -0,0 +1,343 @@
|
||||
// Jest Snapshot v1, https://goo.gl/fbAQLP
|
||||
|
||||
exports[`getInputs should correctly parse boolean inputs 1`] = `
|
||||
{
|
||||
"apiUrl": undefined,
|
||||
"baseSha": undefined,
|
||||
"diffRelative": "false",
|
||||
"dirNames": "false",
|
||||
"dirNamesDeletedFilesIncludeOnlyDeletedDirs": "false",
|
||||
"dirNamesExcludeCurrentDir": "false",
|
||||
"dirNamesIncludeFiles": undefined,
|
||||
"dirNamesIncludeFilesSeparator": undefined,
|
||||
"escapeJson": false,
|
||||
"failOnInitialDiffError": "false",
|
||||
"failOnSubmoduleDiffError": "false",
|
||||
"fetchAdditionalSubmoduleHistory": "false",
|
||||
"files": undefined,
|
||||
"filesFromSourceFile": undefined,
|
||||
"filesFromSourceFileSeparator": undefined,
|
||||
"filesIgnore": undefined,
|
||||
"filesIgnoreFromSourceFile": undefined,
|
||||
"filesIgnoreFromSourceFileSeparator": undefined,
|
||||
"filesIgnoreSeparator": undefined,
|
||||
"filesIgnoreYaml": undefined,
|
||||
"filesIgnoreYamlFromSourceFile": undefined,
|
||||
"filesIgnoreYamlFromSourceFileSeparator": undefined,
|
||||
"filesSeparator": undefined,
|
||||
"filesYaml": undefined,
|
||||
"filesYamlFromSourceFile": undefined,
|
||||
"filesYamlFromSourceFileSeparator": undefined,
|
||||
"includeAllOldNewRenamedFiles": "false",
|
||||
"json": true,
|
||||
"negationPatternsFirst": "false",
|
||||
"oldNewFilesSeparator": undefined,
|
||||
"oldNewSeparator": undefined,
|
||||
"outputDir": undefined,
|
||||
"outputRenamedFilesAsDeletedAndAdded": "false",
|
||||
"path": undefined,
|
||||
"quotepath": "false",
|
||||
"recoverDeletedFiles": "false",
|
||||
"recoverDeletedFilesToDestination": undefined,
|
||||
"recoverFiles": undefined,
|
||||
"recoverFilesIgnore": undefined,
|
||||
"recoverFilesIgnoreSeparator": undefined,
|
||||
"recoverFilesSeparator": undefined,
|
||||
"safeOutput": "false",
|
||||
"separator": undefined,
|
||||
"sha": undefined,
|
||||
"since": undefined,
|
||||
"sinceLastRemoteCommit": "false",
|
||||
"skipInitialFetch": "true",
|
||||
"token": undefined,
|
||||
"until": undefined,
|
||||
"useRestApi": "false",
|
||||
"writeOutputFiles": "false",
|
||||
}
|
||||
`;
|
||||
|
||||
exports[`getInputs should correctly parse numeric inputs 1`] = `
|
||||
{
|
||||
"apiUrl": "",
|
||||
"baseSha": "",
|
||||
"diffRelative": true,
|
||||
"dirNames": false,
|
||||
"dirNamesDeletedFilesIncludeOnlyDeletedDirs": false,
|
||||
"dirNamesExcludeCurrentDir": false,
|
||||
"dirNamesIncludeFiles": "",
|
||||
"dirNamesIncludeFilesSeparator": "",
|
||||
"dirNamesMaxDepth": 2,
|
||||
"escapeJson": false,
|
||||
"failOnInitialDiffError": false,
|
||||
"failOnSubmoduleDiffError": false,
|
||||
"fetchAdditionalSubmoduleHistory": false,
|
||||
"fetchDepth": 5,
|
||||
"files": "",
|
||||
"filesFromSourceFile": "",
|
||||
"filesFromSourceFileSeparator": "",
|
||||
"filesIgnore": "",
|
||||
"filesIgnoreFromSourceFile": "",
|
||||
"filesIgnoreFromSourceFileSeparator": "",
|
||||
"filesIgnoreSeparator": "",
|
||||
"filesIgnoreYaml": "",
|
||||
"filesIgnoreYamlFromSourceFile": "",
|
||||
"filesIgnoreYamlFromSourceFileSeparator": "",
|
||||
"filesSeparator": "",
|
||||
"filesYaml": "",
|
||||
"filesYamlFromSourceFile": "",
|
||||
"filesYamlFromSourceFileSeparator": "",
|
||||
"includeAllOldNewRenamedFiles": false,
|
||||
"json": false,
|
||||
"negationPatternsFirst": false,
|
||||
"oldNewFilesSeparator": "",
|
||||
"oldNewSeparator": "",
|
||||
"outputDir": "",
|
||||
"outputRenamedFilesAsDeletedAndAdded": false,
|
||||
"path": "",
|
||||
"quotepath": true,
|
||||
"recoverDeletedFiles": false,
|
||||
"recoverDeletedFilesToDestination": "",
|
||||
"recoverFiles": "",
|
||||
"recoverFilesIgnore": "",
|
||||
"recoverFilesIgnoreSeparator": "",
|
||||
"recoverFilesSeparator": "",
|
||||
"safeOutput": false,
|
||||
"separator": "",
|
||||
"sha": "",
|
||||
"since": "",
|
||||
"sinceLastRemoteCommit": false,
|
||||
"skipInitialFetch": false,
|
||||
"token": "",
|
||||
"until": "",
|
||||
"useRestApi": false,
|
||||
"writeOutputFiles": false,
|
||||
}
|
||||
`;
|
||||
|
||||
exports[`getInputs should correctly parse string inputs 1`] = `
|
||||
{
|
||||
"apiUrl": "https://api.github.com",
|
||||
"baseSha": "",
|
||||
"diffRelative": true,
|
||||
"dirNames": false,
|
||||
"dirNamesDeletedFilesIncludeOnlyDeletedDirs": false,
|
||||
"dirNamesExcludeCurrentDir": false,
|
||||
"dirNamesIncludeFiles": "",
|
||||
"dirNamesIncludeFilesSeparator": "",
|
||||
"escapeJson": false,
|
||||
"failOnInitialDiffError": false,
|
||||
"failOnSubmoduleDiffError": false,
|
||||
"fetchAdditionalSubmoduleHistory": false,
|
||||
"files": "",
|
||||
"filesFromSourceFile": "",
|
||||
"filesFromSourceFileSeparator": "",
|
||||
"filesIgnore": "",
|
||||
"filesIgnoreFromSourceFile": "",
|
||||
"filesIgnoreFromSourceFileSeparator": "",
|
||||
"filesIgnoreSeparator": "",
|
||||
"filesIgnoreYaml": "",
|
||||
"filesIgnoreYamlFromSourceFile": "",
|
||||
"filesIgnoreYamlFromSourceFileSeparator": "",
|
||||
"filesSeparator": "",
|
||||
"filesYaml": "",
|
||||
"filesYamlFromSourceFile": "",
|
||||
"filesYamlFromSourceFileSeparator": "",
|
||||
"includeAllOldNewRenamedFiles": false,
|
||||
"json": false,
|
||||
"negationPatternsFirst": false,
|
||||
"oldNewFilesSeparator": "",
|
||||
"oldNewSeparator": "",
|
||||
"outputDir": "",
|
||||
"outputRenamedFilesAsDeletedAndAdded": false,
|
||||
"path": "",
|
||||
"quotepath": true,
|
||||
"recoverDeletedFiles": false,
|
||||
"recoverDeletedFilesToDestination": "",
|
||||
"recoverFiles": "",
|
||||
"recoverFilesIgnore": "",
|
||||
"recoverFilesIgnoreSeparator": "",
|
||||
"recoverFilesSeparator": "",
|
||||
"safeOutput": false,
|
||||
"separator": "",
|
||||
"sha": "",
|
||||
"since": "",
|
||||
"sinceLastRemoteCommit": false,
|
||||
"skipInitialFetch": false,
|
||||
"token": "token",
|
||||
"until": "",
|
||||
"useRestApi": false,
|
||||
"writeOutputFiles": false,
|
||||
}
|
||||
`;
|
||||
|
||||
exports[`getInputs should handle invalid numeric inputs correctly 1`] = `
|
||||
{
|
||||
"apiUrl": "",
|
||||
"baseSha": "",
|
||||
"diffRelative": true,
|
||||
"dirNames": false,
|
||||
"dirNamesDeletedFilesIncludeOnlyDeletedDirs": false,
|
||||
"dirNamesExcludeCurrentDir": false,
|
||||
"dirNamesIncludeFiles": "",
|
||||
"dirNamesIncludeFilesSeparator": "",
|
||||
"dirNamesMaxDepth": 2,
|
||||
"escapeJson": false,
|
||||
"failOnInitialDiffError": false,
|
||||
"failOnSubmoduleDiffError": false,
|
||||
"fetchAdditionalSubmoduleHistory": false,
|
||||
"fetchDepth": NaN,
|
||||
"files": "",
|
||||
"filesFromSourceFile": "",
|
||||
"filesFromSourceFileSeparator": "",
|
||||
"filesIgnore": "",
|
||||
"filesIgnoreFromSourceFile": "",
|
||||
"filesIgnoreFromSourceFileSeparator": "",
|
||||
"filesIgnoreSeparator": "",
|
||||
"filesIgnoreYaml": "",
|
||||
"filesIgnoreYamlFromSourceFile": "",
|
||||
"filesIgnoreYamlFromSourceFileSeparator": "",
|
||||
"filesSeparator": "",
|
||||
"filesYaml": "",
|
||||
"filesYamlFromSourceFile": "",
|
||||
"filesYamlFromSourceFileSeparator": "",
|
||||
"includeAllOldNewRenamedFiles": false,
|
||||
"json": false,
|
||||
"negationPatternsFirst": false,
|
||||
"oldNewFilesSeparator": "",
|
||||
"oldNewSeparator": "",
|
||||
"outputDir": "",
|
||||
"outputRenamedFilesAsDeletedAndAdded": false,
|
||||
"path": "",
|
||||
"quotepath": true,
|
||||
"recoverDeletedFiles": false,
|
||||
"recoverDeletedFilesToDestination": "",
|
||||
"recoverFiles": "",
|
||||
"recoverFilesIgnore": "",
|
||||
"recoverFilesIgnoreSeparator": "",
|
||||
"recoverFilesSeparator": "",
|
||||
"safeOutput": false,
|
||||
"separator": "",
|
||||
"sha": "",
|
||||
"since": "",
|
||||
"sinceLastRemoteCommit": false,
|
||||
"skipInitialFetch": false,
|
||||
"token": "",
|
||||
"until": "",
|
||||
"useRestApi": false,
|
||||
"writeOutputFiles": false,
|
||||
}
|
||||
`;
|
||||
|
||||
exports[`getInputs should handle negative numeric inputs correctly 1`] = `
|
||||
{
|
||||
"apiUrl": "",
|
||||
"baseSha": "",
|
||||
"diffRelative": true,
|
||||
"dirNames": false,
|
||||
"dirNamesDeletedFilesIncludeOnlyDeletedDirs": false,
|
||||
"dirNamesExcludeCurrentDir": false,
|
||||
"dirNamesIncludeFiles": "",
|
||||
"dirNamesIncludeFilesSeparator": "",
|
||||
"dirNamesMaxDepth": -2,
|
||||
"escapeJson": false,
|
||||
"failOnInitialDiffError": false,
|
||||
"failOnSubmoduleDiffError": false,
|
||||
"fetchAdditionalSubmoduleHistory": false,
|
||||
"fetchDepth": 2,
|
||||
"files": "",
|
||||
"filesFromSourceFile": "",
|
||||
"filesFromSourceFileSeparator": "",
|
||||
"filesIgnore": "",
|
||||
"filesIgnoreFromSourceFile": "",
|
||||
"filesIgnoreFromSourceFileSeparator": "",
|
||||
"filesIgnoreSeparator": "",
|
||||
"filesIgnoreYaml": "",
|
||||
"filesIgnoreYamlFromSourceFile": "",
|
||||
"filesIgnoreYamlFromSourceFileSeparator": "",
|
||||
"filesSeparator": "",
|
||||
"filesYaml": "",
|
||||
"filesYamlFromSourceFile": "",
|
||||
"filesYamlFromSourceFileSeparator": "",
|
||||
"includeAllOldNewRenamedFiles": false,
|
||||
"json": false,
|
||||
"negationPatternsFirst": false,
|
||||
"oldNewFilesSeparator": "",
|
||||
"oldNewSeparator": "",
|
||||
"outputDir": "",
|
||||
"outputRenamedFilesAsDeletedAndAdded": false,
|
||||
"path": "",
|
||||
"quotepath": true,
|
||||
"recoverDeletedFiles": false,
|
||||
"recoverDeletedFilesToDestination": "",
|
||||
"recoverFiles": "",
|
||||
"recoverFilesIgnore": "",
|
||||
"recoverFilesIgnoreSeparator": "",
|
||||
"recoverFilesSeparator": "",
|
||||
"safeOutput": false,
|
||||
"separator": "",
|
||||
"sha": "",
|
||||
"since": "",
|
||||
"sinceLastRemoteCommit": false,
|
||||
"skipInitialFetch": false,
|
||||
"token": "",
|
||||
"until": "",
|
||||
"useRestApi": false,
|
||||
"writeOutputFiles": false,
|
||||
}
|
||||
`;
|
||||
|
||||
exports[`getInputs should return default values when no inputs are provided 1`] = `
|
||||
{
|
||||
"apiUrl": undefined,
|
||||
"baseSha": undefined,
|
||||
"diffRelative": true,
|
||||
"dirNames": false,
|
||||
"dirNamesDeletedFilesIncludeOnlyDeletedDirs": false,
|
||||
"dirNamesExcludeCurrentDir": false,
|
||||
"dirNamesIncludeFiles": undefined,
|
||||
"dirNamesIncludeFilesSeparator": undefined,
|
||||
"escapeJson": false,
|
||||
"failOnInitialDiffError": false,
|
||||
"failOnSubmoduleDiffError": false,
|
||||
"fetchAdditionalSubmoduleHistory": false,
|
||||
"files": undefined,
|
||||
"filesFromSourceFile": undefined,
|
||||
"filesFromSourceFileSeparator": undefined,
|
||||
"filesIgnore": undefined,
|
||||
"filesIgnoreFromSourceFile": undefined,
|
||||
"filesIgnoreFromSourceFileSeparator": undefined,
|
||||
"filesIgnoreSeparator": undefined,
|
||||
"filesIgnoreYaml": undefined,
|
||||
"filesIgnoreYamlFromSourceFile": undefined,
|
||||
"filesIgnoreYamlFromSourceFileSeparator": undefined,
|
||||
"filesSeparator": undefined,
|
||||
"filesYaml": undefined,
|
||||
"filesYamlFromSourceFile": undefined,
|
||||
"filesYamlFromSourceFileSeparator": undefined,
|
||||
"includeAllOldNewRenamedFiles": false,
|
||||
"json": false,
|
||||
"negationPatternsFirst": false,
|
||||
"oldNewFilesSeparator": undefined,
|
||||
"oldNewSeparator": undefined,
|
||||
"outputDir": undefined,
|
||||
"outputRenamedFilesAsDeletedAndAdded": false,
|
||||
"path": undefined,
|
||||
"quotepath": true,
|
||||
"recoverDeletedFiles": false,
|
||||
"recoverDeletedFilesToDestination": undefined,
|
||||
"recoverFiles": undefined,
|
||||
"recoverFilesIgnore": undefined,
|
||||
"recoverFilesIgnoreSeparator": undefined,
|
||||
"recoverFilesSeparator": undefined,
|
||||
"safeOutput": false,
|
||||
"separator": undefined,
|
||||
"sha": undefined,
|
||||
"since": undefined,
|
||||
"sinceLastRemoteCommit": false,
|
||||
"skipInitialFetch": false,
|
||||
"token": undefined,
|
||||
"until": undefined,
|
||||
"useRestApi": false,
|
||||
"writeOutputFiles": false,
|
||||
}
|
||||
`;
|
||||
153
src/__tests__/inputs.test.ts
Normal file
153
src/__tests__/inputs.test.ts
Normal file
@@ -0,0 +1,153 @@
|
||||
import * as core from '@actions/core'
|
||||
import {getInputs, Inputs} from '../inputs'
|
||||
import {DEFAULT_VALUES_OF_UNSUPPORTED_API_INPUTS} from '../constant'
|
||||
|
||||
jest.mock('@actions/core')
|
||||
|
||||
describe('getInputs', () => {
|
||||
afterEach(() => {
|
||||
jest.clearAllMocks()
|
||||
})
|
||||
|
||||
test('should return default values when no inputs are provided', () => {
|
||||
;(core.getBooleanInput as jest.Mock).mockImplementation(name => {
|
||||
const camelCaseName = name.replace(/_([a-z])/g, (g: string[]) => {
|
||||
return g[1].toUpperCase()
|
||||
}) as keyof Inputs
|
||||
|
||||
return (DEFAULT_VALUES_OF_UNSUPPORTED_API_INPUTS[camelCaseName] ||
|
||||
'') as string
|
||||
})
|
||||
;(core.getBooleanInput as jest.Mock).mockImplementation(name => {
|
||||
const camelCaseName = name.replace(/_([a-z])/g, (g: string[]) => {
|
||||
return g[1].toUpperCase()
|
||||
}) as keyof Inputs
|
||||
|
||||
return (DEFAULT_VALUES_OF_UNSUPPORTED_API_INPUTS[camelCaseName] ||
|
||||
false) as boolean
|
||||
})
|
||||
expect(getInputs()).toMatchSnapshot()
|
||||
})
|
||||
|
||||
test('should correctly parse boolean inputs', () => {
|
||||
;(core.getBooleanInput as jest.Mock).mockImplementation(name => {
|
||||
const camelCaseName = name.replace(/_([a-z])/g, (g: string[]) => {
|
||||
return g[1].toUpperCase()
|
||||
}) as keyof Inputs
|
||||
|
||||
return (DEFAULT_VALUES_OF_UNSUPPORTED_API_INPUTS[camelCaseName] ||
|
||||
'') as string
|
||||
})
|
||||
;(core.getBooleanInput as jest.Mock).mockImplementation(name => {
|
||||
switch (name) {
|
||||
case 'matrix':
|
||||
return 'true'
|
||||
case 'skip_initial_fetch':
|
||||
return 'true'
|
||||
default:
|
||||
return 'false'
|
||||
}
|
||||
})
|
||||
expect(getInputs()).toMatchSnapshot()
|
||||
})
|
||||
|
||||
test('should handle matrix alias correctly', () => {
|
||||
;(core.getBooleanInput as jest.Mock).mockImplementation(name => {
|
||||
return name === 'matrix' ? 'true' : 'false'
|
||||
})
|
||||
|
||||
const inputs = getInputs()
|
||||
expect(inputs).toHaveProperty('json', true)
|
||||
expect(inputs).toHaveProperty('escapeJson', false)
|
||||
})
|
||||
|
||||
test('should correctly parse string inputs', () => {
|
||||
;(core.getInput as jest.Mock).mockImplementation(name => {
|
||||
switch (name) {
|
||||
case 'token':
|
||||
return 'token'
|
||||
case 'api_url':
|
||||
return 'https://api.github.com'
|
||||
default:
|
||||
return ''
|
||||
}
|
||||
})
|
||||
;(core.getBooleanInput as jest.Mock).mockImplementation(name => {
|
||||
const camelCaseName = name.replace(/_([a-z])/g, (g: string[]) => {
|
||||
return g[1].toUpperCase()
|
||||
}) as keyof Inputs
|
||||
|
||||
return (DEFAULT_VALUES_OF_UNSUPPORTED_API_INPUTS[camelCaseName] ||
|
||||
false) as boolean
|
||||
})
|
||||
expect(getInputs()).toMatchSnapshot()
|
||||
})
|
||||
|
||||
test('should correctly parse numeric inputs', () => {
|
||||
;(core.getInput as jest.Mock).mockImplementation(name => {
|
||||
switch (name) {
|
||||
case 'fetch_depth':
|
||||
return '5'
|
||||
case 'dir_names_max_depth':
|
||||
return '2'
|
||||
default:
|
||||
return ''
|
||||
}
|
||||
})
|
||||
;(core.getBooleanInput as jest.Mock).mockImplementation(name => {
|
||||
const camelCaseName = name.replace(/_([a-z])/g, (g: string[]) => {
|
||||
return g[1].toUpperCase()
|
||||
}) as keyof Inputs
|
||||
|
||||
return (DEFAULT_VALUES_OF_UNSUPPORTED_API_INPUTS[camelCaseName] ||
|
||||
false) as boolean
|
||||
})
|
||||
expect(getInputs()).toMatchSnapshot()
|
||||
})
|
||||
|
||||
test('should handle invalid numeric inputs correctly', () => {
|
||||
;(core.getInput as jest.Mock).mockImplementation(name => {
|
||||
// TODO: Add validation for invalid numbers which should result in an error instead of NaN
|
||||
switch (name) {
|
||||
case 'fetch_depth':
|
||||
return 'invalid'
|
||||
case 'dir_names_max_depth':
|
||||
return '2'
|
||||
default:
|
||||
return ''
|
||||
}
|
||||
})
|
||||
;(core.getBooleanInput as jest.Mock).mockImplementation(name => {
|
||||
const camelCaseName = name.replace(/_([a-z])/g, (g: string[]) => {
|
||||
return g[1].toUpperCase()
|
||||
}) as keyof Inputs
|
||||
|
||||
return (DEFAULT_VALUES_OF_UNSUPPORTED_API_INPUTS[camelCaseName] ||
|
||||
false) as boolean
|
||||
})
|
||||
expect(getInputs()).toMatchSnapshot()
|
||||
})
|
||||
|
||||
test('should handle negative numeric inputs correctly', () => {
|
||||
;(core.getInput as jest.Mock).mockImplementation(name => {
|
||||
// TODO: Add validation for negative numbers which should result in an error
|
||||
switch (name) {
|
||||
case 'fetch_depth':
|
||||
return '-5'
|
||||
case 'dir_names_max_depth':
|
||||
return '-2'
|
||||
default:
|
||||
return ''
|
||||
}
|
||||
})
|
||||
;(core.getBooleanInput as jest.Mock).mockImplementation(name => {
|
||||
const camelCaseName = name.replace(/_([a-z])/g, (g: string[]) => {
|
||||
return g[1].toUpperCase()
|
||||
}) as keyof Inputs
|
||||
|
||||
return (DEFAULT_VALUES_OF_UNSUPPORTED_API_INPUTS[camelCaseName] ||
|
||||
false) as boolean
|
||||
})
|
||||
expect(getInputs()).toMatchSnapshot()
|
||||
})
|
||||
})
|
||||
@@ -1,9 +1,12 @@
|
||||
import * as core from '@actions/core'
|
||||
import {ChangeTypeEnum} from '../changedFiles'
|
||||
import {Inputs} from '../inputs'
|
||||
import {
|
||||
getDirname,
|
||||
getDirnameMaxDepth,
|
||||
getFilteredChangedFiles,
|
||||
normalizeSeparators
|
||||
normalizeSeparators,
|
||||
warnUnsupportedRESTAPIInputs
|
||||
} from '../utils'
|
||||
|
||||
const originalPlatform = process.platform
|
||||
@@ -575,4 +578,77 @@ describe('utils test', () => {
|
||||
expect(filteredFiles[ChangeTypeEnum.Modified]).toEqual([])
|
||||
})
|
||||
})
|
||||
|
||||
describe('warnUnsupportedRESTAPIInputs', () => {
|
||||
// Warns about unsupported inputs when using the REST API.
|
||||
it('should warn about unsupported inputs when all inputs are supported', async () => {
|
||||
const inputs: Inputs = {
|
||||
files: '',
|
||||
filesSeparator: '\n',
|
||||
filesFromSourceFile: '',
|
||||
filesFromSourceFileSeparator: '\n',
|
||||
filesYaml: '',
|
||||
filesYamlFromSourceFile: '',
|
||||
filesYamlFromSourceFileSeparator: '\n',
|
||||
filesIgnore: '',
|
||||
filesIgnoreSeparator: '\n',
|
||||
filesIgnoreFromSourceFile: '',
|
||||
filesIgnoreFromSourceFileSeparator: '\n',
|
||||
filesIgnoreYaml: '',
|
||||
filesIgnoreYamlFromSourceFile: '',
|
||||
filesIgnoreYamlFromSourceFileSeparator: '\n',
|
||||
separator: ' ',
|
||||
includeAllOldNewRenamedFiles: false,
|
||||
oldNewSeparator: ',',
|
||||
oldNewFilesSeparator: ' ',
|
||||
sha: '1313123',
|
||||
baseSha: '',
|
||||
since: '',
|
||||
until: '',
|
||||
path: '.',
|
||||
quotepath: true,
|
||||
diffRelative: true,
|
||||
dirNames: false,
|
||||
dirNamesMaxDepth: undefined,
|
||||
dirNamesExcludeCurrentDir: false,
|
||||
dirNamesIncludeFiles: '',
|
||||
dirNamesIncludeFilesSeparator: '\n',
|
||||
dirNamesDeletedFilesIncludeOnlyDeletedDirs: false,
|
||||
json: false,
|
||||
escapeJson: true,
|
||||
safeOutput: true,
|
||||
fetchDepth: 50,
|
||||
fetchAdditionalSubmoduleHistory: false,
|
||||
sinceLastRemoteCommit: false,
|
||||
writeOutputFiles: false,
|
||||
outputDir: '.github/outputs',
|
||||
outputRenamedFilesAsDeletedAndAdded: false,
|
||||
recoverDeletedFiles: false,
|
||||
recoverDeletedFilesToDestination: '',
|
||||
recoverFiles: '',
|
||||
recoverFilesSeparator: '\n',
|
||||
recoverFilesIgnore: '',
|
||||
recoverFilesIgnoreSeparator: '\n',
|
||||
token: '${{ github.token }}',
|
||||
apiUrl: '${{ github.api_url }}',
|
||||
skipInitialFetch: false,
|
||||
failOnInitialDiffError: false,
|
||||
failOnSubmoduleDiffError: false,
|
||||
negationPatternsFirst: false,
|
||||
useRestApi: false
|
||||
}
|
||||
|
||||
const coreWarningSpy = jest.spyOn(core, 'warning')
|
||||
|
||||
await warnUnsupportedRESTAPIInputs({
|
||||
inputs
|
||||
})
|
||||
|
||||
expect(coreWarningSpy).toHaveBeenCalledWith(
|
||||
'Input "sha" is not supported when using GitHub\'s REST API to get changed files'
|
||||
)
|
||||
|
||||
expect(coreWarningSpy).toHaveBeenCalledTimes(1)
|
||||
})
|
||||
})
|
||||
})
|
||||
|
||||
@@ -166,7 +166,7 @@ export const getRenamedFiles = async ({
|
||||
}))
|
||||
) {
|
||||
let message = `Unable to use three dot diff for: ${submodulePath} submodule. Falling back to two dot diff. You can set 'fetch_additional_submodule_history: true' to fetch additional submodule history in order to use three dot diff`
|
||||
if (inputs.fetchSubmoduleHistory) {
|
||||
if (inputs.fetchAdditionalSubmoduleHistory) {
|
||||
message = `To fetch additional submodule history for: ${submodulePath} you can increase history depth using 'fetch_depth' input`
|
||||
}
|
||||
core.info(message)
|
||||
@@ -221,7 +221,7 @@ export const getAllDiffFiles = async ({
|
||||
diffResult,
|
||||
submodulePaths,
|
||||
outputRenamedFilesAsDeletedAndAdded,
|
||||
fetchSubmoduleHistory,
|
||||
fetchAdditionalSubmoduleHistory,
|
||||
failOnInitialDiffError,
|
||||
failOnSubmoduleDiffError
|
||||
}: {
|
||||
@@ -230,7 +230,7 @@ export const getAllDiffFiles = async ({
|
||||
diffResult: DiffResult
|
||||
submodulePaths: string[]
|
||||
outputRenamedFilesAsDeletedAndAdded: boolean
|
||||
fetchSubmoduleHistory: boolean
|
||||
fetchAdditionalSubmoduleHistory: boolean
|
||||
failOnInitialDiffError: boolean
|
||||
failOnSubmoduleDiffError: boolean
|
||||
}): Promise<ChangedFiles> => {
|
||||
@@ -270,7 +270,7 @@ export const getAllDiffFiles = async ({
|
||||
}))
|
||||
) {
|
||||
let message = `Set 'fetch_additional_submodule_history: true' to fetch additional submodule history for: ${submodulePath}`
|
||||
if (fetchSubmoduleHistory) {
|
||||
if (fetchAdditionalSubmoduleHistory) {
|
||||
message = `To fetch additional submodule history for: ${submodulePath} you can increase history depth using 'fetch_depth' input`
|
||||
}
|
||||
core.warning(message)
|
||||
|
||||
@@ -43,7 +43,8 @@ export const setOutputsAndGetModifiedAndChangedFilesStatus = async ({
|
||||
writeOutputFiles: inputs.writeOutputFiles,
|
||||
outputDir: inputs.outputDir,
|
||||
json: inputs.json,
|
||||
shouldEscape: inputs.escapeJson
|
||||
shouldEscape: inputs.escapeJson,
|
||||
safeOutput: inputs.safeOutput
|
||||
})
|
||||
await setOutput({
|
||||
key: getOutputKey('added_files_count', outputPrefix),
|
||||
@@ -64,7 +65,8 @@ export const setOutputsAndGetModifiedAndChangedFilesStatus = async ({
|
||||
writeOutputFiles: inputs.writeOutputFiles,
|
||||
outputDir: inputs.outputDir,
|
||||
json: inputs.json,
|
||||
shouldEscape: inputs.escapeJson
|
||||
shouldEscape: inputs.escapeJson,
|
||||
safeOutput: inputs.safeOutput
|
||||
})
|
||||
|
||||
await setOutput({
|
||||
@@ -86,7 +88,8 @@ export const setOutputsAndGetModifiedAndChangedFilesStatus = async ({
|
||||
writeOutputFiles: inputs.writeOutputFiles,
|
||||
outputDir: inputs.outputDir,
|
||||
json: inputs.json,
|
||||
shouldEscape: inputs.escapeJson
|
||||
shouldEscape: inputs.escapeJson,
|
||||
safeOutput: inputs.safeOutput
|
||||
})
|
||||
|
||||
await setOutput({
|
||||
@@ -108,7 +111,8 @@ export const setOutputsAndGetModifiedAndChangedFilesStatus = async ({
|
||||
writeOutputFiles: inputs.writeOutputFiles,
|
||||
outputDir: inputs.outputDir,
|
||||
json: inputs.json,
|
||||
shouldEscape: inputs.escapeJson
|
||||
shouldEscape: inputs.escapeJson,
|
||||
safeOutput: inputs.safeOutput
|
||||
})
|
||||
|
||||
await setOutput({
|
||||
@@ -130,7 +134,8 @@ export const setOutputsAndGetModifiedAndChangedFilesStatus = async ({
|
||||
writeOutputFiles: inputs.writeOutputFiles,
|
||||
outputDir: inputs.outputDir,
|
||||
json: inputs.json,
|
||||
shouldEscape: inputs.escapeJson
|
||||
shouldEscape: inputs.escapeJson,
|
||||
safeOutput: inputs.safeOutput
|
||||
})
|
||||
|
||||
await setOutput({
|
||||
@@ -152,7 +157,8 @@ export const setOutputsAndGetModifiedAndChangedFilesStatus = async ({
|
||||
writeOutputFiles: inputs.writeOutputFiles,
|
||||
outputDir: inputs.outputDir,
|
||||
json: inputs.json,
|
||||
shouldEscape: inputs.escapeJson
|
||||
shouldEscape: inputs.escapeJson,
|
||||
safeOutput: inputs.safeOutput
|
||||
})
|
||||
|
||||
await setOutput({
|
||||
@@ -174,7 +180,8 @@ export const setOutputsAndGetModifiedAndChangedFilesStatus = async ({
|
||||
writeOutputFiles: inputs.writeOutputFiles,
|
||||
outputDir: inputs.outputDir,
|
||||
json: inputs.json,
|
||||
shouldEscape: inputs.escapeJson
|
||||
shouldEscape: inputs.escapeJson,
|
||||
safeOutput: inputs.safeOutput
|
||||
})
|
||||
|
||||
await setOutput({
|
||||
@@ -199,7 +206,8 @@ export const setOutputsAndGetModifiedAndChangedFilesStatus = async ({
|
||||
writeOutputFiles: inputs.writeOutputFiles,
|
||||
outputDir: inputs.outputDir,
|
||||
json: inputs.json,
|
||||
shouldEscape: inputs.escapeJson
|
||||
shouldEscape: inputs.escapeJson,
|
||||
safeOutput: inputs.safeOutput
|
||||
})
|
||||
|
||||
await setOutput({
|
||||
@@ -226,7 +234,8 @@ export const setOutputsAndGetModifiedAndChangedFilesStatus = async ({
|
||||
writeOutputFiles: inputs.writeOutputFiles,
|
||||
outputDir: inputs.outputDir,
|
||||
json: inputs.json,
|
||||
shouldEscape: inputs.escapeJson
|
||||
shouldEscape: inputs.escapeJson,
|
||||
safeOutput: inputs.safeOutput
|
||||
})
|
||||
|
||||
await setOutput({
|
||||
@@ -314,7 +323,8 @@ export const setOutputsAndGetModifiedAndChangedFilesStatus = async ({
|
||||
writeOutputFiles: inputs.writeOutputFiles,
|
||||
outputDir: inputs.outputDir,
|
||||
json: inputs.json,
|
||||
shouldEscape: inputs.escapeJson
|
||||
shouldEscape: inputs.escapeJson,
|
||||
safeOutput: inputs.safeOutput
|
||||
})
|
||||
|
||||
await setOutput({
|
||||
@@ -419,7 +429,8 @@ export const setOutputsAndGetModifiedAndChangedFilesStatus = async ({
|
||||
writeOutputFiles: inputs.writeOutputFiles,
|
||||
outputDir: inputs.outputDir,
|
||||
json: inputs.json,
|
||||
shouldEscape: inputs.escapeJson
|
||||
shouldEscape: inputs.escapeJson,
|
||||
safeOutput: inputs.safeOutput
|
||||
})
|
||||
|
||||
await setOutput({
|
||||
|
||||
@@ -152,7 +152,7 @@ export const getSHAForNonPullRequestEvent = async (
|
||||
})
|
||||
}
|
||||
} else {
|
||||
if (hasSubmodule && inputs.fetchSubmoduleHistory) {
|
||||
if (hasSubmodule && inputs.fetchAdditionalSubmoduleHistory) {
|
||||
await gitFetchSubmodules({
|
||||
cwd: workingDirectory,
|
||||
args: [
|
||||
@@ -382,7 +382,7 @@ export const getSHAForPullRequestEvent = async (
|
||||
}
|
||||
}
|
||||
} else {
|
||||
if (hasSubmodule && inputs.fetchSubmoduleHistory) {
|
||||
if (hasSubmodule && inputs.fetchAdditionalSubmoduleHistory) {
|
||||
await gitFetchSubmodules({
|
||||
cwd: workingDirectory,
|
||||
args: [
|
||||
@@ -429,7 +429,7 @@ export const getSHAForPullRequestEvent = async (
|
||||
|
||||
if (
|
||||
!github.context.payload.pull_request?.base?.ref ||
|
||||
github.context.payload.head?.repo?.fork === 'true'
|
||||
github.context.payload.pull_request?.head?.repo?.fork === true
|
||||
) {
|
||||
diff = '..'
|
||||
}
|
||||
|
||||
24
src/constant.ts
Normal file
24
src/constant.ts
Normal file
@@ -0,0 +1,24 @@
|
||||
import {Inputs} from './inputs'
|
||||
|
||||
export const DEFAULT_VALUES_OF_UNSUPPORTED_API_INPUTS: Partial<Inputs> = {
|
||||
sha: '',
|
||||
baseSha: '',
|
||||
since: '',
|
||||
until: '',
|
||||
path: '.',
|
||||
quotepath: true,
|
||||
diffRelative: true,
|
||||
sinceLastRemoteCommit: false,
|
||||
recoverDeletedFiles: false,
|
||||
recoverDeletedFilesToDestination: '',
|
||||
recoverFiles: '',
|
||||
recoverFilesSeparator: '\n',
|
||||
recoverFilesIgnore: '',
|
||||
recoverFilesIgnoreSeparator: '\n',
|
||||
includeAllOldNewRenamedFiles: false,
|
||||
oldNewSeparator: ',',
|
||||
oldNewFilesSeparator: ' ',
|
||||
skipInitialFetch: false,
|
||||
fetchAdditionalSubmoduleHistory: false,
|
||||
dirNamesDeletedFilesIncludeOnlyDeletedDirs: false
|
||||
}
|
||||
@@ -5,8 +5,9 @@ export type Env = {
|
||||
GITHUB_REF: string
|
||||
GITHUB_WORKSPACE: string
|
||||
}
|
||||
|
||||
export const getEnv = async (): Promise<Env> => {
|
||||
core.debug(`Process Env: ${JSON.stringify(process.env, null, 2)}`)
|
||||
core.debug(`Env: ${JSON.stringify(process.env, null, 2)}`)
|
||||
|
||||
return {
|
||||
GITHUB_REF_NAME: process.env.GITHUB_REF_NAME || '',
|
||||
|
||||
@@ -24,7 +24,7 @@ export type Inputs = {
|
||||
since: string
|
||||
until: string
|
||||
path: string
|
||||
quotePath: boolean
|
||||
quotepath: boolean
|
||||
diffRelative: boolean
|
||||
dirNames: boolean
|
||||
dirNamesMaxDepth?: number
|
||||
@@ -34,8 +34,9 @@ export type Inputs = {
|
||||
dirNamesDeletedFilesIncludeOnlyDeletedDirs: boolean
|
||||
json: boolean
|
||||
escapeJson: boolean
|
||||
safeOutput: boolean
|
||||
fetchDepth?: number
|
||||
fetchSubmoduleHistory: boolean
|
||||
fetchAdditionalSubmoduleHistory: boolean
|
||||
sinceLastRemoteCommit: boolean
|
||||
writeOutputFiles: boolean
|
||||
outputDir: string
|
||||
@@ -52,6 +53,7 @@ export type Inputs = {
|
||||
failOnInitialDiffError: boolean
|
||||
failOnSubmoduleDiffError: boolean
|
||||
negationPatternsFirst: boolean
|
||||
useRestApi: boolean
|
||||
}
|
||||
|
||||
export const getInputs = (): Inputs => {
|
||||
@@ -130,7 +132,7 @@ export const getInputs = (): Inputs => {
|
||||
const since = core.getInput('since', {required: false})
|
||||
const until = core.getInput('until', {required: false})
|
||||
const path = core.getInput('path', {required: false})
|
||||
const quotePath = core.getBooleanInput('quotepath', {required: false})
|
||||
const quotepath = core.getBooleanInput('quotepath', {required: false})
|
||||
const diffRelative = core.getBooleanInput('diff_relative', {required: false})
|
||||
const dirNames = core.getBooleanInput('dir_names', {required: false})
|
||||
const dirNamesMaxDepth = core.getInput('dir_names_max_depth', {
|
||||
@@ -152,8 +154,16 @@ export const getInputs = (): Inputs => {
|
||||
trimWhitespace: false
|
||||
}
|
||||
)
|
||||
const json = core.getBooleanInput('json', {required: false})
|
||||
const escapeJson = core.getBooleanInput('escape_json', {required: false})
|
||||
let json = core.getBooleanInput('json', {required: false})
|
||||
let escapeJson = core.getBooleanInput('escape_json', {required: false})
|
||||
const matrix = core.getBooleanInput('matrix', {required: false})
|
||||
|
||||
if (matrix) {
|
||||
json = true
|
||||
escapeJson = false
|
||||
}
|
||||
|
||||
const safeOutput = core.getBooleanInput('safe_output', {required: false})
|
||||
const fetchDepth = core.getInput('fetch_depth', {required: false})
|
||||
const sinceLastRemoteCommit = core.getBooleanInput(
|
||||
'since_last_remote_commit',
|
||||
@@ -194,7 +204,7 @@ export const getInputs = (): Inputs => {
|
||||
const skipInitialFetch = core.getBooleanInput('skip_initial_fetch', {
|
||||
required: false
|
||||
})
|
||||
const fetchSubmoduleHistory = core.getBooleanInput(
|
||||
const fetchAdditionalSubmoduleHistory = core.getBooleanInput(
|
||||
'fetch_additional_submodule_history',
|
||||
{
|
||||
required: false
|
||||
@@ -226,6 +236,10 @@ export const getInputs = (): Inputs => {
|
||||
}
|
||||
)
|
||||
|
||||
const useRestApi = core.getBooleanInput('use_rest_api', {
|
||||
required: false
|
||||
})
|
||||
|
||||
const inputs: Inputs = {
|
||||
files,
|
||||
filesSeparator,
|
||||
@@ -250,7 +264,7 @@ export const getInputs = (): Inputs => {
|
||||
since,
|
||||
until,
|
||||
path,
|
||||
quotePath,
|
||||
quotepath,
|
||||
diffRelative,
|
||||
sinceLastRemoteCommit,
|
||||
recoverDeletedFiles,
|
||||
@@ -263,7 +277,7 @@ export const getInputs = (): Inputs => {
|
||||
oldNewSeparator,
|
||||
oldNewFilesSeparator,
|
||||
skipInitialFetch,
|
||||
fetchSubmoduleHistory,
|
||||
fetchAdditionalSubmoduleHistory,
|
||||
dirNamesDeletedFilesIncludeOnlyDeletedDirs,
|
||||
// End Not Supported via REST API
|
||||
dirNames,
|
||||
@@ -272,12 +286,14 @@ export const getInputs = (): Inputs => {
|
||||
dirNamesIncludeFilesSeparator,
|
||||
json,
|
||||
escapeJson,
|
||||
safeOutput,
|
||||
writeOutputFiles,
|
||||
outputDir,
|
||||
outputRenamedFilesAsDeletedAndAdded,
|
||||
token,
|
||||
apiUrl,
|
||||
negationPatternsFirst
|
||||
negationPatternsFirst,
|
||||
useRestApi
|
||||
}
|
||||
|
||||
if (fetchDepth) {
|
||||
|
||||
60
src/main.ts
60
src/main.ts
@@ -26,7 +26,8 @@ import {
|
||||
setOutput,
|
||||
submoduleExists,
|
||||
updateGitGlobalConfig,
|
||||
verifyMinimumGitVersion
|
||||
verifyMinimumGitVersion,
|
||||
warnUnsupportedRESTAPIInputs
|
||||
} from './utils'
|
||||
|
||||
const getChangedFilesFromLocalGitHistory = async ({
|
||||
@@ -44,15 +45,15 @@ const getChangedFilesFromLocalGitHistory = async ({
|
||||
}): Promise<void> => {
|
||||
await verifyMinimumGitVersion()
|
||||
|
||||
let quotePathValue = 'on'
|
||||
let quotepathValue = 'on'
|
||||
|
||||
if (!inputs.quotePath) {
|
||||
quotePathValue = 'off'
|
||||
if (!inputs.quotepath) {
|
||||
quotepathValue = 'off'
|
||||
}
|
||||
|
||||
await updateGitGlobalConfig({
|
||||
name: 'core.quotepath',
|
||||
value: quotePathValue
|
||||
value: quotepathValue
|
||||
})
|
||||
|
||||
if (inputs.diffRelative) {
|
||||
@@ -123,7 +124,7 @@ const getChangedFilesFromLocalGitHistory = async ({
|
||||
diffResult,
|
||||
submodulePaths,
|
||||
outputRenamedFilesAsDeletedAndAdded,
|
||||
fetchSubmoduleHistory: inputs.fetchSubmoduleHistory,
|
||||
fetchAdditionalSubmoduleHistory: inputs.fetchAdditionalSubmoduleHistory,
|
||||
failOnInitialDiffError: inputs.failOnInitialDiffError,
|
||||
failOnSubmoduleDiffError: inputs.failOnSubmoduleDiffError
|
||||
})
|
||||
@@ -144,7 +145,9 @@ const getChangedFilesFromLocalGitHistory = async ({
|
||||
workingDirectory,
|
||||
deletedFiles: allDiffFiles[ChangeTypeEnum.Deleted],
|
||||
recoverPatterns,
|
||||
sha: diffResult.previousSha
|
||||
diffResult,
|
||||
hasSubmodule,
|
||||
submodulePaths
|
||||
})
|
||||
}
|
||||
|
||||
@@ -171,7 +174,8 @@ const getChangedFilesFromLocalGitHistory = async ({
|
||||
value: allOldNewRenamedFiles.paths,
|
||||
writeOutputFiles: inputs.writeOutputFiles,
|
||||
outputDir: inputs.outputDir,
|
||||
json: inputs.json
|
||||
json: inputs.json,
|
||||
safeOutput: inputs.safeOutput
|
||||
})
|
||||
await setOutput({
|
||||
key: 'all_old_new_renamed_files_count',
|
||||
@@ -221,7 +225,7 @@ export async function run(): Promise<void> {
|
||||
|
||||
const workingDirectory = path.resolve(
|
||||
env.GITHUB_WORKSPACE || process.cwd(),
|
||||
inputs.path
|
||||
inputs.useRestApi ? '.' : inputs.path
|
||||
)
|
||||
core.debug(`Working directory: ${workingDirectory}`)
|
||||
|
||||
@@ -240,35 +244,19 @@ export async function run(): Promise<void> {
|
||||
})
|
||||
core.debug(`Yaml file patterns: ${JSON.stringify(yamlFilePatterns)}`)
|
||||
|
||||
if (inputs.useRestApi && !github.context.payload.pull_request?.number) {
|
||||
throw new Error(
|
||||
"Only pull_request* events are supported when using GitHub's REST API."
|
||||
)
|
||||
}
|
||||
|
||||
if (
|
||||
inputs.token &&
|
||||
github.context.payload.pull_request?.number &&
|
||||
!hasGitDirectory
|
||||
(!hasGitDirectory || inputs.useRestApi)
|
||||
) {
|
||||
core.info("Using GitHub's REST API to get changed files")
|
||||
const unsupportedInputs: (keyof Inputs)[] = [
|
||||
'sha',
|
||||
'baseSha',
|
||||
'since',
|
||||
'until',
|
||||
'sinceLastRemoteCommit',
|
||||
'recoverDeletedFiles',
|
||||
'recoverDeletedFilesToDestination',
|
||||
'recoverFiles',
|
||||
'recoverFilesIgnore',
|
||||
'includeAllOldNewRenamedFiles',
|
||||
'skipInitialFetch',
|
||||
'fetchSubmoduleHistory',
|
||||
'dirNamesDeletedFilesIncludeOnlyDeletedDirs'
|
||||
]
|
||||
|
||||
for (const input of unsupportedInputs) {
|
||||
if (inputs[input]) {
|
||||
core.warning(
|
||||
`Input "${input}" is not supported when using GitHub's REST API to get changed files`
|
||||
)
|
||||
}
|
||||
}
|
||||
await warnUnsupportedRESTAPIInputs({inputs})
|
||||
await getChangedFilesFromRESTAPI({
|
||||
inputs,
|
||||
filePatterns,
|
||||
@@ -276,10 +264,9 @@ export async function run(): Promise<void> {
|
||||
})
|
||||
} else {
|
||||
if (!hasGitDirectory) {
|
||||
core.setFailed(
|
||||
"Can't find local .git directory. Please run actions/checkout before this action"
|
||||
throw new Error(
|
||||
`Unable to locate the git repository in the given path: ${workingDirectory}.\n Please run actions/checkout before this action (Make sure the 'path' input is correct).\n If you intend to use Github's REST API note that only pull_request* events are supported. Current event is "${github.context.eventName}".`
|
||||
)
|
||||
return
|
||||
}
|
||||
|
||||
core.info('Using local .git directory')
|
||||
@@ -298,5 +285,6 @@ if (!process.env.TESTING) {
|
||||
// eslint-disable-next-line github/no-then
|
||||
run().catch(e => {
|
||||
core.setFailed(e.message || e)
|
||||
process.exit(1)
|
||||
})
|
||||
}
|
||||
|
||||
140
src/utils.ts
140
src/utils.ts
@@ -3,13 +3,14 @@ import * as core from '@actions/core'
|
||||
import * as exec from '@actions/exec'
|
||||
import * as github from '@actions/github'
|
||||
import {createReadStream, promises as fs} from 'fs'
|
||||
import {readFile} from 'fs/promises'
|
||||
import {flattenDeep} from 'lodash'
|
||||
import {flattenDeep, snakeCase} from 'lodash'
|
||||
import mm from 'micromatch'
|
||||
import * as path from 'path'
|
||||
import {createInterface} from 'readline'
|
||||
import {parseDocument} from 'yaml'
|
||||
import {ChangedFiles, ChangeTypeEnum} from './changedFiles'
|
||||
import {DiffResult} from './commitSha'
|
||||
import {DEFAULT_VALUES_OF_UNSUPPORTED_API_INPUTS} from './constant'
|
||||
import {Inputs} from './inputs'
|
||||
|
||||
const MINIMUM_GIT_VERSION = '2.18.0'
|
||||
@@ -170,15 +171,16 @@ async function* lineOfFileGenerator({
|
||||
input: fileStream,
|
||||
crlfDelay: Infinity
|
||||
})
|
||||
for await (const line of rl) {
|
||||
for await (let line of rl) {
|
||||
if (!line.startsWith('#') && line !== '') {
|
||||
if (excludedFiles) {
|
||||
if (line.startsWith('!')) {
|
||||
yield line
|
||||
} else {
|
||||
yield `!${line}`
|
||||
line = line.startsWith('!') ? line : `!${line}`
|
||||
if (line.endsWith(path.sep)) {
|
||||
line = `${line}**`
|
||||
}
|
||||
yield line
|
||||
} else {
|
||||
line = line.endsWith(path.sep) ? `${line}**` : line
|
||||
yield line
|
||||
}
|
||||
}
|
||||
@@ -284,6 +286,7 @@ export const submoduleExists = async ({
|
||||
* Fetches the git repository
|
||||
* @param args - arguments for fetch command
|
||||
* @param cwd - working directory
|
||||
* @returns exit code
|
||||
*/
|
||||
export const gitFetch = async ({
|
||||
args,
|
||||
@@ -332,6 +335,7 @@ export const gitFetchSubmodules = async ({
|
||||
/**
|
||||
* Retrieves all the submodule paths
|
||||
* @param cwd - working directory
|
||||
* @returns submodule paths
|
||||
*/
|
||||
export const getSubmodulePath = async ({
|
||||
cwd
|
||||
@@ -366,6 +370,7 @@ export const getSubmodulePath = async ({
|
||||
* @param parentSha2 - parent commit sha
|
||||
* @param submodulePath - path of submodule
|
||||
* @param diff - diff type between parent commits (`..` or `...`)
|
||||
* @returns commit sha of submodule
|
||||
*/
|
||||
export const gitSubmoduleDiffSHA = async ({
|
||||
cwd,
|
||||
@@ -675,6 +680,12 @@ export const isInsideWorkTree = async ({
|
||||
}
|
||||
)
|
||||
|
||||
if (stdout.trim() !== 'true') {
|
||||
core.warning(
|
||||
`The current working directory is not inside a git repository: ${cwd}`
|
||||
)
|
||||
}
|
||||
|
||||
return stdout.trim() === 'true'
|
||||
}
|
||||
|
||||
@@ -897,7 +908,7 @@ export const canDiffCommits = async ({
|
||||
} else {
|
||||
const {exitCode, stderr} = await exec.getExecOutput(
|
||||
'git',
|
||||
['diff', '--quiet', sha1, sha2],
|
||||
['diff', '--no-patch', sha1, sha2],
|
||||
{
|
||||
cwd,
|
||||
ignoreReturnCode: true,
|
||||
@@ -994,6 +1005,7 @@ export const getFilePatterns = async ({
|
||||
if (inputs.files) {
|
||||
const filesPatterns = inputs.files
|
||||
.split(inputs.filesSeparator)
|
||||
.map(p => (p.endsWith(path.sep) ? `${p}**` : p))
|
||||
.filter(Boolean)
|
||||
|
||||
cleanedFilePatterns.push(...filesPatterns)
|
||||
@@ -1025,8 +1037,9 @@ export const getFilePatterns = async ({
|
||||
.split(inputs.filesIgnoreSeparator)
|
||||
.filter(Boolean)
|
||||
.map(p => {
|
||||
if (!p.startsWith('!')) {
|
||||
p = `!${p}`
|
||||
p = p.startsWith('!') ? p : `!${p}`
|
||||
if (p.endsWith(path.sep)) {
|
||||
p = `${p}**`
|
||||
}
|
||||
return p
|
||||
})
|
||||
@@ -1127,7 +1140,7 @@ const getYamlFilePatternsFromContents = async ({
|
||||
throw new Error(`File does not exist: ${filePath}`)
|
||||
}
|
||||
|
||||
source = await readFile(filePath, 'utf8')
|
||||
source = await fs.readFile(filePath, 'utf8')
|
||||
} else {
|
||||
source = content
|
||||
}
|
||||
@@ -1323,7 +1336,8 @@ export const setArrayOutput = async ({
|
||||
writeOutputFiles: inputs.writeOutputFiles,
|
||||
outputDir: inputs.outputDir,
|
||||
json: inputs.json,
|
||||
shouldEscape: inputs.escapeJson
|
||||
shouldEscape: inputs.escapeJson,
|
||||
safeOutput: inputs.safeOutput
|
||||
})
|
||||
}
|
||||
|
||||
@@ -1333,7 +1347,8 @@ export const setOutput = async ({
|
||||
writeOutputFiles,
|
||||
outputDir,
|
||||
json = false,
|
||||
shouldEscape = false
|
||||
shouldEscape = false,
|
||||
safeOutput = false
|
||||
}: {
|
||||
key: string
|
||||
value: string | string[] | boolean
|
||||
@@ -1341,6 +1356,7 @@ export const setOutput = async ({
|
||||
outputDir: string
|
||||
json?: boolean
|
||||
shouldEscape?: boolean
|
||||
safeOutput?: boolean
|
||||
}): Promise<void> => {
|
||||
let cleanedValue
|
||||
if (json) {
|
||||
@@ -1349,6 +1365,11 @@ export const setOutput = async ({
|
||||
cleanedValue = value.toString().trim()
|
||||
}
|
||||
|
||||
// if safeOutput is true, escape special characters for bash shell
|
||||
if (safeOutput) {
|
||||
cleanedValue = cleanedValue.replace(/[^\x20-\x7E]|[:*?<>|;`$()&!]/g, '\\$&')
|
||||
}
|
||||
|
||||
core.setOutput(key, cleanedValue)
|
||||
|
||||
if (writeOutputFiles) {
|
||||
@@ -1395,13 +1416,17 @@ export const recoverDeletedFiles = async ({
|
||||
workingDirectory,
|
||||
deletedFiles,
|
||||
recoverPatterns,
|
||||
sha
|
||||
diffResult,
|
||||
hasSubmodule,
|
||||
submodulePaths
|
||||
}: {
|
||||
inputs: Inputs
|
||||
workingDirectory: string
|
||||
deletedFiles: string[]
|
||||
recoverPatterns: string[]
|
||||
sha: string
|
||||
diffResult: DiffResult
|
||||
hasSubmodule: boolean
|
||||
submodulePaths: string[]
|
||||
}): Promise<void> => {
|
||||
let recoverableDeletedFiles = deletedFiles
|
||||
core.debug(`recoverable deleted files: ${recoverableDeletedFiles}`)
|
||||
@@ -1426,19 +1451,64 @@ export const recoverDeletedFiles = async ({
|
||||
)
|
||||
}
|
||||
|
||||
const deletedFileContents = await getDeletedFileContents({
|
||||
cwd: workingDirectory,
|
||||
filePath: deletedFile,
|
||||
sha
|
||||
})
|
||||
let deletedFileContents: string
|
||||
|
||||
const submodulePath = submodulePaths.find(p => deletedFile.startsWith(p))
|
||||
|
||||
if (hasSubmodule && submodulePath) {
|
||||
const submoduleShaResult = await gitSubmoduleDiffSHA({
|
||||
cwd: workingDirectory,
|
||||
parentSha1: diffResult.previousSha,
|
||||
parentSha2: diffResult.currentSha,
|
||||
submodulePath,
|
||||
diff: diffResult.diff
|
||||
})
|
||||
|
||||
if (submoduleShaResult.previousSha) {
|
||||
core.debug(
|
||||
`recovering deleted file "${deletedFile}" from submodule ${submodulePath} from ${submoduleShaResult.previousSha}`
|
||||
)
|
||||
deletedFileContents = await getDeletedFileContents({
|
||||
cwd: path.join(workingDirectory, submodulePath),
|
||||
// E.g. submodulePath = test/demo and deletedFile = test/demo/.github/README.md => filePath => .github/README.md
|
||||
filePath: deletedFile.replace(submodulePath, '').substring(1),
|
||||
sha: submoduleShaResult.previousSha
|
||||
})
|
||||
} else {
|
||||
core.warning(
|
||||
`Unable to recover deleted file "${deletedFile}" from submodule ${submodulePath} from ${submoduleShaResult.previousSha}`
|
||||
)
|
||||
continue
|
||||
}
|
||||
} else {
|
||||
core.debug(
|
||||
`recovering deleted file "${deletedFile}" from ${diffResult.previousSha}`
|
||||
)
|
||||
deletedFileContents = await getDeletedFileContents({
|
||||
cwd: workingDirectory,
|
||||
filePath: deletedFile,
|
||||
sha: diffResult.previousSha
|
||||
})
|
||||
}
|
||||
|
||||
core.debug(`recovered deleted file "${deletedFile}"`)
|
||||
|
||||
if (!(await exists(path.dirname(target)))) {
|
||||
core.debug(`creating directory "${path.dirname(target)}"`)
|
||||
await fs.mkdir(path.dirname(target), {recursive: true})
|
||||
}
|
||||
core.debug(`writing file "${target}"`)
|
||||
await fs.writeFile(target, deletedFileContents)
|
||||
core.debug(`wrote file "${target}"`)
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Determines whether the specified working directory has a local Git directory.
|
||||
*
|
||||
* @param workingDirectory - The path of the working directory.
|
||||
* @returns A boolean value indicating whether the working directory has a local Git directory.
|
||||
*/
|
||||
export const hasLocalGitDirectory = async ({
|
||||
workingDirectory
|
||||
}: {
|
||||
@@ -1448,3 +1518,33 @@ export const hasLocalGitDirectory = async ({
|
||||
cwd: workingDirectory
|
||||
})
|
||||
}
|
||||
|
||||
/**
|
||||
* Warns about unsupported inputs when using the REST API.
|
||||
*
|
||||
* @param inputs - The inputs object.
|
||||
*/
|
||||
export const warnUnsupportedRESTAPIInputs = async ({
|
||||
inputs
|
||||
}: {
|
||||
inputs: Inputs
|
||||
}): Promise<void> => {
|
||||
for (const key of Object.keys(DEFAULT_VALUES_OF_UNSUPPORTED_API_INPUTS)) {
|
||||
const defaultValue = Object.hasOwnProperty.call(
|
||||
DEFAULT_VALUES_OF_UNSUPPORTED_API_INPUTS,
|
||||
key
|
||||
)
|
||||
? DEFAULT_VALUES_OF_UNSUPPORTED_API_INPUTS[
|
||||
key as keyof Inputs
|
||||
]?.toString()
|
||||
: ''
|
||||
|
||||
if (defaultValue !== inputs[key as keyof Inputs]?.toString()) {
|
||||
core.warning(
|
||||
`Input "${snakeCase(
|
||||
key
|
||||
)}" is not supported when using GitHub's REST API to get changed files`
|
||||
)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user