Skip to content

Commit 953c5fa

Browse files
committed
improve IT action failure message
Use the github api to retrieve links to all the failed matrix builds for presentation in the aggregate step. Note the aggregate step exists so that we have a single job we can point at from our branch protection rules. Signed-off-by: Robert Young <robertyoungnz@gmail.com>
1 parent b4395ad commit 953c5fa

1 file changed

Lines changed: 17 additions & 1 deletion

File tree

.github/workflows/integration-tests.yaml

Lines changed: 17 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -85,9 +85,25 @@ jobs:
8585
runs-on: ubuntu-latest
8686
needs: run_integration_tests
8787
if: always()
88+
permissions:
89+
actions: read
8890
steps:
8991
- name: 'Check all matrix builds'
90-
run: ${{!contains(needs.*.result, 'failure')}}
92+
env:
93+
GH_TOKEN: ${{ github.token }}
94+
run: |
95+
FAILED_JSON=$(gh api repos/${{ github.repository }}/actions/runs/${{ github.run_id }}/jobs \
96+
--jq '.jobs[] | select(.conclusion=="failure") | {name: .name, url: .html_url}')
97+
if [ -z "$FAILED_JSON" ]; then
98+
echo "All jobs passed!" >> $GITHUB_STEP_SUMMARY
99+
echo "No failures detected."
100+
exit 0
101+
fi
102+
echo "Failed Matrix Jobs" >> $GITHUB_STEP_SUMMARY
103+
echo "The following instances failed:"
104+
echo "$FAILED_JSON" | jq -r '"* [\(.name)](\(.url))"' >> $GITHUB_STEP_SUMMARY
105+
echo "$FAILED_JSON" | jq -r '"\(.name): \(.url)"'
106+
exit 1
91107
integration_test_filter_archetype:
92108
runs-on: ubuntu-latest
93109
steps:

0 commit comments

Comments
 (0)