Skip to content

Commit 31677c0

Browse files
sredny buitragosredny buitrago
authored andcommitted
added template for aggregator
1 parent b6ccab9 commit 31677c0

1 file changed

Lines changed: 32 additions & 0 deletions

File tree

.github/workflows/aggregator.yml

Lines changed: 32 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,32 @@
1+
name: Aggregated CI Status
2+
on:
3+
workflow_call:
4+
inputs:
5+
jobs:
6+
description: "List of job names to aggregate"
7+
required: true
8+
type: string
9+
10+
jobs:
11+
aggregator:
12+
name: Aggregated CI Status
13+
runs-on: ubuntu-latest
14+
if: ${{ always() }}
15+
needs: ${{ fromJson(inputs.jobs) }}
16+
steps:
17+
- name: Aggregate results
18+
run: |
19+
failed=()
20+
for job in ${{ inputs.jobs }}; do
21+
result=$(eval echo '${{ needs.'$job'.result }}')
22+
if [ "$result" != "success" ]; then
23+
failed+=("$job")
24+
fi
25+
done
26+
27+
if [ ${#failed[@]} -ne 0 ]; then
28+
echo "❌ Failed jobs: ${failed[*]}"
29+
exit 1
30+
fi
31+
32+
echo "✅ All required jobs succeeded"

0 commit comments

Comments
 (0)