Skip to content

Auto-update the GitHub stats table on the contributors page#55

Open
0xbrayo wants to merge 2 commits into
ActivityWatch:masterfrom
0xbrayo:automate-github-stats-table
Open

Auto-update the GitHub stats table on the contributors page#55
0xbrayo wants to merge 2 commits into
ActivityWatch:masterfrom
0xbrayo:automate-github-stats-table

Conversation

@0xbrayo

@0xbrayo 0xbrayo commented Jun 12, 2026

Copy link
Copy Markdown
Member

Summary

⚠️ Depends on ActivityWatch/contributor-stats#16 — merge that first. This PR renders the table from 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.json every 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:

  • Makefile: after building the commit-based tables, install contributor-stats' deps and run its render target (github_stats.py --render-only — no GitHub API or token needed) to produce github-activity-table.html, then copy it into _includes/tables/github-stats.html.
  • contributors.html: stop saying the table is "manually updated every now and then" and show {{ site.time }} instead of the hardcoded 2024-7-11 date.
  • Remove the stale committed _includes/tables/github-stats.html — it's a build artifact now, consistent with the rest of _includes/tables/ being untracked.
  • Shallow-clone contributor-stats (--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.

@greptile-apps

greptile-apps Bot commented Jun 12, 2026

Copy link
Copy Markdown

Greptile Summary

This PR automates the GitHub Stats table on the contributors page by rendering it from github-stats-state.json at build time instead of committing a stale static HTML file. It updates the Makefile to install contributor-stats' deps and invoke its new render target, removes the manually-maintained _includes/tables/github-stats.html, and replaces the hardcoded date with {{ site.time }}.

  • Makefile: adds shallow-clone of contributor-stats (--depth 1), runs poetry install and make render to produce github-activity-table.html, then copies it into _includes/tables/.
  • _includes/tables/github-stats.html: deleted as a stale build artifact; the file is now generated during the build.
  • contributors.html: updates the description text and replaces the hardcoded 2024-7-11 date with {{ site.time }}.

Confidence Score: 5/5

Safe 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

Filename Overview
Makefile Adds poetry install + make render + cp steps to generate the GitHub stats table from contributor-stats' state JSON; switches to a shallow clone (--depth 1) to keep CI download size constant. Pattern is consistent with the existing img/stats pipeline.
_includes/tables/github-stats.html Deleted stale static file (last updated 2024-07-11). Will now be produced at build time by contributor-stats' render step.
contributors.html Updates description text and replaces hardcoded date with {{ site.time }}; the new wording slightly misattributes where rendering occurs (contributor-stats stores state JSON, but this repo's build renders the table).

Sequence Diagram

sequenceDiagram
    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)
Loading

Reviews (2): Last reviewed commit: "build: shallow-clone contributor-stats" | Re-trigger Greptile

Comment thread Makefile
0xbrayo added 2 commits June 13, 2026 08:56
…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.
@0xbrayo

0xbrayo commented Jun 13, 2026

Copy link
Copy Markdown
Member Author

@greptile-apps review

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.

1 participant