Skip to content

Metrics: keep the download numbers GitHub throws away after 14 days - #13

Merged
MR-TABATA merged 1 commit into
mainfrom
chore/download-metrics
Aug 23, 2026
Merged

MR-TABATA merged 1 commit into
mainfrom
chore/download-metrics

Conversation

@MR-TABATA

@MR-TABATA MR-TABATA commented Aug 23, 2026 •

Copy link
Copy Markdown
Owner

The project has no measurable download. 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.

What this adds

  • .github/workflows/docker-publish.yml — builds amd64 + arm64 on a v*
    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:

    GIST_ID=... python3 scripts/metrics.py report
    

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_ID and DOCKERHUB_USERNAME are set. Still needed before the workflows
can run: METRICS_TOKEN (classic PAT — gist + public_repo, the latter
because the traffic API requires push) and DOCKERHUB_TOKEN.

Merge order

This one first. workflow_dispatch only works for workflows present on the
default branch, so jiniie/cli2ui:latest cannot 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

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
@MR-TABATA
MR-TABATA merged commit f0a3b3b into main Aug 23, 2026
2 checks passed
@MR-TABATA
MR-TABATA deleted the chore/download-metrics branch August 23, 2026 01:48
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