-
Notifications
You must be signed in to change notification settings - Fork 0
77 lines (77 loc) · 3.14 KB
/
Copy pathfeed.yml
File metadata and controls
77 lines (77 loc) · 3.14 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
# Hand-maintained (NOT generated by Upptime; update-template leaves it alone).
#
# Builds assets/status-ui/feed.xml, the Atom feed served at
# https://status.experientiallabs.ai/feed.xml (via /api/feed, see
# vercel/vercel.json). The feed is rendered from the SAME merged record the
# page shows: scripts/build-feed.mjs evaluates the mergedIncidents block of
# assets/status-ui/uptime-bars.js verbatim over incidents.json plus the live
# `status` issues, so feed == page by construction.
#
# Rebuilt when an incident issue changes, when the curated record changes,
# hourly as a fallback, or by hand. Commits only when the XML bytes changed,
# so the hourly run is a no-op outside incidents. It pushes to main, so it
# runs in Upptime's concurrency group (README: anything that pushes to main
# must share Upptime's group) with the same rebase-and-retry loop.
name: Feed
on:
issues:
types: [opened, edited, closed, reopened, labeled, unlabeled]
push:
branches: [main]
paths:
- assets/status-ui/incidents.json
- assets/status-ui/uptime-bars.js
- scripts/build-feed.mjs
schedule:
- cron: "41 * * * *"
workflow_dispatch:
concurrency:
group: ${{ github.repository }}-${{ github.head_ref || github.ref_name }}-upptime
cancel-in-progress: false
permissions:
contents: write
issues: read
jobs:
build:
name: Rebuild feed.xml
runs-on: ubuntu-latest
timeout-minutes: 5
# Only incident issues matter (status label); maintenance and traffic-alert
# issues never reach the feed.
if: github.event_name != 'issues' || contains(github.event.issue.labels.*.name, 'status')
steps:
- name: Checkout main
uses: actions/checkout@v6
with:
ref: main
token: ${{ secrets.GH_PAT || github.token }}
- name: Setup Node.js
uses: actions/setup-node@v6
with:
node-version: "22"
- name: Fetch the live incident issues
env:
GH_TOKEN: ${{ github.token }}
REPO: ${{ github.repository }}
run: |
set -euo pipefail
gh api "repos/$REPO/issues?state=all&labels=status&per_page=100" --paginate --slurp \
| node -e 'let s="";process.stdin.on("data",d=>s+=d).on("end",()=>process.stdout.write(JSON.stringify(JSON.parse(s).flat())))' \
> /tmp/issues.json
echo "issues: $(node -e 'console.log(JSON.parse(require("fs").readFileSync("/tmp/issues.json")).length)')"
- name: Build the feed
run: node scripts/build-feed.mjs --issues /tmp/issues.json
- name: Commit if changed
run: |
git config user.name "Upptime Bot"
git config user.email "73812536+upptime-bot@users.noreply.github.com"
git add assets/status-ui/feed.xml
git diff --cached --quiet && { echo "No change."; exit 0; }
git commit -m ":satellite: Refresh incident feed [skip ci]"
# Upptime's bots commit to main every few minutes; rebase over
# whatever landed while this job ran instead of failing the push.
for _ in 1 2 3; do
git push && exit 0
git pull --rebase --autostash && continue
done
exit 1