Skip to content

Daily stats updates + fix golf/league staleness#10

Draft
doyled-it wants to merge 4 commits into
mainfrom
claude/baseball-golf-data-schedule-y76sfn
Draft

Daily stats updates + fix golf/league staleness#10
doyled-it wants to merge 4 commits into
mainfrom
claude/baseball-golf-data-schedule-y76sfn

Conversation

@doyled-it

Copy link
Copy Markdown
Owner

Why

Two asks: (1) run the baseball/golf data update daily (was weekly) and run it now, and (2) investigate why the schedule/results/leaderboard on the all-time & season pages weren't updating correctly.

What I found

  • Baseball personal stats (baseball.json) update fine via CI — the view/standings/playoff math is correct.
  • League data (league.json — drives the upcoming schedule, standings, playoff %, results) was never in CI. It only refreshed from a local Puppeteer scrape of sdabl1.info tied to the Obsidian vault. It was frozen at May 5, which is exactly why San Diego Sox games on May 3/17/31 and Jun 7 still showed as "Scheduled" and the leaderboard was stale.
  • Golf had two bugs: the site reads golf-raw.json, but CI was writing golf.json (a file nothing reads), and it copied from the now-stale golf-stats repo.
  • Hard constraint: GHIN (golf) and sdabl1.info (league) both return 403 to datacenter IPs, so neither can run on GitHub-hosted runners.

What this PR does

  • Baseball (update-stats.yml): runs daily now (was Sundays); baseball-only. Dropped the broken golf step + deleted the dead golf.json.
  • Golf: fetch-golf.mjs now reads straight from GHIN into golf-raw.json, fixes the ignored countlimit param, and pulls the full handicap record alongside scores.
  • League: new update-league.mjs (npm run update:league) scrapes sdabl1.info using a committed scripts/sdabl-sources.json (no Obsidian vault dependency) and a configurable snapshot dir. Fails safe — a blocked scrape leaves league.json untouched.
  • Self-hosted automation (update-stats-local.yml): a daily workflow for golf + league that runs on a self-hosted runner (residential IP), since those can't run on GitHub's runners.
  • README documents the split and per-season page_node_id upkeep.

Also ran the baseball update manually — picked up two newly-played spring2026 games (Jun 7, Jun 14); record now 6-6.

Still requires you (can't be done from CI)

  • Register a self-hosted runner (home server, residential IP) labelled self-hosted.
  • Add repo secrets GHIN_USERNAME / GHIN_PASSWORD.
  • Verify the spring2026 page_node_id in scripts/sdabl-sources.json.
  • The live golf/league numbers stay stale until the runner is up or you run npm run update:stats locally — I couldn't refresh them from here (403 + no creds).

🤖 Generated with Claude Code


Generated by Claude Code

claude added 4 commits June 14, 2026 23:01
Change the update-stats workflow cron from Sundays only ('0 6 * * 0')
to every day at 6am UTC ('0 6 * * *').
Picks up two newly-played spring2026 games (Jun 7 vs Bubblegum Boys,
Jun 14 vs San Diego Banditos); record now 6-6.
Golf and the league schedule can't run on GitHub-hosted runners (GHIN and
sdabl1.info both 403 datacenter IPs), so split the automation by where it
can actually run:

- update-stats.yml (GitHub-hosted, daily): baseball only. Drop the broken
  golf step that copied the stale golf-stats repo into golf.json — a file
  nothing read (the site reads golf-raw.json). Remove the dead golf.json.
- update-stats-local.yml (self-hosted, daily): golf + league, for a
  residential-IP runner. Needs GHIN_USERNAME/GHIN_PASSWORD secrets.

Golf now reads straight from GHIN via fetch-golf.mjs: fix the ignored
'count' param (the schema field is 'limit') and pull the full handicap
record alongside scores.

League refresh no longer depends on the Obsidian vault: update-league.mjs
reads scripts/sdabl-sources.json and scrapes into a configurable snapshot
dir (SDABL_SNAPSHOT_DIR). 'npm run update:stats' now also runs the league
refresh. Document the split and per-season node_id upkeep in the README.
@cloudflare-workers-and-pages

Copy link
Copy Markdown

Deploying with  Cloudflare Workers  Cloudflare Workers

The latest updates on your project. Learn more about integrating Git with Workers.

Status Name Latest Commit Preview URL Updated (UTC)
✅ Deployment successful!
View logs
doyled-it fc153ab Commit Preview URL

Branch Preview URL
Jun 15 2026, 06:27 AM

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants