@@ -238,3 +238,56 @@ jobs:
238238 badge-title : ${{ matrix.scope }}
239239 path : " **/report/*.xml"
240240 reporter : java-junit
241+
242+ ci-pending :
243+ name : Set CI Pending
244+ runs-on : ubuntu-latest
245+ steps :
246+ - name : Set status check to pending
247+ env :
248+ GH_TOKEN : ${{ github.token }}
249+ run : |
250+ gh api \
251+ --method POST \
252+ -H "Accept: application/vnd.github+json" \
253+ -H "X-GitHub-Api-Version: 2022-11-28" \
254+ /repos/${{ github.repository }}/statuses/${{ github.sha }} \
255+ -f state=pending \
256+ -f target_url='${{ github.server_url }}/${{ github.repository }}/actions/runs/${{ github.run_id }}' \
257+ -f description='Waiting for CI workflow to complete' \
258+ -f context='Mergeable Check'
259+
260+ ci-success :
261+ name : CI Success Check
262+ runs-on : ubuntu-latest
263+ needs : [ ci-pending, lint, bundle, build_and_test, helm-validate, helm-test, e2e-test ]
264+ if : always()
265+ steps :
266+ - name : Determine CI status
267+ id : status
268+ run : |
269+ if [[ "${{ contains(needs.*.result, 'failure') }}" == "true" || "${{ contains(needs.*.result, 'cancelled') }}" == "true" ]]; then
270+ echo "state=failure" >> $GITHUB_OUTPUT
271+ echo "description=One or more CI jobs failed or were cancelled" >> $GITHUB_OUTPUT
272+ echo "One or more jobs failed or were cancelled"
273+ exit 1
274+ else
275+ echo "state=success" >> $GITHUB_OUTPUT
276+ echo "description=All CI jobs passed successfully" >> $GITHUB_OUTPUT
277+ echo "All required jobs passed successfully"
278+ fi
279+
280+ - name : Create commit status
281+ if : always()
282+ env :
283+ GH_TOKEN : ${{ github.token }}
284+ run : |
285+ gh api \
286+ --method POST \
287+ -H "Accept: application/vnd.github+json" \
288+ -H "X-GitHub-Api-Version: 2022-11-28" \
289+ /repos/${{ github.repository }}/statuses/${{ github.sha }} \
290+ -f state='${{ steps.status.outputs.state || 'error' }}' \
291+ -f target_url='${{ github.server_url }}/${{ github.repository }}/actions/runs/${{ github.run_id }}' \
292+ -f description='${{ steps.status.outputs.description || 'CI workflow did not complete' }}' \
293+ -f context='Mergeable Check'
0 commit comments