Skip to content

ci: consolidate star fetch into deploy workflow with Actions cache#2972

Merged
vinta merged 10 commits intomasterfrom
feature/fetch-stats-workflow
Mar 18, 2026
Merged

ci: consolidate star fetch into deploy workflow with Actions cache#2972
vinta merged 10 commits intomasterfrom
feature/fetch-stats-workflow

Conversation

@vinta
Copy link
Copy Markdown
Owner

@vinta vinta commented Mar 18, 2026

Summary

  • Merge the standalone fetch-github-stars workflow into deploy-website, using actions/cache to persist website/data/github_stars.json between runs
  • Remove bot commits from git history — star data no longer tracked in git
  • Add CACHE_MAX_AGE_HOURS = 12 staleness check so fresh data isn't re-fetched unnecessarily
  • Fetch runs on every trigger (push and schedule) but the script skips repos cached within 12 hours
  • If no star data is available (no cache + fetch failed), the build fails with a clear error

Changes

  • .github/workflows/deploy-website.yml — removed workflow_run, added schedule cron, cache restore/save/verify steps
  • .github/workflows/fetch-github-stars.yml — deleted
  • website/fetch_github_stars.py — added CACHE_MAX_AGE_HOURS = 12 with total_seconds()/3600 (avoids .days rounding bug)
  • website/data/github_stars.json — untracked + gitignored
  • Tests cover both fresh-cache-skip and stale-cache-fetch behaviors

Test plan

  • uv run pytest website/tests/ -v — all 96 tests pass
  • Verify scheduled run fetches stars and caches data
  • Verify push-triggered run restores cached stars and builds

🤖 Generated with Claude Code

vinta and others added 10 commits March 18, 2026 21:33
Reformats dict and list literals to trailing-comma multiline style
throughout. Also copies README.md to llms.txt in the site output so
LLM crawlers can discover the full content.

Co-Authored-By: Claude <noreply@anthropic.com>
Switches install step from --no-dev to --group build for explicit
dependency group selection, and replaces the bare python invocation
with `make build` to use the canonical build entrypoint.

Co-Authored-By: Claude <noreply@anthropic.com>
Rename the Makefile target from fetch_stats to fetch_github_stars to
match the script name. Remove CACHE_MAX_AGE_DAYS and the staleness
check so every run fetches all repos unconditionally.

Co-Authored-By: Claude <noreply@anthropic.com>
Runs on a nightly schedule, installs deps with uv, calls make
fetch_github_stars, and pushes an update commit only when the
star data file actually changed.

Co-Authored-By: Claude <noreply@anthropic.com>
Adds a workflow_run trigger so the site is rebuilt whenever fresh
star data lands on master, in addition to the existing push trigger.
The build job guard ensures it only runs on direct pushes or when
the upstream workflow concluded successfully.

Co-Authored-By: Claude <noreply@anthropic.com>
The generic email 'github-actions[bot]@users.noreply.github.com' does not
match GitHub's actual bot account. Using the numeric-prefixed form
'41898282+github-actions[bot]@users.noreply.github.com' ensures commits
made by the workflow are correctly attributed to the bot account.

Co-Authored-By: Claude <noreply@anthropic.com>
Replace the separate fetch-github-stars.yml workflow (which committed
star data back to git) with an inline fetch step in deploy-website.yml.
Star data is now stored in Actions cache between runs, eliminating the
workflow_run trigger chain and the need to track github_stars.json in
the repository.

Co-Authored-By: Claude <noreply@anthropic.com>
Introduce CACHE_MAX_AGE_HOURS (12 h) and filter current_repos before
the fetch loop so repos that were updated recently are not re-requested.
Prints a breakdown of fetched vs cached count.

Co-Authored-By: Claude <noreply@anthropic.com>
Removed the 'if: github.event_name == schedule' guard so the step also
runs on manual dispatches and push-triggered deploys, not only on the
nightly schedule.

Co-Authored-By: Claude <noreply@anthropic.com>
@vinta vinta self-assigned this Mar 18, 2026
@vinta vinta merged commit fa00f10 into master Mar 18, 2026
@vinta vinta deleted the feature/fetch-stats-workflow branch March 18, 2026 14:57
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