Skip to content

Commit a018310

Browse files
committed
[gha] fix skipped jobs to pass required checks
1 parent f4a06b8 commit a018310

File tree

1 file changed

+21
-0
lines changed

1 file changed

+21
-0
lines changed

.github/workflows/build.yml

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -138,6 +138,8 @@ jobs:
138138
if: |
139139
(needs.configuration.outputs.pr_no_diff_skip != 'true')
140140
runs-on: [ self-hosted ]
141+
outputs:
142+
success: ${{ job.status }}
141143
concurrency:
142144
group: ${{ github.head_ref || github.ref_name }}-build-gitpod
143145
# For the main branch we always want the build job to run to completion
@@ -281,6 +283,25 @@ jobs:
281283
path: |
282284
test-coverage-report
283285
286+
# A skipped check counts as passed in gh actions - so there can be a case where
287+
# build-gitpod never ran, and a PR got merged regardless
288+
# this should provide a workaround to that and provide a check we can always use as a required
289+
ci-check:
290+
runs-on: [ self-hosted ]
291+
if: always() # always run, so we never skip the check
292+
needs: [ build-gitpod ]
293+
steps:
294+
# pass step only when the output of build-gitpod job is set
295+
- run: |
296+
passed="${{ needs.build-gitpod.outputs.success }}"
297+
if [[ $passed == "true" ]]; then
298+
echo "build-gitpod passed"
299+
exit 0
300+
else
301+
echo "build-gitpod failed"
302+
exit 1
303+
fi
304+
284305
install:
285306
name: "Install Gitpod"
286307
needs: [ configuration, build-previewctl, build-gitpod, infrastructure ]

0 commit comments

Comments
 (0)