Skip to content

Commit 9a8811d

Browse files
committed
Try to make code logic more clear
1 parent 7b0f5cc commit 9a8811d

1 file changed

Lines changed: 20 additions & 10 deletions

File tree

.github/workflows/_find_changes.yaml

Lines changed: 20 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -33,10 +33,10 @@ on:
3333
workflow_call:
3434
outputs:
3535
code:
36-
description: 'True if any code files were changed'
37-
value: ${{jobs.test.outputs.only-noncode-changes == 'false'}}
36+
description: 'True if any potential code file was changed'
37+
value: ${{jobs.test.outputs.nondoc-file-changes == 'true'}}
3838
python:
39-
description: 'True if Python files were changed'
39+
description: 'True if any Python file was changed'
4040
value: ${{jobs.test.outputs.python-changes == 'true'}}
4141

4242
permissions: read-all
@@ -47,24 +47,34 @@ jobs:
4747
runs-on: ubuntu-24.04
4848
timeout-minutes: 5
4949
outputs:
50-
only-noncode-changes: ${{steps.only-noncode-files.outputs.matched}}
50+
nondoc-file-changes: ${{steps.nondoc-files.outputs.matched}}
5151
python-changes: ${{steps.python-files.outputs.matched}}
5252
steps:
5353
- name: Check out a copy of the git repository
5454
uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4
5555

56-
- name: Test whether only docs or similar files were changed
56+
- name: Test whether the changes involved one or more non-doc files
5757
uses: tomi/paths-filter-action@32c62f5ca100c1110406e3477d5b3ecef4666fec # v3.0.2
58-
id: only-noncode-files
58+
id: nondoc-files
5959
with:
6060
base: ${{github.ref_name}}
61-
predicate-quantifier: 'every'
61+
# Note: when editing the patterns below, always make sure to negate
62+
# the condition (i.e., use a leading '!'). See the next comment.
6263
filters: |
6364
matched:
64-
- '!**/*.md'
65-
- '!docs/**'
6665
- '!.github/ISSUE_TEMPLATE/**'
66+
- '!.github/dependabot.yaml'
67+
- '!.github/problem-matchers/**'
6768
- '!CITATION.cff'
69+
- '!docs/**'
70+
- '!**/*.md'
71+
- '!**/*.png'
72+
# The default paths-filter-action behavior is "match at least one"
73+
# pattern. We change the behavior to be "match every" pattern.
74+
# Combined with negating every pattern above, it means the final output
75+
# will be non-empty only if there is at least one file that is NOT a
76+
# documentation file, or in other words, is a potential code file.
77+
predicate-quantifier: 'every'
6878

6979
- name: Test whether Python files are among the changed files
7080
uses: tomi/paths-filter-action@32c62f5ca100c1110406e3477d5b3ecef4666fec # v3.0.2
@@ -78,5 +88,5 @@ jobs:
7888
- name: Summary of test results
7989
run: |
8090
set -x
81-
echo steps.only-noncode-files.outputs.matched = │${{steps.only-noncode-files.outputs.matched}}│
91+
echo steps.nondoc-files.outputs.matched = │${{steps.nondoc-files.outputs.matched}}│
8292
echo steps.python-files.outputs.matched = │${{steps.python-files.outputs.matched}}│

0 commit comments

Comments
 (0)