Auto-update the GitHub stats table on the contributors page#55
Conversation
Greptile SummaryThis PR automates the GitHub Stats table on the contributors page by rendering it from
Confidence Score: 5/5Safe to merge once ActivityWatch/contributor-stats#16 is merged first — the build will fail until that dependency is in place. The Makefile changes follow the same pattern as the existing img/stats pipeline (poetry install, run script, copy output). The shallow-clone rationale is sound, the stale static file is cleanly removed, and site.time correctly reflects the build time. No correctness issues are introduced in the changed files. No files require special attention beyond the sequencing dependency on contributor-stats#16. Important Files Changed
Sequence DiagramsequenceDiagram
participant CS as contributor-stats (cron, every 6h)
participant GH as GitHub API
participant CIBuild as This site's CI build (00:30 UTC)
participant Jekyll as Jekyll
CS->>GH: Fetch activity data
GH-->>CS: Raw stats
CS->>CS: Write github-stats-state.json
CS->>CS: "Commit & push state JSON"
CIBuild->>CS: git clone --depth 1
CIBuild->>CS: make build-aw (commit tables)
CIBuild->>CS: poetry install
CIBuild->>CS: make render (github_stats.py --render-only)
CS-->>CIBuild: github-activity-table.html
CIBuild->>CIBuild: cp to _includes/tables/github-stats.html
CIBuild->>Jekyll: bundle exec jekyll build
Jekyll-->>CIBuild: _site/ (includes rendered contributors page)
Reviews (2): Last reviewed commit: "build: shallow-clone contributor-stats" | Re-trigger Greptile |
…s state
The GitHub stats table was a manually generated file committed to this
repo, last updated 2024-07-11. contributor-stats now commits only its
sync-state JSON (github-stats-state.json) on a schedule, not the rendered
HTML, so the build generates the table from that state.
- Makefile: after building the commit-based tables, install
contributor-stats' deps and run its 'render' target ('github_stats.py
--render-only', no GitHub API/token needed) to produce the table, then
copy it into _includes/tables/github-stats.html
- contributors.html: stop claiming the table is manually updated and show
the build time instead of a hardcoded date
- remove the stale committed table; it's a build artifact now
contributor-stats now commits its regenerated sync state every few hours, which grows its history by roughly 10MB/year. The site build only needs the latest checkout (gitstats analyzes the AW repos that contributor-stats clones itself, not contributor-stats' own history), so clone with --depth 1 to keep the daily build's download size constant.
14c0db3 to
d0a3bb3
Compare
|
@greptile-apps review |
Summary
github-stats-state.json, which #16 adds and keeps updated.The GitHub Stats table on the contributors page is a manually generated file committed to this repo, last updated 2024-07-11. With ActivityWatch/contributor-stats#16, contributor-stats commits an up-to-date
github-stats-state.jsonevery 6 hours (00:00 UTC start, so this site's 00:30 UTC build picks up data at most ~30 minutes stale) — but not the rendered HTML, which is a build artifact the consumer produces.This PR makes the website generate the table from that state, like it already does for the commit-based tables:
rendertarget (github_stats.py --render-only— no GitHub API or token needed) to producegithub-activity-table.html, then copy it into_includes/tables/github-stats.html.{{ site.time }}instead of the hardcoded 2024-7-11 date._includes/tables/github-stats.html— it's a build artifact now, consistent with the rest of_includes/tables/being untracked.--depth 1): it now commits regenerated state every few hours (~10MB of history growth per year), and the build only needs the latest checkout — gitstats analyzes the AW repos contributor-stats clones itself, not contributor-stats' own history. Keeps the daily build's download size constant.