Repository navigation
Metrics: keep the download numbers GitHub throws away after 14 days - #13
Merged
Merged
Conversation
The project had no measurable download at all. `git clone` is not counted, and
the Source code zip/tar.gz GitHub attaches to every release is excluded from
download_count — so all six releases report 0 assets and 0 downloads, which is
not a low number but the absence of one. The only real signal, traffic clones,
is served from a rolling 14-day window: a day not fetched is gone for good.
Two workflows fix both halves. Publish image builds amd64 and arm64 on a `v*`
tag and pushes to Docker Hub, whose pull count is a public unauthenticated API
— the first honest download figure the project has had. It also builds (without
pushing) on PRs that touch the Dockerfile or requirements, so a broken image is
found before the tag is cut, not on release day. Metrics runs daily at 12:00
JST and appends traffic, release assets and pull count to a private Gist, so
the window stops being the horizon.
scripts/metrics.py does the collecting and doubles as the reader:
GIST_ID=... python3 scripts/metrics.py report
Same day's snapshot overwrites rather than appends, because the current day is
still climbing when the cron fires and the next run picks up the rest. Verified
end to end against the live repo: the first snapshot captured all 14 days still
in the window.
Needs four repo secrets — DOCKERHUB_USERNAME, DOCKERHUB_TOKEN, METRICS_TOKEN
(classic PAT: gist + public_repo, the latter because traffic requires push),
and GIST_ID.
Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01UJoGRWhksAqQttFdTZYRSm
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.
The project has no measurable download.
git cloneis not counted, and theSource code zip/tar.gz GitHub attaches to every release is excluded from
download_count— so all six releases report 0 assets and 0 downloads, whichis not a low number but the absence of one. The only real signal, traffic
clones, is served from a rolling 14-day window: a day not fetched is gone
for good.
What this adds
.github/workflows/docker-publish.yml— builds amd64 + arm64 on av*tag and pushes to Docker Hub, whose pull count is a public unauthenticated
API. That is the first honest download figure the project has had. Also
builds (without pushing) on PRs touching
Dockerfile/requirements.txt,so a broken image surfaces before the tag is cut.
.github/workflows/metrics.yml— daily at 12:00 JST, appends traffic,release assets and pull count to a private Gist.
scripts/metrics.py— does the collecting, and doubles as the reader:The same day's snapshot overwrites rather than appends: the current day is
still climbing when the cron fires, and the next run picks up the rest.
Verification
Ran end to end against the live repo — the first snapshot captured all 14 days
still inside the window (23 clones / 15 unique) before they expire.
Secrets
GIST_IDandDOCKERHUB_USERNAMEare set. Still needed before the workflowscan run:
METRICS_TOKEN(classic PAT —gist+public_repo, the latterbecause the traffic API requires push) and
DOCKERHUB_TOKEN.Merge order
This one first.
workflow_dispatchonly works for workflows present on thedefault branch, so
jiniie/cli2ui:latestcannot be published until this lands.#14 (which points Compose at that image) must wait for the image to
exist.
🤖 Generated with Claude Code
https://claude.ai/code/session_01UJoGRWhksAqQttFdTZYRSm