mirror of
https://github.com/ancsemi/Haven.git
synced 2026-11-03 12:33:02 +00:00
52 lines
1.7 KiB
YAML
52 lines
1.7 KiB
YAML
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
|