Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

build-test-all-branches.yml: fail if a triggered workflow fail #10885

Merged
merged 1 commit into from
Dec 19, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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

Loading