feat(ci): add total clone-count badge to the README#71
Open
ucekmez wants to merge 1 commit into
Open
Conversation
Adds a daily job that accumulates git-clone counts into a public Gist and a
shields.io badge in the README. GitHub's traffic API only retains 14 days of
clone data, so the workflow merges each window into a running total.
Adapted from MShawon/github-clone-count-badge, hardened for this repo:
- the accumulation script is vendored (.github/scripts/accumulate_clones.py)
rather than curl-piped into python3 at runtime (no unpinned remote code
executes in CI);
- the workflow runs with `permissions: contents: read`, pins the action, and
commits nothing back to the repo (no CLONE.md / third-party push action);
- the gist id is a repository variable (it is public) and the PAT lives in the
`SECRET_TOKEN` secret, used only for the traffic + gist API calls.
The total accumulates from the first run onward; historical clones are not
exposed by GitHub. One-time setup and rotation are documented in
docs/ops/clone-count-badge.md. The README badge URL carries a `__GIST_ID__`
placeholder to be replaced with the gist id during setup.
Signed-off-by: Ugur Cekmez <ucekmez@gmail.com>
Co-Authored-By: Claude Opus 4.8 (1M context) <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.
Summary
Adds a total git-clone count badge to the README, accumulated daily into a
public Gist (GitHub's traffic API only retains 14 days). Adapted from
MShawon/github-clone-count-badge.
Hardened for this repo
Unlike the upstream recipe, this does not
curl … | python3remote code atruntime:
.github/scripts/accumulate_clones.py, reviewed);permissions: contents: read, pins the action, commits nothing back;SECRET_TOKEN) is used only for the traffic + gist API calls; the gistid is a public repo variable, not a secret.
Verification
accumulate_clones.pymerge logic tested locally: first window 6+4 → 10;next day with an overlapping row + a new one → 15 (overlap overwritten, not
double-counted).
The badge renders a
__GIST_ID__placeholder until configured. Seedocs/ops/clone-count-badge.md:clone.json={"count":0,"uniques":0,"clones":[]}.repo+gist) as theSECRET_TOKENsecret.GIST_ID= the gist id.__GIST_ID__in the README badge URL with the gist id.🤖 Generated with Claude Code