Skip to content

Commit cda7593

Browse files
authored
github/ci: Improve workflow conditions (envoyproxy#40002)
Signed-off-by: Ryan Northey <[email protected]>
1 parent a1219ad commit cda7593

16 files changed

+167
-88
lines changed

.github/workflows/envoy-checks.yml

Lines changed: 13 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -35,9 +35,11 @@ jobs:
3535
contents: read
3636
packages: read
3737
pull-requests: read
38-
if: >-
39-
${{ github.event.workflow_run.conclusion == 'success'
40-
&& (github.repository == 'envoyproxy/envoy' || vars.ENVOY_CI) }}
38+
if: |
39+
github.event.workflow_run.conclusion == 'success'
40+
&& github.event.workflow_run.head_repository.full_name == github.repository
41+
&& contains(fromJSON('["pull_request_target", "push", "schedule"]'), github.event.workflow_run.event)
42+
&& (github.repository == 'envoyproxy/envoy' || vars.ENVOY_CI)
4143
uses: ./.github/workflows/_load.yml
4244
with:
4345
check-name: checks
@@ -106,12 +108,14 @@ jobs:
106108
actions: read
107109
contents: read
108110
pull-requests: read
109-
if: >-
110-
${{ always()
111-
&& github.event.workflow_run.conclusion == 'success'
112-
&& (fromJSON(needs.load.outputs.request).run.check-build
113-
|| fromJSON(needs.load.outputs.request).run.check-coverage
114-
|| fromJSON(needs.load.outputs.request).run.check-san) }}
111+
if: |
112+
always()
113+
&& github.event.workflow_run.conclusion == 'success'
114+
&& github.event.workflow_run.head_repository.full_name == github.repository
115+
&& contains(fromJSON('["pull_request_target", "push", "schedule"]'), github.event.workflow_run.event)
116+
&& (fromJSON(needs.load.outputs.request).run.check-build
117+
|| fromJSON(needs.load.outputs.request).run.check-coverage
118+
|| fromJSON(needs.load.outputs.request).run.check-san)
115119
needs:
116120
- load
117121
- build

.github/workflows/envoy-macos.yml

Lines changed: 10 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,10 @@ jobs:
3030
contents: read
3131
packages: read
3232
pull-requests: read
33-
if: ${{ github.event.workflow_run.conclusion == 'success' }}
33+
if: |
34+
github.event.workflow_run.conclusion == 'success'
35+
&& github.event.workflow_run.head_repository.full_name == github.repository
36+
&& contains(fromJSON('["pull_request_target", "push", "schedule"]'), github.event.workflow_run.event)
3437
uses: ./.github/workflows/_load.yml
3538
with:
3639
check-name: macos
@@ -81,10 +84,12 @@ jobs:
8184
secrets:
8285
app-id: ${{ secrets.ENVOY_CI_APP_ID }}
8386
app-key: ${{ secrets.ENVOY_CI_APP_KEY }}
84-
if: >-
85-
${{ always()
86-
&& github.event.workflow_run.conclusion == 'success'
87-
&& fromJSON(needs.load.outputs.request).run.build-macos }}
87+
if: |
88+
always()
89+
&& github.event.workflow_run.conclusion == 'success'
90+
&& github.event.workflow_run.head_repository.full_name == github.repository
91+
&& contains(fromJSON('["pull_request_target", "push", "schedule"]'), github.event.workflow_run.event)
92+
&& fromJSON(needs.load.outputs.request).run.build-macos
8893
needs:
8994
- load
9095
- macos

.github/workflows/envoy-prechecks.yml

Lines changed: 12 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,10 @@ jobs:
3333
contents: read
3434
packages: read
3535
pull-requests: read
36-
if: ${{ github.event.workflow_run.conclusion == 'success' }}
36+
if: |
37+
github.event.workflow_run.conclusion == 'success'
38+
&& github.event.workflow_run.head_repository.full_name == github.repository
39+
&& contains(fromJSON('["pull_request_target", "push", "schedule"]'), github.event.workflow_run.event)
3740
uses: ./.github/workflows/_load.yml
3841
with:
3942
check-name: prechecks
@@ -102,12 +105,14 @@ jobs:
102105
actions: read
103106
contents: read
104107
pull-requests: read
105-
if: >-
106-
${{ always()
107-
&& github.event.workflow_run.conclusion == 'success'
108-
&& (fromJSON(needs.load.outputs.request).run.precheck-format
109-
|| fromJSON(needs.load.outputs.request).run.precheck-deps
110-
|| fromJSON(needs.load.outputs.request).run.precheck-publish) }}
108+
if: |
109+
always()
110+
&& github.event.workflow_run.conclusion == 'success'
111+
&& github.event.workflow_run.head_repository.full_name == github.repository
112+
&& contains(fromJSON('["pull_request_target", "push", "schedule"]'), github.event.workflow_run.event)
113+
&& (fromJSON(needs.load.outputs.request).run.precheck-format
114+
|| fromJSON(needs.load.outputs.request).run.precheck-deps
115+
|| fromJSON(needs.load.outputs.request).run.precheck-publish)
111116
needs:
112117
- load
113118
- format

.github/workflows/envoy-publish.yml

Lines changed: 12 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -38,9 +38,11 @@ jobs:
3838
contents: read
3939
packages: read
4040
pull-requests: read
41-
if: >-
42-
${{ github.event.workflow_run.conclusion == 'success'
43-
&& (github.repository == 'envoyproxy/envoy' || vars.ENVOY_CI) }}
41+
if: |
42+
github.event.workflow_run.conclusion == 'success'
43+
&& github.event.workflow_run.head_repository.full_name == github.repository
44+
&& contains(fromJSON('["pull_request_target", "push", "schedule"]'), github.event.workflow_run.event)
45+
&& (github.repository == 'envoyproxy/envoy' || vars.ENVOY_CI)
4446
uses: ./.github/workflows/_load.yml
4547
with:
4648
check-name: publish
@@ -117,10 +119,13 @@ jobs:
117119
actions: read
118120
contents: read
119121
pull-requests: read
120-
if: >-
121-
${{ always()
122-
&& (fromJSON(needs.load.outputs.request).run.publish
123-
|| fromJSON(needs.load.outputs.request).run.verify) }}
122+
if: |
123+
always()
124+
&& github.event.workflow_run.conclusion == 'success'
125+
&& github.event.workflow_run.head_repository.full_name == github.repository
126+
&& contains(fromJSON('["pull_request_target", "push", "schedule"]'), github.event.workflow_run.event)
127+
&& (fromJSON(needs.load.outputs.request).run.publish
128+
|| fromJSON(needs.load.outputs.request).run.verify)
124129
needs:
125130
- load
126131
- build

.github/workflows/mobile-android_build.yml

Lines changed: 10 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,10 @@ jobs:
3030
contents: read
3131
packages: read
3232
pull-requests: read
33-
if: ${{ github.event.workflow_run.conclusion == 'success' }}
33+
if: |
34+
github.event.workflow_run.conclusion == 'success'
35+
&& github.event.workflow_run.head_repository.full_name == github.repository
36+
&& contains(fromJSON('["pull_request_target", "push", "schedule"]'), github.event.workflow_run.event)
3437
uses: ./.github/workflows/_load.yml
3538
with:
3639
check-name: mobile-android
@@ -168,10 +171,12 @@ jobs:
168171
actions: read
169172
contents: read
170173
pull-requests: read
171-
if: >-
172-
${{ always()
173-
&& github.event.workflow_run.conclusion == 'success'
174-
&& fromJSON(needs.load.outputs.request).run.mobile-android }}
174+
if: |
175+
always()
176+
&& github.event.workflow_run.conclusion == 'success'
177+
&& github.event.workflow_run.head_repository.full_name == github.repository
178+
&& contains(fromJSON('["pull_request_target", "push", "schedule"]'), github.event.workflow_run.event)
179+
&& fromJSON(needs.load.outputs.request).run.mobile-android
175180
needs:
176181
- load
177182
- build

.github/workflows/mobile-android_tests.yml

Lines changed: 10 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,10 @@ jobs:
3030
contents: read
3131
packages: read
3232
pull-requests: read
33-
if: ${{ github.event.workflow_run.conclusion == 'success' }}
33+
if: |
34+
github.event.workflow_run.conclusion == 'success'
35+
&& github.event.workflow_run.head_repository.full_name == github.repository
36+
&& contains(fromJSON('["pull_request_target", "push", "schedule"]'), github.event.workflow_run.event)
3437
uses: ./.github/workflows/_load.yml
3538
with:
3639
check-name: mobile-android-tests
@@ -75,10 +78,12 @@ jobs:
7578
actions: read
7679
contents: read
7780
pull-requests: read
78-
if: >-
79-
${{ always()
80-
&& github.event.workflow_run.conclusion == 'success'
81-
&& fromJSON(needs.load.outputs.request).run.mobile-android-tests }}
81+
if: |
82+
always()
83+
&& github.event.workflow_run.conclusion == 'success'
84+
&& github.event.workflow_run.head_repository.full_name == github.repository
85+
&& contains(fromJSON('["pull_request_target", "push", "schedule"]'), github.event.workflow_run.event)
86+
&& fromJSON(needs.load.outputs.request).run.mobile-android-tests
8287
needs:
8388
- load
8489
- linux

.github/workflows/mobile-asan.yml

Lines changed: 10 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,10 @@ jobs:
3030
contents: read
3131
packages: read
3232
pull-requests: read
33-
if: ${{ github.event.workflow_run.conclusion == 'success' }}
33+
if: |
34+
github.event.workflow_run.conclusion == 'success'
35+
&& github.event.workflow_run.head_repository.full_name == github.repository
36+
&& contains(fromJSON('["pull_request_target", "push", "schedule"]'), github.event.workflow_run.event)
3437
uses: ./.github/workflows/_load.yml
3538
with:
3639
check-name: mobile-asan
@@ -59,10 +62,12 @@ jobs:
5962
permissions:
6063
actions: read
6164
contents: read
62-
if: >-
63-
${{ always()
64-
&& github.event.workflow_run.conclusion == 'success'
65-
&& fromJSON(needs.load.outputs.request).run.mobile-asan }}
65+
if: |
66+
always()
67+
&& github.event.workflow_run.conclusion == 'success'
68+
&& github.event.workflow_run.head_repository.full_name == github.repository
69+
&& contains(fromJSON('["pull_request_target", "push", "schedule"]'), github.event.workflow_run.event)
70+
&& fromJSON(needs.load.outputs.request).run.mobile-asan
6671
needs:
6772
- load
6873
- asan

.github/workflows/mobile-cc_tests.yml

Lines changed: 10 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,10 @@ jobs:
3030
contents: read
3131
packages: read
3232
pull-requests: read
33-
if: ${{ github.event.workflow_run.conclusion == 'success' }}
33+
if: |
34+
github.event.workflow_run.conclusion == 'success'
35+
&& github.event.workflow_run.head_repository.full_name == github.repository
36+
&& contains(fromJSON('["pull_request_target", "push", "schedule"]'), github.event.workflow_run.event)
3437
uses: ./.github/workflows/_load.yml
3538
with:
3639
check-name: mobile-cc
@@ -59,10 +62,12 @@ jobs:
5962
permissions:
6063
actions: read
6164
contents: read
62-
if: >-
63-
${{ always()
64-
&& github.event.workflow_run.conclusion == 'success'
65-
&& fromJSON(needs.load.outputs.request).run.mobile-cc }}
65+
if: |
66+
always()
67+
&& github.event.workflow_run.conclusion == 'success'
68+
&& github.event.workflow_run.head_repository.full_name == github.repository
69+
&& contains(fromJSON('["pull_request_target", "push", "schedule"]'), github.event.workflow_run.event)
70+
&& fromJSON(needs.load.outputs.request).run.mobile-cc
6671
needs:
6772
- load
6873
- cc-tests

.github/workflows/mobile-coverage.yml

Lines changed: 10 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,10 @@ jobs:
3030
contents: read
3131
packages: read
3232
pull-requests: read
33-
if: ${{ github.event.workflow_run.conclusion == 'success' }}
33+
if: |
34+
github.event.workflow_run.conclusion == 'success'
35+
&& github.event.workflow_run.head_repository.full_name == github.repository
36+
&& contains(fromJSON('["pull_request_target", "push", "schedule"]'), github.event.workflow_run.event)
3437
uses: ./.github/workflows/_load.yml
3538
with:
3639
check-name: mobile-coverage
@@ -76,10 +79,12 @@ jobs:
7679
permissions:
7780
actions: read
7881
contents: read
79-
if: >-
80-
${{ always()
81-
&& github.event.workflow_run.conclusion == 'success'
82-
&& fromJSON(needs.load.outputs.request).run.mobile-coverage }}
82+
if: |
83+
always()
84+
&& github.event.workflow_run.conclusion == 'success'
85+
&& github.event.workflow_run.head_repository.full_name == github.repository
86+
&& contains(fromJSON('["pull_request_target", "push", "schedule"]'), github.event.workflow_run.event)
87+
&& fromJSON(needs.load.outputs.request).run.mobile-coverage
8388
needs:
8489
- load
8590
- coverage

.github/workflows/mobile-docs.yml

Lines changed: 10 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,10 @@ jobs:
3030
contents: read
3131
packages: read
3232
pull-requests: read
33-
if: ${{ github.event.workflow_run.conclusion == 'success' }}
33+
if: |
34+
github.event.workflow_run.conclusion == 'success'
35+
&& github.event.workflow_run.head_repository.full_name == github.repository
36+
&& contains(fromJSON('["pull_request_target", "push", "schedule"]'), github.event.workflow_run.event)
3437
uses: ./.github/workflows/_load.yml
3538
with:
3639
check-name: mobile-docs
@@ -88,10 +91,12 @@ jobs:
8891
actions: read
8992
contents: read
9093
pull-requests: read
91-
if: >-
92-
${{ always()
93-
&& github.event.workflow_run.conclusion == 'success'
94-
&& fromJSON(needs.load.outputs.request).run.mobile-docs }}
94+
if: |
95+
always()
96+
&& github.event.workflow_run.conclusion == 'success'
97+
&& github.event.workflow_run.head_repository.full_name == github.repository
98+
&& contains(fromJSON('["pull_request_target", "push", "schedule"]'), github.event.workflow_run.event)
99+
&& fromJSON(needs.load.outputs.request).run.mobile-docs
95100
needs:
96101
- load
97102
- docs

0 commit comments

Comments
 (0)