Skip to content

Commit

Permalink
build-test-all-branches.yml: fail if a triggered workflow fail
Browse files Browse the repository at this point in the history
  • Loading branch information
thomas-roos committed Dec 19, 2024
1 parent 07e840e commit a75fa93
Showing 1 changed file with 12 additions and 1 deletion.
13 changes: 12 additions & 1 deletion .github/workflows/build-test-all-branches.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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

0 comments on commit a75fa93

Please sign in to comment.