Migrate SRS to Cloudflare Worker: D1 state, email digest, review issues, live charts

This commit is contained in:
Prad Nukala
2026-08-24 19:11:07 -04:00
parent 6be5d55366
commit 7213cc1c8a
40 changed files with 2933 additions and 2132 deletions
-67
View File
@@ -1,67 +0,0 @@
name: Gate
on:
schedule:
- cron: "0 12 * * 6" # Saturday 8 AM ET — create this week's gate
workflow_dispatch:
issues:
types: [closed] # grade a gate when it closes
permissions:
contents: write
issues: write
# Shared with srs-scheduler / srs-logger / srs-setup: never race on srs.json.
concurrency:
group: srs-state
cancel-in-progress: false
jobs:
create:
# Trigger A: the only issue-creating workflow in the SRS. The script
# no-ops when this week's gate already exists.
if: github.event_name != 'issues'
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: oven-sh/setup-bun@v2
- run: bun scripts/srs-gate.ts create
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
- name: Commit state
run: |
git config user.name "github-actions[bot]"
git config user.email "41898282+github-actions[bot]@users.noreply.github.com"
git add .github/srs
git diff --cached --quiet && { echo "no state change"; exit 0; }
git commit -m "srs: create weekly gate [skip ci]"
for i in 1 2 3; do git push && exit 0; git pull --rebase; done
git push
close:
# Trigger B: grade, log, boost, badge.
if: >-
github.event_name == 'issues' &&
contains(github.event.issue.labels.*.name, 'gate')
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: oven-sh/setup-bun@v2
- run: bun scripts/srs-gate.ts close
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
- name: Commit state
run: |
git config user.name "github-actions[bot]"
git config user.email "41898282+github-actions[bot]@users.noreply.github.com"
git add .github/srs docs/gate-log.md
git diff --cached --quiet && { echo "no state change"; exit 0; }
git commit -m "srs: grade gate #${{ github.event.issue.number }} [skip ci]"
for i in 1 2 3; do git push && exit 0; git pull --rebase; done
git push
-43
View File
@@ -1,43 +0,0 @@
name: SRS Logger
on:
issue_comment:
types: [created]
permissions:
contents: write
issues: write
# Shared with srs-scheduler / gate / srs-setup: never race on srs.json.
concurrency:
group: srs-state
cancel-in-progress: false
jobs:
log:
# Owner-only, and only on the daily brief or a gate issue. Put every
# /done line in ONE comment — queued duplicate runs may be superseded.
if: >-
github.event.comment.user.login == github.repository_owner &&
(github.event.issue.title == '📋 Today' ||
contains(github.event.issue.labels.*.name, 'gate'))
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: oven-sh/setup-bun@v2
- run: bun scripts/srs-logger.ts
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
PROJECT_PAT: ${{ secrets.PROJECT_PAT }}
- name: Commit state
run: |
git config user.name "github-actions[bot]"
git config user.email "41898282+github-actions[bot]@users.noreply.github.com"
git add .github/srs
git diff --cached --quiet && { echo "no state change"; exit 0; }
git commit -m "srs: log results from #${{ github.event.issue.number }} [skip ci]"
for i in 1 2 3; do git push && exit 0; git pull --rebase; done
git push
-30
View File
@@ -1,30 +0,0 @@
name: SRS Scheduler
on:
schedule:
- cron: "0 10 * * *" # 6 AM ET — before the day starts
workflow_dispatch:
permissions:
contents: read
issues: write
# Shared with srs-logger / gate / srs-setup: never race on srs.json.
concurrency:
group: srs-state
cancel-in-progress: false
jobs:
brief:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: oven-sh/setup-bun@v2
# Stateless: reads srs.json + schedule.json, rewrites the pinned
# 📋 Today issue, mirrors Target Date. Commits nothing.
- run: bun scripts/srs-scheduler.ts
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
PROJECT_PAT: ${{ secrets.PROJECT_PAT }}
-29
View File
@@ -1,29 +0,0 @@
name: SRS Setup
on:
workflow_dispatch:
permissions:
contents: read
issues: read
# Shared with the other SRS workflows: never race on srs.json.
concurrency:
group: srs-state
cancel-in-progress: false
jobs:
setup:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: oven-sh/setup-bun@v2
# Verifies PROJECT_PAT against the user project, creates the SRS
# single-select fields when missing, and re-mirrors every laddered
# problem's Target Date / SRS Stage / First Attempt. Idempotent.
- run: bun scripts/srs-setup.ts
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
PROJECT_PAT: ${{ secrets.PROJECT_PAT }}