Skip to content

Commit e052d30

Browse files
feat: add option to exclude submodules when detecting changes (#2047)
Co-authored-by: GitHub Action <action@github.com>
1 parent 23a4490 commit e052d30

File tree

14 files changed

+176
-115
lines changed

14 files changed

+176
-115
lines changed

.github/workflows/test.yml

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -682,6 +682,27 @@ jobs:
682682
echo "${{ toJSON(steps.changed-files.outputs) }}"
683683
shell:
684684
bash
685+
686+
- name: Run changed-files excluding submodule
687+
id: changed-files-exclude-submodule
688+
uses: ./
689+
with:
690+
base_sha: "85bd869"
691+
sha: "adde7bb"
692+
fetch_depth: 60000
693+
exclude_submodules: true
694+
695+
- name: Verify no added files
696+
if: steps.changed-files-exclude-submodule.outputs.added_files != ''
697+
run: |
698+
echo "Expected: ('') got ${{ steps.changed-files-exclude-submodule.outputs.added_files }}"
699+
exit 1
700+
701+
- name: Show output
702+
run: |
703+
echo "${{ toJSON(steps.changed-files-exclude-submodule.outputs) }}"
704+
shell:
705+
bash
685706
test-yaml:
686707
name: Test changed-files with yaml
687708
runs-on: ubuntu-latest

action.yml

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -223,6 +223,10 @@ inputs:
223223
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`."
224224
required: false
225225
default: "false"
226+
exclude_submodules:
227+
description: "Exclude changes to submodules."
228+
required: false
229+
default: "false"
226230

227231
outputs:
228232
added_files:

dist/index.js

Lines changed: 32 additions & 21 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

dist/index.js.map

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

package.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,7 @@
1414
"lint:fix": "eslint --fix src/*.ts src/**/*.ts",
1515
"package": "ncc build lib/main.js --source-map --license licenses.txt",
1616
"test": "jest --coverage",
17+
"update-snapshot": "jest -u",
1718
"all": "yarn build && yarn format && yarn lint && yarn package && yarn test"
1819
},
1920
"repository": {

0 commit comments

Comments
 (0)