@@ -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 : {}
@@ -36,14 +59,27 @@ jobs:
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 :
4580 name : aio (Ubuntu Jammy OVS)
4681 needs :
82+ - check-changes
4783 - build-kayobe-image
4884 uses : ./.github/workflows/stackhpc-all-in-one.yml
4985 with :
@@ -53,12 +89,14 @@ jobs:
5389 ssh_username : ubuntu
5490 neutron_plugin : ovs
5591 OS_CLOUD : sms-lab-release
92+ if : ${{ needs.check-changes.outputs.aio == 'true' }}
5693 secrets : inherit
57- if : github.repository == 'stackhpc/stackhpc-kayobe-config'
94+ if : ${{ ! failure() && github.repository == 'stackhpc/stackhpc-kayobe-config' }}
5895
5996 all-in-one-ubuntu-jammy-ovn :
6097 name : aio (Ubuntu Jammy OVN)
6198 needs :
99+ - check-changes
62100 - build-kayobe-image
63101 uses : ./.github/workflows/stackhpc-all-in-one.yml
64102 with :
@@ -68,12 +106,14 @@ jobs:
68106 ssh_username : ubuntu
69107 neutron_plugin : ovn
70108 OS_CLOUD : sms-lab-release
109+ if : ${{ needs.check-changes.outputs.aio == 'true' }}
71110 secrets : inherit
72- if : github.repository == 'stackhpc/stackhpc-kayobe-config'
111+ if : ${{ ! failure() && github.repository == 'stackhpc/stackhpc-kayobe-config' }}
73112
74113 all-in-one-rocky-9-ovs :
75114 name : aio (Rocky 9 OVS)
76115 needs :
116+ - check-changes
77117 - build-kayobe-image
78118 uses : ./.github/workflows/stackhpc-all-in-one.yml
79119 with :
@@ -83,12 +123,14 @@ jobs:
83123 ssh_username : cloud-user
84124 neutron_plugin : ovs
85125 OS_CLOUD : sms-lab-release
126+ if : ${{ needs.check-changes.outputs.aio == 'true' }}
86127 secrets : inherit
87- if : github.repository == 'stackhpc/stackhpc-kayobe-config'
128+ if : ${{ ! failure() && github.repository == 'stackhpc/stackhpc-kayobe-config' }}
88129
89130 all-in-one-rocky-9-ovn :
90131 name : aio (Rocky 9 OVN)
91132 needs :
133+ - check-changes
92134 - build-kayobe-image
93135 uses : ./.github/workflows/stackhpc-all-in-one.yml
94136 with :
98140 ssh_username : cloud-user
99141 neutron_plugin : ovn
100142 OS_CLOUD : sms-lab-release
143+ if : ${{ needs.check-changes.outputs.aio == 'true' }}
101144 secrets : inherit
102- if : github.repository == 'stackhpc/stackhpc-kayobe-config'
145+ if : ${{ ! failure() && github.repository == 'stackhpc/stackhpc-kayobe-config' }}
0 commit comments