@@ -7,9 +7,6 @@ run-name: |
77 pull_request :
88 branches :
99 - main
10- paths-ignore :
11- - " **.md"
12- - " LICENSE"
1310 schedule :
1411 - cron : " 0 1 * * 3" # Wednesday at 1:00 UTC — weekly full CI run
1512 workflow_dispatch :
4239 secrets :
4340 CLAUDE_CODE_OAUTH_TOKEN : ${{ secrets.CLAUDE_CODE_OAUTH_TOKEN }}
4441
42+ changes :
43+ name : Detect Changes
44+ runs-on : ubuntu-latest
45+ outputs :
46+ code : ${{ steps.filter.outputs.code }}
47+ steps :
48+ - name : Checkout
49+ uses : actions/checkout@9c091bb21b7c1c1d1991bb908d89e4e9dddfe3e0 # v7
50+
51+ - name : Filter paths
52+ id : filter
53+ uses : dorny/paths-filter@fbd0ab8f3e69293af611ebaee6363fc25e6d187d # v4.0.1
54+ with :
55+ filters : |
56+ code:
57+ - '!(**/*.md|LICENSE)'
58+
4559 lint :
4660 name : Lint
4761 runs-on : ubuntu-latest
62+ needs : changes
63+ if : ${{ needs.changes.outputs.code == 'true' }}
4864 steps :
4965 - name : Checkout
5066 uses : actions/checkout@9c091bb21b7c1c1d1991bb908d89e4e9dddfe3e0 # v7
6682 prepare :
6783 name : Prepare
6884 runs-on : ubuntu-latest
69- needs : lint
85+ needs : [changes, lint]
86+ if : ${{ needs.changes.outputs.code == 'true' }}
7087 outputs :
7188 ansible_version : ${{ steps.get_version.outputs.version }}
7289 steps :
87104 build :
88105 name : Build Container
89106 runs-on : ubuntu-latest
90- needs : prepare
107+ needs : [changes, prepare]
108+ if : ${{ needs.changes.outputs.code == 'true' }}
91109 steps :
92110 - name : Checkout
93111 uses : actions/checkout@9c091bb21b7c1c1d1991bb908d89e4e9dddfe3e0 # v7
@@ -117,7 +135,8 @@ jobs:
117135 structure-test :
118136 name : Structure Test
119137 runs-on : ubuntu-latest
120- needs : build
138+ needs : [changes, build]
139+ if : ${{ needs.changes.outputs.code == 'true' }}
121140 steps :
122141 - name : Checkout
123142 uses : actions/checkout@9c091bb21b7c1c1d1991bb908d89e4e9dddfe3e0 # v7
@@ -142,7 +161,8 @@ jobs:
142161 security-test :
143162 name : Security Test
144163 runs-on : ubuntu-latest
145- needs : [build, structure-test]
164+ needs : [changes, build, structure-test]
165+ if : ${{ needs.changes.outputs.code == 'true' }}
146166 steps :
147167 - name : Checkout
148168 uses : actions/checkout@9c091bb21b7c1c1d1991bb908d89e4e9dddfe3e0 # v7
@@ -182,7 +202,8 @@ jobs:
182202 performance-test :
183203 name : Performance Test
184204 runs-on : ubuntu-latest
185- needs : [build, structure-test]
205+ needs : [changes, build, structure-test]
206+ if : ${{ needs.changes.outputs.code == 'true' }}
186207 steps :
187208 - name : Checkout
188209 uses : actions/checkout@9c091bb21b7c1c1d1991bb908d89e4e9dddfe3e0 # v7
@@ -211,7 +232,8 @@ jobs:
211232 integration-test :
212233 name : Integration Test
213234 runs-on : ubuntu-latest
214- needs : [build, structure-test]
235+ needs : [changes, build, structure-test]
236+ if : ${{ needs.changes.outputs.code == 'true' }}
215237 steps :
216238 - name : Checkout
217239 uses : actions/checkout@9c091bb21b7c1c1d1991bb908d89e4e9dddfe3e0 # v7
@@ -278,7 +300,8 @@ jobs:
278300 unit-test :
279301 name : Unit Test
280302 runs-on : ubuntu-latest
281- needs : [build, structure-test]
303+ needs : [changes, build, structure-test]
304+ if : ${{ needs.changes.outputs.code == 'true' }}
282305 steps :
283306 - name : Checkout
284307 uses : actions/checkout@9c091bb21b7c1c1d1991bb908d89e4e9dddfe3e0 # v7
@@ -308,7 +331,8 @@ jobs:
308331 upgrade-test :
309332 name : Upgrade Test
310333 runs-on : ubuntu-latest
311- needs : [build, structure-test]
334+ needs : [changes, build, structure-test]
335+ if : ${{ needs.changes.outputs.code == 'true' }}
312336 steps :
313337 - name : Checkout
314338 uses : actions/checkout@9c091bb21b7c1c1d1991bb908d89e4e9dddfe3e0 # v7
@@ -329,6 +353,7 @@ jobs:
329353 test-summary :
330354 name : Test Summary
331355 needs :
356+ - changes
332357 - lint
333358 - prepare
334359 - build
@@ -343,14 +368,28 @@ jobs:
343368 pull-requests : write
344369 if : ${{ always() }}
345370 steps :
371+ - name : Docs-only change
372+ # No code-relevant files changed: the heavy test jobs were
373+ # skipped on purpose. Report success so the required
374+ # "Test Summary" status check is satisfied and the PR can merge.
375+ if : ${{ needs.changes.outputs.code != 'true' }}
376+ run : |
377+ echo "Docs-only change detected — full CI was skipped."
378+ echo "Marking Test Summary as successful."
379+
346380 - name : Checkout
381+ if : ${{ needs.changes.outputs.code == 'true' }}
347382 uses : actions/checkout@9c091bb21b7c1c1d1991bb908d89e4e9dddfe3e0 # v7
348383
349384 - name : Set Ansible version as environment variable
385+ if : ${{ needs.changes.outputs.code == 'true' }}
386+ env :
387+ ANSIBLE_VERSION : ${{ needs.prepare.outputs.ansible_version }}
350388 run : |
351- echo "ANSIBLE_VERSION=${{ needs.prepare.outputs.ansible_version } }" >> "$GITHUB_ENV"
389+ echo "ANSIBLE_VERSION=${ANSIBLE_VERSION }" >> "$GITHUB_ENV"
352390
353391 - name : Generate test summary
392+ if : ${{ needs.changes.outputs.code == 'true' }}
354393 run : |
355394 ./tests/scripts/container-test-summary.sh \
356395 "Lint=${{ needs.lint.result }}" \
@@ -363,17 +402,19 @@ jobs:
363402 "Upgrade Tests=${{ needs.upgrade-test.result }}"
364403
365404 - name : Comment on pull request with test results
366- if : ${{ github.event_name == 'pull_request' }}
405+ if : ${{ github.event_name == 'pull_request' && needs.changes.outputs.code == 'true' }}
367406 env :
368407 GH_TOKEN : ${{ secrets.GITHUB_TOKEN }}
408+ PR_NUMBER : ${{ github.event.pull_request.number }}
369409 run : |
370- gh pr comment "${{ github.event.pull_request.number } }" \
410+ gh pr comment "${PR_NUMBER }" \
371411 --body-file ./container-test-results.md \
372412 --edit-last 2>/dev/null || \
373- gh pr comment "${{ github.event.pull_request.number } }" \
413+ gh pr comment "${PR_NUMBER }" \
374414 --body-file ./container-test-results.md
375415
376416 - name : Upload test results
417+ if : ${{ needs.changes.outputs.code == 'true' }}
377418 uses : actions/upload-artifact@043fb46d1a93c77aae656e7c1c64a875d1fc6a0a # v7.0.1
378419 with :
379420 name : container-test-results
0 commit comments