Publish summary: replace version links with live download-count badges - #189
Merged
Conversation
Each published/up-to-date cell in the publish-summary table now renders a shields.io Dynamic Regex Badge labeled with the version and showing that pack version's live download count (e.g.
Contributor
There was a problem hiding this comment.
Pull request overview
Updates the publish.yml run summary generation to show per-tag GHCR download counts inline by rendering shields.io dynamic-regex badges in the publish-summary table (and documents the caveats of that approach in contributor docs). This improves the at-a-glance usefulness of the publish summary without introducing any first-party scraping or stored metrics.
Changes:
- Replace version hyperlink cells with shields.io dynamic-regex badges that scrape per-version download counts from GitHub’s public package versions pages.
- Add robust URL/regex percent-encoding helpers to avoid markdown URL corruption in generated summary markdown.
- Document the new badge behavior and its “experimental” dependency caveat in
CONTRIBUTING.md.
Show a summary per file
| File | Description |
|---|---|
| CONTRIBUTING.md | Documents the new publish-summary badge format, behavior, and reliability caveats, and links to the generating script. |
| .github/scripts/build-publish-summary.sh | Generates shields.io dynamic-regex badges (label=version, value=downloads) for published/up-to-date cells and updates the summary note accordingly. |
Review details
- Files reviewed: 2/2 changed files
- Comments generated: 0
- Review effort level: Low
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
Each
published/up-to-datecell in thepublish.ymlpublish-summary table (shown in the workflow run summary and upserted into the corresponding GitHub Release notes) now renders a shields.io Dynamic Regex Badge instead of a plain[version](url)link:0.6.0)2,559 downloads)Example rendering for
codeql-cpp-queries@0.6.0:How it works
The badge's
url/searchparams point shields.io at GitHub's public.../pkgs/container/<package>/versionspage (confirmed to hold full tag history, not just recent tags) and extract the download count for the specific tag via an RE2 regex. Shields fetches and scrapes this live, on every image render — there's no scraping infra, cron job, or stored data of our own to maintain. The count simply reflects whatever GitHub reports at view time (subject to shields.io's normal response caching).Important caveat
This relies on shields.io's
dynamic/regexbadge type, which is explicitly documented upstream as "experimental: may change or be removed at any time." If it's ever removed/broken, affected cells would render as a broken image/invalidbadge rather than failing the workflow. Documented this caveat inCONTRIBUTING.mdalongside implementation notes.Gotcha fixed along the way
Standard URL-encoders (jq's
@uri, .NET'sHttpUtility.UrlEncode, JS'sencodeURIComponent) all leave* ( ) ' !unescaped (RFC 2396 "mark" characters). Left as bare characters in a URL embedded in markdown,*can be misread as emphasis syntax and unbalanced(/)can prematurely close a markdown link's destination — silently corrupting the badge URL. Fixed by percent-encoding those explicitly on top of jq's@urioutput (seeurl_encode()inbuild-publish-summary.sh).Testing
build-publish-summary.shend-to-end against syntheticpublished/up-to-date/failedresult fragments and confirmed the table output, including that the 🆕 marker still appears only forpublishedstatus.bash -nsyntax-checked the script.Not in scope
Backfilling this new badge format onto historical releases' existing notes — this PR only changes what future
publish.ymlruns generate. Happy to follow up with a backfill pass separately if wanted.