mirror of
https://github.com/koala73/worldmonitor.git
synced 2026-04-25 17:14:57 +02:00
* fix(readme): replace broken docs.worldmonitor.app link with relative path The docs.worldmonitor.app domain no longer resolves. Replace with relative path to docs/data-sources.mdx. Fixes #2616 Supersedes #2619 Co-authored-by: fuleinist <fuleinist@gmail.com> * docs(readme): update data sources count from 30+ to 65+ * docs(readme): update data source categories to reflect full coverage * fix(ci): unblock docs-only PRs from required check deadlock Move paths-ignore from workflow triggers to job-level `if:` conditions. When a workflow uses paths-ignore at the trigger level, GitHub never creates the check run, so required checks stay "Waiting" forever. Job-level skips via `if:` report as passed, satisfying branch protection. Also update deploy-gate to treat "skipped" conclusions as passing. --------- Co-authored-by: fuleinist <fuleinist@gmail.com>
70 lines
2.6 KiB
YAML
70 lines
2.6 KiB
YAML
name: Deploy Gate
|
|
|
|
# Runs whenever Test or Typecheck completes on a PR/push.
|
|
# Checks whether BOTH workflows have passed for the same commit SHA.
|
|
# Posts a commit status on the PR's head SHA so branch protection can see it.
|
|
|
|
on:
|
|
workflow_run:
|
|
workflows: ["Test", "Typecheck"]
|
|
types: [completed]
|
|
|
|
permissions:
|
|
statuses: write
|
|
|
|
jobs:
|
|
gate:
|
|
runs-on: ubuntu-latest
|
|
steps:
|
|
- name: Check unit + typecheck both passed for this SHA
|
|
env:
|
|
GH_TOKEN: ${{ github.token }}
|
|
REPO: ${{ github.repository }}
|
|
SHA: ${{ github.event.workflow_run.head_sha }}
|
|
run: |
|
|
# Poll check-runs for this SHA and find the latest result for each required job
|
|
runs=$(gh api "repos/$REPO/commits/$SHA/check-runs" \
|
|
--jq '.check_runs | map(select(.name == "unit" or .name == "typecheck"))')
|
|
|
|
unit=$(echo "$runs" | python3 -c "
|
|
import sys, json
|
|
runs = json.load(sys.stdin)
|
|
matches = [r for r in runs if r['name'] == 'unit']
|
|
if not matches: print('pending')
|
|
else: print(sorted(matches, key=lambda r: r.get('completed_at') or '')[-1]['conclusion'] or 'pending')
|
|
")
|
|
|
|
typecheck=$(echo "$runs" | python3 -c "
|
|
import sys, json
|
|
runs = json.load(sys.stdin)
|
|
matches = [r for r in runs if r['name'] == 'typecheck']
|
|
if not matches: print('pending')
|
|
else: print(sorted(matches, key=lambda r: r.get('completed_at') or '')[-1]['conclusion'] or 'pending')
|
|
")
|
|
|
|
echo "unit=$unit typecheck=$typecheck"
|
|
|
|
if [ "$unit" = "pending" ] || [ "$typecheck" = "pending" ]; then
|
|
gh api "repos/$REPO/statuses/$SHA" --method POST \
|
|
--field state="pending" \
|
|
--field context="gate" \
|
|
--field description="Waiting for unit + typecheck to complete"
|
|
exit 0
|
|
fi
|
|
|
|
# Treat "skipped" as passing (docs-only PRs skip code checks)
|
|
for v in "$unit" "$typecheck"; do
|
|
if [ "$v" != "success" ] && [ "$v" != "skipped" ]; then
|
|
gh api "repos/$REPO/statuses/$SHA" --method POST \
|
|
--field state="failure" \
|
|
--field context="gate" \
|
|
--field description="Required checks did not pass (unit=$unit typecheck=$typecheck)"
|
|
exit 0
|
|
fi
|
|
done
|
|
|
|
gh api "repos/$REPO/statuses/$SHA" --method POST \
|
|
--field state="success" \
|
|
--field context="gate" \
|
|
--field description="unit + typecheck both passed"
|