diff --git a/.github/workflows/community-status.yml b/.github/workflows/community-status.yml new file mode 100644 index 00000000..d07f2758 --- /dev/null +++ b/.github/workflows/community-status.yml @@ -0,0 +1,51 @@ +name: Community server status + +# Checks the community server every ten minutes and keeps the result in +# status.json on the site-status branch, which the homepage's status line +# reads (docs/index.html). The branch holds that one file in a single +# commit, replaced each run, so main's history stays clean and nothing that +# builds or publishes runs on it. scripts/community-status.js does the check. + +on: + schedule: + - cron: '*/10 * * * *' + workflow_dispatch: + +permissions: + contents: write + +concurrency: + group: community-status + cancel-in-progress: false + +jobs: + check: + runs-on: ubuntu-latest + timeout-minutes: 5 + steps: + - name: Get the checker + uses: actions/checkout@v4 + with: + sparse-checkout: scripts/community-status.js + sparse-checkout-cone-mode: false + + - name: Get the last result + run: | + if git fetch --depth=1 origin site-status 2>/dev/null; then + git show FETCH_HEAD:status.json > previous.json 2>/dev/null || true + fi + + - name: Check the community server + run: node scripts/community-status.js status.json "$( [ -s previous.json ] && echo previous.json )" + + - name: Publish the result + run: | + mkdir publish + cp status.json publish/status.json + cd publish + git init -q -b site-status + git config user.name "github-actions[bot]" + git config user.email "41898282+github-actions[bot]@users.noreply.github.com" + git add status.json + git commit -q -m "Community server status" + git push -q --force "https://x-access-token:${{ github.token }}@github.com/${{ github.repository }}.git" site-status diff --git a/docs/index.html b/docs/index.html index 59c56ed6..31fdc5b8 100644 --- a/docs/index.html +++ b/docs/index.html @@ -149,6 +149,17 @@ .btn-secondary:hover { border-color: var(--ink); text-decoration: none; } .btn .ver { font-family: var(--mono); font-weight: 500; font-size: 14px; opacity: 0.85; } .actions .plain { font-size: 15px; } + /* The community server's status, under the join button. */ + .server-status { display: grid; grid-template-columns: 9px 1fr; column-gap: 10px; row-gap: 2px; margin: 16px 0 0; font-size: 14px; color: var(--muted); } + .server-status .dot { align-self: start; margin-top: 6px; width: 9px; height: 9px; border-radius: 50%; background: var(--rule-strong); } + .server-status .status-when { grid-column: 2; } + .server-status .status-when:empty { display: none; } + .server-status[data-state="ok"] .dot { background: #2E9E5B; box-shadow: 0 0 0 3px rgba(46, 158, 91, 0.18); } + .server-status[data-state="warn"] .dot { background: #D19A1C; box-shadow: 0 0 0 3px rgba(209, 154, 28, 0.2); } + .server-status[data-state="down"] .dot { background: #D2463C; box-shadow: 0 0 0 3px rgba(210, 70, 60, 0.2); } + .server-status[data-state="down"] .status-text, + .server-status[data-state="warn"] .status-text { color: var(--ink); } + .server-status .status-when { font-size: 13px; } .term { background: var(--term-bg); color: var(--term-ink); border-radius: 6px; padding: 18px 20px; font-family: var(--mono); font-size: 13.5px; line-height: 1.5; overflow-x: auto; border: 1px solid var(--rule-strong); } .term pre { margin: 0; white-space: pre-wrap; } @@ -298,6 +309,7 @@ Join the community server Source on GitHub +

Checking the community server…