ci: avoid "successful failure" of status check job by inspecting needs (#4918)

Thanks to @ryanec for this tip.
This commit is contained in:
Mitchell Hashimoto
2025-01-10 13:29:50 -08:00
committed by GitHub
2 changed files with 36 additions and 4 deletions

View File

@ -7,8 +7,24 @@ jobs:
needs: needs:
- check-zig-cache-hash - check-zig-cache-hash
steps: steps:
- name: Noop - id: status
run: echo "Required Checks Met" name: Determine status
run: |
results=$(tr -d '\n' <<< '${{ toJSON(needs.*.result) }}')
if ! grep -q -v -E '(failure|cancelled)' <<< "$results"; then
result="failed"
else
result="success"
fi
{
echo "result=${result}"
echo "results=${results}"
} | tee -a "$GITHUB_OUTPUT"
- if: always() && steps.status.outputs.result != 'success'
name: Check for failed status
run: |
echo "One or more required build workflows failed: ${{ steps.status.outputs.results }}"
exit 1
check-zig-cache-hash: check-zig-cache-hash:
if: github.repository == 'ghostty-org/ghostty' if: github.repository == 'ghostty-org/ghostty'

View File

@ -26,8 +26,24 @@ jobs:
- typos - typos
- test-pkg-linux - test-pkg-linux
steps: steps:
- name: Noop - id: status
run: echo "Required Checks Met" name: Determine status
run: |
results=$(tr -d '\n' <<< '${{ toJSON(needs.*.result) }}')
if ! grep -q -v -E '(failure|cancelled)' <<< "$results"; then
result="failed"
else
result="success"
fi
{
echo "result=${result}"
echo "results=${results}"
} | tee -a "$GITHUB_OUTPUT"
- if: always() && steps.status.outputs.result != 'success'
name: Check for failed status
run: |
echo "One or more required build workflows failed: ${{ steps.status.outputs.results }}"
exit 1
build: build:
strategy: strategy: