stack/.github/workflows/all-good.yaml
Konsti Wohlwend b41681d1e4
Some checks failed
All good? / all-good (push) Has been cancelled
Update pull request branches / Update pull request branches (push) Has been cancelled
Ensure Prisma migrations are in sync with the schema / check_prisma_migrations (22.x) (push) Has been cancelled
Docker Build and Push / Docker Build and Push Server (push) Has been cancelled
Docker Test / docker (push) Has been cancelled
Runs E2E API Tests / build (20.x) (push) Has been cancelled
Runs E2E API Tests / build (22.x) (push) Has been cancelled
Runs E2E API Tests / build (latest) (push) Has been cancelled
Lint & build / lint_and_build (20.x) (push) Has been cancelled
Lint & build / lint_and_build (22.x) (push) Has been cancelled
Mirror main branch to main-mirror-for-wdb / lint_and_build (push) Has been cancelled
Publish Docs / run (push) Has been cancelled
Dev Environment Test / test (push) Has been cancelled
Run setup tests / test (push) Has been cancelled
TOC Generator / TOC Generator (push) Has been cancelled
Reduce test flakeyness (#517)
2025-03-07 13:34:50 -08:00

47 lines
1.5 KiB
YAML

name: All good?
on: push
jobs:
all-good:
runs-on: ubuntu-latest
env:
REPO: ${{ github.repository }}
COMMIT: ${{ github.sha }}
steps:
- name: Wait for 60 seconds
run: sleep 60
- name: Poll Checks API until complete
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
run: |
echo "Checking check runs for commit ${COMMIT} in repo ${REPO}..."
while true; do
response=$(curl -s -H "Authorization: Bearer ${GITHUB_TOKEN}" \
"https://api.github.com/repos/${REPO}/commits/${COMMIT}/check-runs")
total=$(echo "$response" | jq -r '.total_count')
if [ "$total" -eq 0 ]; then
echo "No check runs found for commit ${COMMIT}. Waiting..."
sleep 10
continue
fi
pending=$(echo "$response" | jq '[.check_runs[] | select(.status != "completed" and .name != "all-good")] | length')
if [ "$pending" -gt 0 ]; then
echo "$pending check run(s) still in progress. Waiting..."
sleep 10
continue
fi
failed=$(echo "$response" | jq '[.check_runs[] | select(.conclusion != "success" and .name != "all-good")] | length')
if [ "$failed" -eq 0 ]; then
echo "All check runs passed!"
exit 0
else
echo "Some check runs failed. Exiting with error."
exit 1
fi
done