|
| 1 | +name: Docs uptime monitor |
| 2 | + |
| 3 | +# Runs the same browser smoke test against the LIVE docs site on a schedule, so a |
| 4 | +# broken production deploy (e.g. a dependency resolved differently on the host) is |
| 5 | +# caught even when no PR triggered it. A failed run notifies repo admins via GitHub's |
| 6 | +# default scheduled-workflow-failure email, and opens/updates an issue. |
| 7 | +on: |
| 8 | + schedule: |
| 9 | + - cron: "0 */6 * * *" # every 6 hours |
| 10 | + workflow_dispatch: |
| 11 | + |
| 12 | +permissions: |
| 13 | + contents: read |
| 14 | + issues: write |
| 15 | + |
| 16 | +jobs: |
| 17 | + monitor: |
| 18 | + name: Smoke-test live docs site |
| 19 | + runs-on: ubuntu-latest |
| 20 | + |
| 21 | + steps: |
| 22 | + - name: Checkout repository |
| 23 | + uses: actions/checkout@v7 |
| 24 | + |
| 25 | + - name: Setup Node.js |
| 26 | + uses: actions/setup-node@v6 |
| 27 | + with: |
| 28 | + node-version: 24 |
| 29 | + |
| 30 | + - name: Install dependencies |
| 31 | + run: npm ci |
| 32 | + |
| 33 | + - name: Install Playwright Chromium |
| 34 | + run: npx playwright install --with-deps chromium |
| 35 | + |
| 36 | + # DOCS_BASE_URL is the origin; the smoke test's routes carry the /file-selector basePath. |
| 37 | + - name: Smoke-test the live docs site |
| 38 | + run: npx playwright test -c playwright.docs.config.ts |
| 39 | + env: |
| 40 | + DOCS_BASE_URL: https://react-dropzone.github.io |
| 41 | + |
| 42 | + - name: Open an issue if the live site is down |
| 43 | + if: failure() |
| 44 | + uses: actions/github-script@v7 |
| 45 | + with: |
| 46 | + script: | |
| 47 | + const title = "Docs site smoke test failing"; |
| 48 | + const body = `The scheduled docs smoke test failed against https://react-dropzone.github.io/file-selector/.\n\nRun: ${context.serverUrl}/${context.repo.owner}/${context.repo.repo}/actions/runs/${context.runId}`; |
| 49 | + const existing = await github.rest.issues.listForRepo({ |
| 50 | + owner: context.repo.owner, |
| 51 | + repo: context.repo.repo, |
| 52 | + state: "open", |
| 53 | + labels: "docs-monitor" |
| 54 | + }); |
| 55 | + if (existing.data.length === 0) { |
| 56 | + await github.rest.issues.create({ |
| 57 | + owner: context.repo.owner, |
| 58 | + repo: context.repo.repo, |
| 59 | + title, |
| 60 | + body, |
| 61 | + labels: ["docs-monitor"] |
| 62 | + }); |
| 63 | + } |
0 commit comments