Skip to content

ci: refresh the site's download and star counts daily - #397

Open
caezium wants to merge 1 commit into
mainfrom
ci/daily-site-stats
Open

ci: refresh the site's download and star counts daily#397
caezium wants to merge 1 commit into
mainfrom
ci/daily-site-stats

Conversation

@caezium

@caezium caezium commented Aug 18, 2026

Copy link
Copy Markdown
Owner

Why

The landing page's "Already downloaded by N people" line and the star count in every page's nav are baked into docs/stats.json when site-release.py runs, so they freeze the moment nobody runs it by hand. That file had exactly one commit — 2026-08-08 — and had been reading 13,091 downloads / 1,214 stars ever since, while the real totals reached 24,358 / 1,279.

The README badge never had this problem: shields.io re-renders it per view from the same per-asset download sum. Only the site was stale.

What

  • .github/workflows/refresh-stats.yml — daily at 07:41 UTC (clear of the upstream watcher's 08:17), plus manual dispatch. Runs site-release.py --stats, commits only when the numbers move, then dispatches the site deploy.
  • gh_json() now sends GH_TOKEN/GITHUB_TOKEN when set.
  • One refresh applied now, so the site is correct on merge rather than a day later.

Two things worth a look in review

The deploy is dispatched explicitly, not left to the path filter. A push made with GITHUB_TOKEN deliberately does not start other workflows, so deploy-site.yml's docs/** trigger would never fire on the bot's own commit. workflow_dispatch is the documented exception to that recursion guard, hence the extra step and actions: write.

The token is not optional. Anonymous GitHub API access is 60 requests/hour per source IP, and Actions runners share IPs across the whole fleet, so an unauthenticated scheduled refresh 403s at random.

Verification

Both API paths exercised locally (authenticated and anonymous) — same totals. The regeneration touched only count lines across 17 pages, with no unrelated drift, which also confirms main's generated tree is currently in sync.

The workflow itself is untested end-to-end, since scheduled runs only fire from the default branch. After merge:

gh workflow run "Refresh site stats"

Conflict note

#392 generates the site in ten languages, which multiplies the pages carrying these counts. The workflow is agnostic — it regenerates whatever the generator emits — but the docs/ half of this diff will likely conflict with that branch. Whichever merges second just needs a regeneration.

Summary by CodeRabbit

  • New Features

    • Site statistics can now refresh automatically each day, with an option for manual updates.
    • Updated statistics are automatically reflected in site deployments when values change.
  • Documentation

    • Updated displayed GitHub star counts across the website from 1.2k to 1.3k.
    • Updated displayed download counts from 13,091 to 24,358 on relevant pages.
    • Refreshed site statistics to reflect the latest figures.
  • Bug Fixes

    • Improved authenticated access when retrieving current statistics, supporting more reliable updates.

The landing page's "Already downloaded by N people" line and the star
counts in every page's nav are baked into docs/stats.json when
site-release.py runs, so they freeze the moment nobody runs it by hand.
They were last written on 2026-08-08 and had sat at 13,091 downloads
while the real total passed 24,000 — the README's shields.io badge, which
sums the same per-asset download counts, was live the whole time.

Add a daily workflow that runs `site-release.py --stats`, commits only
when the numbers move, and dispatches the site deploy. The dispatch is
explicit because a push made with GITHUB_TOKEN deliberately does not
start other workflows, so deploy-site.yml's docs/** path filter would
never fire on the bot's own commit; workflow_dispatch is the documented
exception to that rule.

gh_json() now sends GH_TOKEN when it is set. Anonymous GitHub API access
is 60 requests/hour per source IP and Actions runners share IPs with the
whole fleet, so the scheduled refresh would 403 at random without it.

Also apply one refresh now, so the site is correct before the first
scheduled run rather than a day after it.
@coderabbitai

coderabbitai Bot commented Aug 18, 2026

Copy link
Copy Markdown

Review Change Stack

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Pro Plus

Run ID: e703a9de-73ed-40f3-882b-c713abeb052d

📥 Commits

Reviewing files that changed from the base of the PR and between 598710e and 27afef3.

📒 Files selected for processing (20)
  • .github/workflows/refresh-stats.yml
  • docs/blog/choosing-a-mac-cleanup-tool.html
  • docs/blog/find-duplicate-files-on-a-mac.html
  • docs/blog/give-claude-code-access-to-your-macs-system-state.html
  • docs/blog/index.html
  • docs/blog/leftover-files-after-uninstalling-mac-apps.html
  • docs/blog/mac-says-disk-is-full-but-it-isnt.html
  • docs/blog/node-modules-eating-your-disk.html
  • docs/blog/safely-clear-xcode-deriveddata-and-caches.html
  • docs/blog/what-is-using-port-3000-on-your-mac.html
  • docs/blog/what-macos-system-data-actually-contains.html
  • docs/blog/which-process-is-using-your-network-on-macos.html
  • docs/compare.html
  • docs/docs.html
  • docs/index.html
  • docs/install.html
  • docs/releases.html
  • docs/roadmap.html
  • docs/stats.json
  • scripts/site-release.py

Included review availability: Your plan includes up to 3 reviews per rolling hour; 1 remains after this review.


📝 Walkthrough

Walkthrough

The pull request adds authenticated GitHub statistics retrieval and a scheduled or manual workflow that commits changed statistics and triggers deployment. It updates repository star and download counts in the statistics file and generated site pages.

Changes

Site statistics refresh

Layer / File(s) Summary
GitHub API authentication
scripts/site-release.py
gh_json now uses GH_TOKEN or GITHUB_TOKEN for Bearer authentication while preserving existing request headers.
Automated refresh and deployment
.github/workflows/refresh-stats.yml
A scheduled or manually triggered workflow runs the statistics refresh, commits changes when present, and dispatches site deployment after a successful commit.
Generated statistics displays
docs/stats.json, docs/blog/*, docs/compare.html, docs/docs.html, docs/index.html, docs/install.html, docs/releases.html, docs/roadmap.html
The displayed star count changes to 1.3k. The recorded and displayed download count changes to 24,358.

Estimated code review effort: 3 (Moderate) | ~20 minutes

Merge Risk: ⚪ Minimal · up to 27afe

This change automates daily refreshes of the site's download and star counts and updates the site with current values; no actionable merge-blocking risk remains beyond normal checks and review.

🚥 Pre-merge checks | ✅ 5
✅ Passed checks (5 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title clearly and concisely describes the main change: a daily CI workflow that refreshes the site's download and star counts.
Docstring Coverage ✅ Passed Docstring coverage is 100.00% which is sufficient. The required threshold is 80.00%.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.
✨ Finishing Touches
📝 Generate docstrings
  • Create stacked PR
  • Commit on current branch
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch ci/daily-site-stats

Comment @coderabbitai help to get the list of available commands.

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