1717 push :
1818 branches :
1919 - main
20- paths-ignore :
21- - ' .github/workflows/**'
2220 pull_request :
23- paths-ignore :
24- - ' .github/workflows/**'
2521name : ci
2622jobs :
23+ filter :
24+ runs-on : ubuntu-latest
25+ permissions :
26+ pull-requests : read
27+ outputs :
28+ runnable : ${{ steps.filter.outputs.runnable }}
29+ steps :
30+ - uses : actions/checkout@v6
31+ # Use this action, rather than a file filter so that we can make this
32+ # mandatory.
33+ # See https://docs.github.com/en/actions/reference/workflows-and-actions/workflow-syntax#example-including-branches
34+ # for more details.
35+ - uses : dorny/paths-filter@v4
36+ id : filter
37+ with :
38+ filters : |
39+ runnable:
40+ - '**'
41+ - '!.github/workflows/**'
42+
2743 # detect whether or note we should run "bulk" (non-handwritten) unit tests
2844 bulk-filter :
45+ needs : filter
46+ if : ${{ needs.filter.outputs.runnable == 'true' }}
2947 runs-on : ubuntu-latest
3048 permissions :
3149 pull-requests : read
@@ -110,6 +128,8 @@ jobs:
110128 JOB_NAME : units-8-runtime-${{matrix.java}}
111129 # detect which libraries have changed
112130 changes :
131+ needs : filter
132+ if : ${{ needs.filter.outputs.runnable == 'true' }}
113133 runs-on : ubuntu-latest
114134 permissions :
115135 pull-requests : read
@@ -306,7 +326,7 @@ jobs:
306326 env :
307327 BUILD_SUBDIR : ${{matrix.package}}
308328 required :
309- needs : [ changes, split-units, split-clirr, split-dependencies ]
329+ needs : [ filter, changes, split-units, split-clirr, split-dependencies ]
310330 name : conditional-required-check
311331 if : ${{ always() }} # Always run even if any "needs" jobs fail
312332 runs-on : ubuntu-22.04
@@ -317,6 +337,8 @@ jobs:
317337 - name : Success otherwise
318338 run : echo "Success!"
319339 windows :
340+ needs : filter
341+ if : ${{ needs.filter.outputs.runnable == 'true' }}
320342 runs-on : windows-latest
321343 steps :
322344 - name : Support longpaths
@@ -333,6 +355,8 @@ jobs:
333355 JOB_TYPE : test
334356 JOB_NAME : windows-units
335357 lint :
358+ needs : filter
359+ if : ${{ needs.filter.outputs.runnable == 'true' }}
336360 runs-on : ubuntu-latest
337361 steps :
338362 - uses : actions/checkout@v4
@@ -349,6 +373,8 @@ jobs:
349373 HEAD_SHA : ${{ github.event.pull_request.head.sha || github.sha }}
350374 BASE_SHA : ${{ github.event.pull_request.base.sha || github.event.before }}
351375 enforcer :
376+ needs : filter
377+ if : ${{ needs.filter.outputs.runnable == 'true' }}
352378 runs-on : ubuntu-latest
353379 steps :
354380 - name : Get current week within the year
@@ -368,6 +394,8 @@ jobs:
368394 - run : java -version
369395 - run : mvn -B -ntp enforcer:enforce@enforce -T 1C
370396 gapic-libraries-bom :
397+ needs : filter
398+ if : ${{ needs.filter.outputs.runnable == 'true' }}
371399 runs-on : ubuntu-latest
372400 steps :
373401 - uses : actions/checkout@v4
@@ -385,6 +413,8 @@ jobs:
385413 with :
386414 bom-path : gapic-libraries-bom/pom.xml
387415 generation-config-check :
416+ needs : filter
417+ if : ${{ needs.filter.outputs.runnable == 'true' }}
388418 runs-on : ubuntu-latest
389419 steps :
390420 - uses : actions/checkout@v4
0 commit comments