fix(ci): render the star history chart from the repo's own token - #627
Draft
blafourcade wants to merge 4 commits into
Draft
fix(ci): render the star history chart from the repo's own token#627blafourcade wants to merge 4 commits into
blafourcade wants to merge 4 commits into
Conversation
GitHub restricted the stargazers API to a repository's own admins and collaborators on June 30 2026, so the third-party chart the README embeds now returns a placeholder telling readers the data is unavailable. The repository can still read its own stargazers, so the chart is rendered here from that data and published on the star-history orphan branch. No credential leaves the repository, and the renderer is deterministic, so a run that finds no new star produces no commit. The push trigger is temporary: schedule and workflow_dispatch only fire from the default branch, so it is the only way to exercise the workflow before the merge. It is removed later in this same pull request. Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
api.star-history.com now answers with a placeholder image reading "GitHub restricted access to star data", so the README advertised a dead chart. It now embeds the SVG this repository renders itself, and the image links to the stargazers page. Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
It existed to run the workflow from this branch, since schedule and workflow_dispatch only fire from the default branch. Runs 31746866236 and 31746963019 proved both paths: the first published the chart, the second found no new star and committed nothing. Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
🎯 What & why
The star chart in the README was dead: GitHub restricted the stargazers API to a repository's own admins and collaborators on June 30 2026, so
api.star-history.comanswers with a placeholder image reading "GitHub restricted access to star data". The chart is now rendered by this repository, from its own token.🛠️ How it works
scripts/generate-star-history.mjs paginates the stargazers API with the
star+jsonmedia type, builds the cumulative curve and writes an SVG to stdout. No dependency, no network beyond GitHub..github/workflows/star-history.yml runs it weekly with
github.tokenand publishes the result on thestar-historyorphan branch, which README.md:329 embeds overraw.githubusercontent.com.Three constraints shaped it:
main. Themainruleset requires a pull request, so a scheduled job cannot push a regenerated asset there. A data-only branch also keeps generated bytes out of the source history, and triggers nothing (validate.ymllistens on[main, next]).<style>, no<script>, no external font. GitHub strips all three from an SVG served into a README. Colours are neutral enough to read on both themes.The alternative was star-history's
sealed_token: it publishes a real GitHub PAT, encrypted with a key that a third party holds, in the README. Rejected.Publishing uses
git commit-tree/git pushplumbing rather than a checkout dance, so the orphan branch never touches the working tree.🧪 How to verify
GH_TOKEN=$(gh auth token) node scripts/generate-star-history.mjs > /tmp/star.svg— the last point matches the number of stargazers fetched (417).curl -sI https://raw.githubusercontent.com/ai-driven-dev/framework/star-history/star-history.svg→200,content-type: image/svg+xml. Its bytes are identical to the local render (sha256 42ef322dfcf7…).pushtrigger, sincescheduleandworkflow_dispatchonly fire from the default branch:* [new branch] … -> star-history.Star history unchanged., no commit.<img>reportscomplete: true,naturalWidth: 800,naturalHeight: 400, in both the light and dark GitHub themes.main: GitHub runsscheduleand shows the Run workflow button on the default branch only. Until then the chart stays at the 417-star snapshot already published.raw.githubusercontent.comURL directly, with no camo proxy in front of it (checked in the branch's rendered HTML), so a refreshed chart only waits on raw's own CDN cache.