From a75fa93bc2523eb6d374efb3d37851aa1abba2bb Mon Sep 17 00:00:00 2001 From: tro Date: Thu, 19 Dec 2024 06:57:31 +0100 Subject: [PATCH] build-test-all-branches.yml: fail if a triggered workflow fail --- .github/workflows/build-test-all-branches.yml | 13 ++++++++++++- 1 file changed, 12 insertions(+), 1 deletion(-) diff --git a/.github/workflows/build-test-all-branches.yml b/.github/workflows/build-test-all-branches.yml index f11e84ef2..95edb3385 100644 --- a/.github/workflows/build-test-all-branches.yml +++ b/.github/workflows/build-test-all-branches.yml @@ -112,15 +112,26 @@ jobs: sleep 60 done - - name: Report status + - name: Report status and check for failures env: GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} run: | echo "All branch workflows have completed." IFS=' ' read -ra run_ids <<< "${{ env.run_ids }}" + overall_status=0 for run_id in "${run_ids[@]}"; do run_info=$(gh run view $run_id --json headBranch,conclusion) branch=$(echo "$run_info" | jq -r '.headBranch') conclusion=$(echo "$run_info" | jq -r '.conclusion') echo "Branch $branch workflow conclusion: $conclusion" + if [ "$conclusion" != "success" ]; then + overall_status=1 + fi done + if [ $overall_status -ne 0 ]; then + echo "One or more branch workflows failed." + exit 1 + else + echo "All branch workflows succeeded." + fi +