Skip to content

Commit 1723ded

Browse files
Merge pull request #11071 from kikofernandez/kiko/otp/release-gh-action-backup-continuation/OTP-20040
otp: add ruleset check in main.yaml OTP-20040
2 parents ade6efa + d33a0e9 commit 1723ded

1 file changed

Lines changed: 47 additions & 0 deletions

File tree

.github/workflows/main.yaml

Lines changed: 47 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -321,3 +321,50 @@ jobs:
321321
persist-credentials: false
322322
- name: Run zizmor
323323
uses: zizmorcore/zizmor-action@71321a20a9ded102f6e9ce5718a2fcec2c4f70d8 # ratchet:zizmorcore/zizmor-action@v0.5.2
324+
325+
# This job checks that the most important jobs are successful.
326+
# the use of conditionals, e.g., `if:` at the job level makes
327+
# the jobs included in the GH Settngs Ruleset to fail.
328+
# Instead of removing those jobs from being tested or letting
329+
# them fail, the script below marks as OK a skipped job.
330+
# a failed job is a failure, and an success job is success.
331+
ruleset-checker:
332+
name: Ruleset Checker
333+
runs-on: ubuntu-latest
334+
if: always()
335+
needs:
336+
- pack
337+
- build-macos
338+
- build-ios
339+
- build-windows
340+
- build-flavors
341+
- build
342+
- freebsd
343+
- openbsd
344+
- solaris
345+
- documentation
346+
- static
347+
- test
348+
- system-test
349+
- sbom
350+
- zizmor
351+
steps:
352+
- name: Check Ruleset Results
353+
shell: bash
354+
env:
355+
RESULTS: ${{ toJSON(needs) }}
356+
run: |
357+
failed=false
358+
while IFS= read -r entry; do
359+
name=$(echo "$entry" | jq -r '.[0]')
360+
result=$(echo "$entry" | jq -r '.[1]')
361+
if [[ "$result" == "failure" || "$result" == "cancelled" ]]; then
362+
echo "❌ Job '$name' was: $result"
363+
failed=true
364+
else
365+
echo "✅ Job '$name' was: $result"
366+
fi
367+
done < <(echo "$RESULTS" | jq -c 'to_entries[] | [.key, .value.result]')
368+
if [[ "$failed" == "true" ]]; then
369+
exit 1
370+
fi

0 commit comments

Comments
 (0)