fix(ci): drop the expired PAT, close an unauthenticated write path, land snapshots
The scheduled pipeline has been failing daily since 2026-08-13 (last successful
`Auto update` was e8b7d1b2). Root cause: `secrets.GH_TOKEN`, a PAT, expired.
Every workflow passing it to actions/checkout dies at fetch with exit 128.
No workflow actually needs a PAT. Each already declares
`permissions: {contents: write}`, so the built-in GITHUB_TOKEN has push rights —
proven by mark-dead-games.yml, the only green data workflow and the only one
with a bare checkout. Removed the `token:` input from all 12 sites. This also
ends the silent-expiry failure mode rather than rescheduling it a year out.
`workflow_run` triggers are unaffected: GITHUB_TOKEN suppression applies to
push/issues/release events, and update-daily.yml plus the three notify-*
workflows all key off workflow_run, which the Actions service emits on run
completion regardless of the checkout token.
Also in this commit:
- ingest-from-issue.yml gated on `author_association`. Without it, any user
could open an issue titled [add-game] and have their JSON committed and
pushed to main with `contents: write`. A title match is not an authorization
check. Its `&&`/`||` commit chain is also parenthesised — left-associativity
meant it pushed even when there was nothing staged.
- bot-ingest.yml's final step deleted. It referenced `secrets.BOT_TOKEN` while
the rest of the file uses TELEGRAM_BOT_TOKEN, `cat`-ed a result.txt no step
creates, ran under `if: always()`, and interpolated a secret straight into a
shell command line. The Python step above it already does the same Telegram
callback correctly. `secrets.BOT_TOKEN` is now unreferenced.
- The snapshot feature is committed. snapshot-daily.yml gains the
`concurrency: {group: data-write}` guard every other data-writing workflow
has — without it a 23:00 run can push against jobs that take ~2 hours. The
`pip install requests` in bash/snapshot.sh is dropped: snapshot.py and
scripts/core/* import only stdlib.
- New web-ci.yml. deploy-pages.yml was the only thing running `npm run
typecheck`, so deleting it during the Cloudflare migration would leave the
frontend unchecked. Uses a plain `npm ci` — the old `npm ci || npm install`
fallback is what let the lockfile conflict above go unnoticed.
- New dependabot.yml. NOTE: an in-repo config replaces the one in repo
settings and supersedes open PR #111. Groups security updates so the
transitive backlog collapses into one PR instead of one per package.
Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
This commit is contained in:
18 files changed
+1484
-24
No files matched your search
@@ -0,0 +1,98 @@
|
||||
# NOTE: committing this file REPLACES the Dependabot configuration currently
|
||||
# set through repo settings. Existing open Dependabot PRs (e.g. #111) are
|
||||
# superseded and will be recreated against these groups on the next run.
|
||||
#
|
||||
# web/worker/ is intentionally absent: it does not exist yet. Add a fifth
|
||||
# npm entry for it as part of the Cloudflare Worker work — that package will
|
||||
# hold the repo-write credential, so it must be covered.
|
||||
version: 2
|
||||
|
||||
updates:
|
||||
# ── Frontend ──────────────────────────────────────────────────────────────
|
||||
- package-ecosystem: npm
|
||||
directory: /web
|
||||
schedule:
|
||||
interval: weekly
|
||||
day: monday
|
||||
open-pull-requests-limit: 10
|
||||
groups:
|
||||
# Collapses the long tail of transitive advisories (brace-expansion,
|
||||
# fast-uri, nanoid, postcss, browserslist, …) into ONE PR instead of
|
||||
# one per package, which is what produced the current alert backlog.
|
||||
npm-security:
|
||||
applies-to: security-updates
|
||||
patterns: ['*']
|
||||
npm-minor-patch:
|
||||
applies-to: version-updates
|
||||
update-types: [minor, patch]
|
||||
radix:
|
||||
applies-to: version-updates
|
||||
patterns: ['@radix-ui/*']
|
||||
tanstack:
|
||||
applies-to: version-updates
|
||||
patterns: ['@tanstack/*']
|
||||
tauri-js:
|
||||
applies-to: version-updates
|
||||
patterns: ['@tauri-apps/*']
|
||||
ignore:
|
||||
# Framework majors are migrations with their own staged PRs, not
|
||||
# something to take as an unattended bump.
|
||||
- dependency-name: react
|
||||
update-types: [version-update:semver-major]
|
||||
- dependency-name: react-dom
|
||||
update-types: [version-update:semver-major]
|
||||
- dependency-name: react-router-dom
|
||||
update-types: [version-update:semver-major]
|
||||
- dependency-name: tailwindcss
|
||||
update-types: [version-update:semver-major]
|
||||
- dependency-name: typescript
|
||||
update-types: [version-update:semver-major]
|
||||
# lucide-react ships breaking icon renames on 0.x minors.
|
||||
- dependency-name: lucide-react
|
||||
|
||||
# ── Desktop / Android shell ───────────────────────────────────────────────
|
||||
- package-ecosystem: cargo
|
||||
directory: /web/src-tauri
|
||||
schedule:
|
||||
interval: weekly
|
||||
day: monday
|
||||
open-pull-requests-limit: 5
|
||||
groups:
|
||||
cargo-security:
|
||||
applies-to: security-updates
|
||||
patterns: ['*']
|
||||
cargo-minor-patch:
|
||||
applies-to: version-updates
|
||||
update-types: [minor, patch]
|
||||
|
||||
# ── Python pipeline ───────────────────────────────────────────────────────
|
||||
# Only does useful work once requirements.txt uses exact `==` pins; with the
|
||||
# current `>=x,<y` ranges Dependabot has nothing to raise.
|
||||
- package-ecosystem: pip
|
||||
directory: /
|
||||
schedule:
|
||||
interval: weekly
|
||||
day: monday
|
||||
open-pull-requests-limit: 5
|
||||
groups:
|
||||
pip-all:
|
||||
patterns: ['*']
|
||||
|
||||
# ── GitHub Actions ────────────────────────────────────────────────────────
|
||||
- package-ecosystem: github-actions
|
||||
directory: /
|
||||
schedule:
|
||||
interval: weekly
|
||||
day: monday
|
||||
open-pull-requests-limit: 5
|
||||
groups:
|
||||
actions-all:
|
||||
patterns: ['*']
|
||||
ignore:
|
||||
# Action majors are held until the GITHUB_TOKEN checkout migration is
|
||||
# confirmed green — do not stack an untested action-major bump on top
|
||||
# of a credential change you still need to verify.
|
||||
- dependency-name: actions/checkout
|
||||
update-types: [version-update:semver-major]
|
||||
- dependency-name: actions/setup-python
|
||||
update-types: [version-update:semver-major]
|
||||
@@ -13,7 +13,6 @@ jobs:
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- uses: actions/checkout@v4
|
||||
with: {token: '${{ secrets.GH_TOKEN }}'}
|
||||
- uses: actions/setup-python@v5
|
||||
with: {python-version: '3.12'}
|
||||
- run: chmod +x ./bash/anti_cheat.sh && ./bash/anti_cheat.sh
|
||||
@@ -190,13 +190,3 @@ jobs :
|
||||
except Exception as e:
|
||||
print(f"Telegram callback failed: {e}")
|
||||
PY
|
||||
|
||||
-
|
||||
name : Edit Telegram message with run URL
|
||||
if : always()
|
||||
run : |
|
||||
curl -sS -X POST "https://api.telegram.org/bot${{ secrets.BOT_TOKEN }}/editMessageText" \
|
||||
-d chat_id=${{ inputs.chat_id }} \
|
||||
-d message_id=${{ inputs.message_id }} \
|
||||
--data-urlencode "text=$(cat result.txt)
|
||||
🔗 https://github.com/${{ github.repository }}/actions/runs/${{ github.run_id }}"
|
||||
@@ -12,7 +12,6 @@ jobs :
|
||||
steps :
|
||||
-
|
||||
uses : actions/checkout@v6
|
||||
with : { token : '${{ secrets.GH_TOKEN }}' }
|
||||
-
|
||||
uses : actions/setup-python@v6
|
||||
with : { python-version : '3.12' }
|
||||
|
||||
@@ -7,12 +7,16 @@ concurrency :
|
||||
cancel-in-progress : false
|
||||
jobs :
|
||||
ingest :
|
||||
if : contains(github.event.issue.title, '[add-game]')
|
||||
# Title match alone is NOT an authorization check — issues are public, so
|
||||
# without the author_association gate any user can write to main.
|
||||
if : >-
|
||||
contains(github.event.issue.title, '[add-game]')
|
||||
&& contains(fromJSON('["OWNER","MEMBER","COLLABORATOR"]'),
|
||||
github.event.issue.author_association)
|
||||
runs-on : ubuntu-latest
|
||||
steps :
|
||||
-
|
||||
uses : actions/checkout@v4
|
||||
with : { token : '${{ secrets.GH_TOKEN }}' }
|
||||
-
|
||||
uses : actions/setup-python@v5
|
||||
with : { python-version : '3.12' }
|
||||
@@ -36,7 +40,7 @@ jobs :
|
||||
git config --global user.name 'github-actions[bot]'
|
||||
git config --global user.email '41898282+github-actions[bot]@users.noreply.github.com'
|
||||
git add .
|
||||
git diff --staged --quiet && echo "No changes" || git commit -m "Ingest #${{ github.event.issue.number }}" && git push
|
||||
git diff --staged --quiet && echo "No changes" || (git commit -m "Ingest #${{ github.event.issue.number }}" && git push)
|
||||
-
|
||||
uses : actions/github-script@v7
|
||||
with :
|
||||
|
||||
@@ -15,7 +15,6 @@ jobs :
|
||||
steps :
|
||||
-
|
||||
uses : actions/checkout@v6
|
||||
with : { token : '${{ secrets.GH_TOKEN }}' }
|
||||
-
|
||||
uses : actions/setup-python@v6
|
||||
with : { python-version : '3.14' }
|
||||
|
||||
@@ -12,7 +12,6 @@ jobs :
|
||||
steps :
|
||||
-
|
||||
uses : actions/checkout@v6
|
||||
with : { token : '${{ secrets.GH_TOKEN }}' }
|
||||
-
|
||||
uses : actions/setup-python@v6
|
||||
with : { python-version : '3.14' }
|
||||
|
||||
@@ -28,8 +28,6 @@ jobs :
|
||||
-
|
||||
name : Checkout repo
|
||||
uses : actions/checkout@v6
|
||||
with :
|
||||
token : ${{ secrets.GH_TOKEN }}
|
||||
|
||||
-
|
||||
name : Setup Python
|
||||
|
||||
@@ -0,0 +1,18 @@
|
||||
name: Daily Snapshot
|
||||
on:
|
||||
schedule: [{cron: '0 23 * * *'}]
|
||||
workflow_dispatch:
|
||||
permissions: {contents: write}
|
||||
# Shares the data-write group with every other workflow that commits to
|
||||
# data/ — without it this can push mid-run against a 2-hour job.
|
||||
concurrency:
|
||||
group: data-write
|
||||
cancel-in-progress: false
|
||||
jobs:
|
||||
snapshot:
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- uses: actions/checkout@v4
|
||||
- uses: actions/setup-python@v5
|
||||
with: {python-version: '3.12'}
|
||||
- run: chmod +x ./bash/snapshot.sh && ./bash/snapshot.sh
|
||||
@@ -13,7 +13,6 @@ jobs:
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- uses: actions/checkout@v4
|
||||
with: {token: '${{ secrets.GH_TOKEN }}'}
|
||||
- uses: actions/setup-python@v5
|
||||
with: {python-version: '3.12'}
|
||||
- run: chmod +x ./bash/offline.sh && ./bash/offline.sh
|
||||
|
||||
@@ -11,7 +11,6 @@ jobs:
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- uses: actions/checkout@v4
|
||||
with: {token: '${{ secrets.GH_TOKEN }}'}
|
||||
- uses: actions/setup-python@v5
|
||||
with: {python-version: '3.12'}
|
||||
- run: chmod +x ./bash/online.sh && ./bash/online.sh
|
||||
|
||||
@@ -12,7 +12,6 @@ jobs:
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- uses: actions/checkout@v6
|
||||
with: {token: '${{ secrets.GH_TOKEN }}'}
|
||||
- uses: actions/setup-python@v6
|
||||
with: {python-version: '3.14'}
|
||||
- run: chmod +x ./bash/daily.sh && ./bash/daily.sh
|
||||
@@ -11,7 +11,6 @@ jobs:
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- uses: actions/checkout@v6
|
||||
with: {token: '${{ secrets.GH_TOKEN }}'}
|
||||
- uses: actions/setup-python@v6
|
||||
with: {python-version: '3.14'}
|
||||
- run: chmod +x ./bash/json.sh && ./bash/json.sh
|
||||
|
||||
@@ -12,7 +12,6 @@ jobs :
|
||||
steps :
|
||||
-
|
||||
uses : actions/checkout@v6
|
||||
with : { token : '${{ secrets.GH_TOKEN }}' }
|
||||
-
|
||||
uses : actions/setup-python@v6
|
||||
with : { python-version : '3.14' }
|
||||
|
||||
@@ -0,0 +1,55 @@
|
||||
name: Web CI
|
||||
|
||||
# The check gate for web/. This exists because deploy-pages.yml was previously
|
||||
# the ONLY thing running `npm run typecheck` — so when that workflow is deleted
|
||||
# during the Cloudflare migration, nothing would validate the frontend at all.
|
||||
# Cloudflare Workers Builds deploys the site; this workflow only *checks* it.
|
||||
|
||||
on:
|
||||
pull_request:
|
||||
paths: ['web/**', '.github/workflows/web-ci.yml']
|
||||
push:
|
||||
branches: [main]
|
||||
paths: ['web/**', '.github/workflows/web-ci.yml']
|
||||
workflow_dispatch:
|
||||
|
||||
permissions:
|
||||
contents: read
|
||||
|
||||
concurrency:
|
||||
group: web-ci-${{ github.ref }}
|
||||
cancel-in-progress: true
|
||||
|
||||
jobs:
|
||||
check:
|
||||
runs-on: ubuntu-latest
|
||||
defaults:
|
||||
run:
|
||||
working-directory: web
|
||||
steps:
|
||||
- uses: actions/checkout@v4
|
||||
|
||||
- uses: actions/setup-node@v4
|
||||
with:
|
||||
node-version: '24'
|
||||
cache: 'npm'
|
||||
cache-dependency-path: web/package-lock.json
|
||||
|
||||
# Deliberately NOT `npm ci || npm install`. That fallback is what hid the
|
||||
# echarts/echarts-wordcloud peer conflict: `npm ci` failed, `npm install`
|
||||
# was tried, and the step still went red only at the very end — while
|
||||
# locally everyone kept a stale node_modules. A lockfile that cannot be
|
||||
# installed cleanly is a failure, not something to work around.
|
||||
- name: Install
|
||||
run: npm ci
|
||||
|
||||
- name: Type check
|
||||
run: npm run typecheck
|
||||
|
||||
- name: Build
|
||||
run: npm run build
|
||||
|
||||
# knip.json is warn-only, so this reports dead code without failing the
|
||||
# build. Flip the rules in knip.json to error when the backlog is clear.
|
||||
- name: Unused code report
|
||||
run: npm run knip
|
||||
@@ -0,0 +1,7 @@
|
||||
#!/bin/bash
|
||||
set -euo pipefail
|
||||
# No pip install: snapshot.py and scripts/core/* are stdlib-only.
|
||||
python scripts/snapshot.py
|
||||
git config --global user.name 'github-actions[bot]'
|
||||
git config --global user.email '41898282+github-actions[bot]@users.noreply.github.com'
|
||||
git add data/snapshots/ && git diff --staged --quiet && echo "No changes" || (git commit -m "Snapshot [$(date +'%Y-%m-%d')]" && git push)
|
||||
File diff suppressed because it is too large.
Load diff
@@ -0,0 +1,74 @@
|
||||
#!/usr/bin/env python3
|
||||
"""Daily snapshot — capture per-game time-series data.
|
||||
|
||||
Writes one JSONL line per game with fields needed for trend charts:
|
||||
{appid, name, current_players, peak_today, reviews_pct, captured_at}
|
||||
|
||||
Output: data/snapshots/YYYY-MM-DD.jsonl (one file per UTC day, idempotent — overwrites same-day).
|
||||
|
||||
Manual fields and full game records are NOT duplicated here; consumers join on appid
|
||||
against the live shards if they need the rest.
|
||||
"""
|
||||
import json
|
||||
import os
|
||||
import re
|
||||
import sys
|
||||
from datetime import datetime, timezone
|
||||
from pathlib import Path
|
||||
|
||||
sys.path.insert(0, os.path.dirname(os.path.abspath(__file__)))
|
||||
from core.data_store import load_main, extract_appid
|
||||
|
||||
SNAPSHOTS_DIR = Path("data/snapshots")
|
||||
PCT_RE = re.compile(r"(\d{1,3})%")
|
||||
|
||||
|
||||
def _parse_players(s: str) -> int:
|
||||
if not s:
|
||||
return 0
|
||||
cleaned = s.replace(",", "").strip()
|
||||
return int(cleaned) if cleaned.isdigit() else 0
|
||||
|
||||
|
||||
def _review_pct(reviews: str) -> int | None:
|
||||
if not reviews:
|
||||
return None
|
||||
m = PCT_RE.search(reviews)
|
||||
return int(m.group(1)) if m else None
|
||||
|
||||
|
||||
def main() -> int:
|
||||
games = load_main()
|
||||
if not games:
|
||||
print("No games loaded — aborting snapshot.")
|
||||
return 1
|
||||
SNAPSHOTS_DIR.mkdir(parents=True, exist_ok=True)
|
||||
today = datetime.now(timezone.utc).strftime("%Y-%m-%d")
|
||||
out_path = SNAPSHOTS_DIR / f"{today}.jsonl"
|
||||
captured_at = datetime.now(timezone.utc).strftime("%Y-%m-%dT%H:%M:%SZ")
|
||||
written = 0
|
||||
tmp = out_path.with_suffix(".jsonl.tmp")
|
||||
with tmp.open("w", encoding="utf-8") as f:
|
||||
for g in games:
|
||||
appid = extract_appid(g.get("link", "") or "")
|
||||
if not appid:
|
||||
continue
|
||||
row = {
|
||||
"appid": appid,
|
||||
"name": g.get("name", ""),
|
||||
"current_players": _parse_players(g.get("current_players", "")),
|
||||
"peak_today": _parse_players(g.get("peak_today", "")),
|
||||
"reviews_pct": _review_pct(g.get("reviews", "")),
|
||||
"type_game": g.get("type_game", ""),
|
||||
"status": g.get("status", "active"),
|
||||
"captured_at": captured_at,
|
||||
}
|
||||
f.write(json.dumps(row, ensure_ascii=False) + "\n")
|
||||
written += 1
|
||||
tmp.replace(out_path)
|
||||
print(f"[OK] {out_path} ({written} rows)")
|
||||
return 0
|
||||
|
||||
|
||||
if __name__ == "__main__":
|
||||
sys.exit(main())
|
||||
Reference in new issue
Block a user