Skip to content

Commit b48fed7

Browse files
authored
Add final-status for CI jobs (#2725)
2 parents 3093adb + 5bd4182 commit b48fed7

File tree

1 file changed

+16
-0
lines changed

1 file changed

+16
-0
lines changed

.github/workflows/ci.yml

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -103,3 +103,19 @@ jobs:
103103
check_name: JUnit ${{ matrix.kind }} ${{ matrix.jre }} ${{ matrix.os }}
104104
report_paths: '*/build/test-results/*/TEST-*.xml'
105105
check_retries: true
106+
107+
# Status check that is required in branch protection rules.
108+
final-status:
109+
needs:
110+
- build
111+
runs-on: ubuntu-latest
112+
if: always()
113+
steps:
114+
- name: Check
115+
run: |
116+
results=$(tr -d '\n' <<< '${{ toJSON(needs.*.result) }}')
117+
if ! grep -q -v -E '(failure|cancelled)' <<< "$results"; then
118+
echo "One or more required jobs failed"
119+
exit 1
120+
fi
121+
echo "All required jobs completed successfully."

0 commit comments

Comments
 (0)