Skip to content

Commit 1a67e09

Browse files
committed
Add a build verdict job
Add a build verdict job that will fail when any dependent workflow fails. The workflow also emits, on the console, all required job names that failed.
1 parent 497d9ab commit 1a67e09

1 file changed

Lines changed: 30 additions & 0 deletions

File tree

.github/workflows/pull_request.yml

Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -132,3 +132,33 @@ jobs:
132132
shell_check_enabled: false
133133
yamllint_check_enabled: false
134134
python_lint_check_enabled: false
135+
136+
build-verdict:
137+
name: Build Verdict
138+
needs:
139+
- tests_with_docker_embedded_swift
140+
- tests_with_docker
141+
- tests_without_docker
142+
- tests_macos
143+
- build_tests_ios
144+
- soundness
145+
- proposal_validation
146+
- soundness-docs
147+
runs-on: ubuntu-latest
148+
if: always() # Runs even if previous jobs fail so it can evaluate them
149+
steps:
150+
- name: Install required tools
151+
run: |
152+
sudo apt-get update
153+
sudo apt-get install -y --no-install-recommends coreutils jq
154+
- name: Check upstream job statuses
155+
env:
156+
NEEDS_JSON: ${{ toJSON(needs) }}
157+
run: |
158+
failed=$(printf '%s' "$NEEDS_JSON" | jq -r 'to_entries | map(select(.value.result != "success")) | .[] | "\(.key): \(.value.result)"')
159+
if [ -n "$failed" ]; then
160+
echo "The following required jobs did not succeed:"
161+
printf '%s\n' "$failed"
162+
exit 1
163+
fi
164+
echo "All required jobs passed successfully!"

0 commit comments

Comments
 (0)