@@ -8,6 +8,29 @@ name: Pull request
88' on ' :
99 pull_request :
1010jobs :
11+ # Detect which files have changed and use this to run jobs conditionally.
12+ # Note that we can't use the workflow-level paths attribute since this
13+ # would skip the workflow entirely, and would prevent us from making the
14+ # aio jobs required to pass (a skip counts as a pass).
15+ check-changes :
16+ runs-on : ubuntu-20.04
17+ permissions :
18+ pull-requests : read
19+ name : Check changed files
20+ if : github.repository == 'stackhpc/stackhpc-kayobe-config'
21+ outputs :
22+ aio : ${{ steps.changes.outputs.aio }}
23+ steps :
24+ - name : GitHub Checkout
25+ uses : actions/checkout@v3
26+
27+ - name : Check changed files
28+ uses : dorny/paths-filter@v2
29+ id : changes
30+ with :
31+ # Filters are defined in this file.
32+ filters : .github/path-filters.yml
33+
1134 tox :
1235 runs-on : ubuntu-22.04
1336 permissions : {}
3659 - name : Run Tox ${{ matrix.environment }} 🧪
3760 run : tox -e ${{ matrix.environment }}
3861
62+ # A skipped job is treated as success when used as a required status check.
63+ # The registered required status checks refer to the name of the job in the
64+ # called reusable workflow rather than the jobs in this file. The following
65+ # jobs need to run unconditionally to allow GitHub required status checks to
66+ # pass even when there are changed files. The `! failure()` condition runs
67+ # when the parent jobs completed successfully or were skipped. We pass an
68+ # 'if' argument to the called workflow to allow running it conditionally.
69+
3970 build-kayobe-image :
4071 name : Build Kayobe Image
72+ needs :
73+ - check-changes
4174 uses : ./.github/workflows/stackhpc-build-kayobe-image.yml
75+ with :
76+ if : ${{ needs.check-changes.outputs.aio == 'true' }}
4277 if : github.repository == 'stackhpc/stackhpc-kayobe-config'
4378
4479 all-in-one-ubuntu-jammy-ovs :
5489 neutron_plugin : ovs
5590 OS_CLOUD : sms-lab-release
5691 secrets : inherit
57- if : github.repository == 'stackhpc/stackhpc-kayobe-config'
92+ if : ${{ ! failure() && github.repository == 'stackhpc/stackhpc-kayobe-config' }}
5893
5994 all-in-one-ubuntu-jammy-ovn :
6095 name : aio (Ubuntu Jammy OVN)
69104 neutron_plugin : ovn
70105 OS_CLOUD : sms-lab-release
71106 secrets : inherit
72- if : github.repository == 'stackhpc/stackhpc-kayobe-config'
107+ if : ${{ ! failure() && github.repository == 'stackhpc/stackhpc-kayobe-config' }}
73108
74109 all-in-one-rocky-9-ovs :
75110 name : aio (Rocky 9 OVS)
84119 neutron_plugin : ovs
85120 OS_CLOUD : sms-lab-release
86121 secrets : inherit
87- if : github.repository == 'stackhpc/stackhpc-kayobe-config'
122+ if : ${{ ! failure() && github.repository == 'stackhpc/stackhpc-kayobe-config' }}
88123
89124 all-in-one-rocky-9-ovn :
90125 name : aio (Rocky 9 OVN)
98133 ssh_username : cloud-user
99134 neutron_plugin : ovn
100135 OS_CLOUD : sms-lab-release
136+ if : ${{ needs.check-changes.outputs.aio == 'true' }}
101137 secrets : inherit
102- if : github.repository == 'stackhpc/stackhpc-kayobe-config'
138+ if : ${{ ! failure() && github.repository == 'stackhpc/stackhpc-kayobe-config' }}
0 commit comments