2121# protection rules work is: "If a workflow is skipped due to path filtering
2222# [...] the checks associated with that workflow will remain in a Pending
2323# state. A PR that requires those checks to be successful will be blocked from
24- # merging." This makes path filters unusable with merge queues. We forgo the
25- # use of path filters, and instead check file changes using our own workflow.
24+ # merging." This makes path filters unusable with merge queues. So, we forgo the
25+ # use of path filters and instead check file changes using our own workflow.
2626# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
2727
2828# The tilde is only to make our reusable workflows be listed last in the UI.
@@ -31,13 +31,16 @@ run-name: Determine which files have been changed
3131
3232on :
3333 workflow_call :
34+ # N.B.: GitHub Actions workflow_call output values are ALWAYS strings, even
35+ # for (what you think are) Booleans. Consequently, calling workflows have to
36+ # test values using, e.g., ${{foo = 'false'}}, and not ${{foo}} or similar.
3437 outputs :
3538 code :
36- description : ' True if any code files were changed'
37- value : jobs.test.outputs.only-noncode -changes == 'false'
39+ description : ' True if any potential code file was changed'
40+ value : ${{ jobs.test.outputs.nondoc-file -changes == 'true'}}
3841 python :
39- description : ' True if Python files were changed'
40- value : jobs.test.outputs.have- python-changes == 'true'
42+ description : ' True if any Python file was changed'
43+ value : ${{ jobs.test.outputs.python-changes == 'true'}}
4144
4245permissions : read-all
4346
@@ -47,24 +50,34 @@ jobs:
4750 runs-on : ubuntu-24.04
4851 timeout-minutes : 5
4952 outputs :
50- only-noncode -changes : steps.only-noncode- files.outputs.matched
51- python-changes : steps.python-files.outputs.matched
53+ nondoc-file -changes : ${{ steps.nondoc- files.outputs.matched}}
54+ python-changes : ${{ steps.python-files.outputs.matched}}
5255 steps :
5356 - name : Check out a copy of the git repository
5457 uses : actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4
5558
56- - name : Test whether only docs or similar files were changed
59+ - name : Test whether the changes involved one or more non-doc files
5760 uses : tomi/paths-filter-action@32c62f5ca100c1110406e3477d5b3ecef4666fec # v3.0.2
58- id : only-noncode -files
61+ id : nondoc -files
5962 with :
6063 base : ${{github.ref_name}}
61- predicate-quantifier : ' every'
64+ # Note: when editing the patterns below, always make sure to negate
65+ # the condition (i.e., use a leading '!'). See the next comment.
6266 filters : |
6367 matched:
64- - '!**/*.md'
65- - '!docs/**'
6668 - '!.github/ISSUE_TEMPLATE/**'
69+ - '!.github/dependabot.yaml'
70+ - '!.github/problem-matchers/**'
6771 - '!CITATION.cff'
72+ - '!docs/**'
73+ - '!**/*.md'
74+ - '!**/*.png'
75+ # The default paths-filter-action behavior is "match at least one"
76+ # pattern. We change the behavior to be "match every" pattern.
77+ # Combined with negating every pattern above, it means the final output
78+ # will be non-empty only if there is at least one file that is NOT a
79+ # documentation file, or in other words, is a potential code file.
80+ predicate-quantifier : ' every'
6881
6982 - name : Test whether Python files are among the changed files
7083 uses : tomi/paths-filter-action@32c62f5ca100c1110406e3477d5b3ecef4666fec # v3.0.2
7487 filters : |
7588 matched:
7689 - '**/*.py'
90+
91+ - name : Summary of test results
92+ run : |
93+ set -x
94+ echo steps.nondoc-files.outputs.matched = │${{steps.nondoc-files.outputs.matched}}│
95+ echo steps.python-files.outputs.matched = │${{steps.python-files.outputs.matched}}│
0 commit comments