Check adopter feeds #59
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| # Daily health check of the registered adopter feeds. scripts/check-feeds.mjs does | |
| # the work (fetch + validate + issue management); this workflow only persists what | |
| # has to survive between runs: the private failure window (.github/feed-health.json) | |
| # and the public status the site serves (docs/data/feed-health.json). Both are | |
| # written to only when something actually changes, so a healthy registry produces | |
| # no daily commit. | |
| # | |
| # It also runs on a push that edits the registry: the site reads the version and | |
| # licence badges out of docs/data/feed-health.json, joined by feed URL, so a newly | |
| # registered adopter renders without badges until this check has seen it once. | |
| # Waiting for the next cron would leave that gap open for up to a day. The push | |
| # trigger cannot loop — this workflow only ever writes the two feed-health files, | |
| # never docs/data/adopters.json. | |
| name: Check adopter feeds | |
| on: | |
| schedule: | |
| - cron: "23 6 * * *" | |
| push: | |
| branches: [main] | |
| paths: | |
| - "docs/data/adopters.json" | |
| workflow_dispatch: | |
| permissions: | |
| contents: write | |
| issues: write | |
| # The failure window and the health issues are shared state; two runs writing them | |
| # at once would race on the push. Queue instead of cancelling: a cancelled run would | |
| # drop a tick from the window it is supposed to be measuring. | |
| concurrency: | |
| group: check-feeds | |
| cancel-in-progress: false | |
| jobs: | |
| check: | |
| runs-on: ubuntu-latest | |
| steps: | |
| - uses: actions/checkout@v4 | |
| - uses: actions/setup-node@v4 | |
| with: | |
| node-version: 20 | |
| cache: npm | |
| - run: npm ci | |
| - name: Check feeds | |
| env: | |
| GITHUB_TOKEN: ${{ github.token }} | |
| # A schema error or a 404 is the publisher's to fix: report it after two | |
| # runs. A timeout or a 5xx has to dominate the window before it is worth | |
| # an issue — feeds are slow for a morning all the time. | |
| FEED_HARD_THRESHOLD: "2" | |
| FEED_TRANSIENT_THRESHOLD: "5" | |
| FEED_WINDOW: "7" | |
| run: node scripts/check-feeds.mjs | |
| - name: Persist health state | |
| run: | | |
| PATHS=".github/feed-health.json docs/data/feed-health.json" | |
| if [ -z "$(git status --porcelain -- $PATHS)" ]; then | |
| echo "Health state unchanged." | |
| exit 0 | |
| fi | |
| git config user.name "github-actions[bot]" | |
| git config user.email "41898282+github-actions[bot]@users.noreply.github.com" | |
| git add $PATHS | |
| git commit -m "chore(health): update feed failure counters [skip ci]" | |
| git pull --rebase origin "${GITHUB_REF_NAME}" | |
| git push origin HEAD:"${GITHUB_REF_NAME}" |