Skip to content

Track GHCR downloads over time - #142

Merged
GordonBeeming merged 2 commits into
mainfrom
chore/track-ghcr-downloads
Oct 7, 2026
Merged

GordonBeeming merged 2 commits into
mainfrom
chore/track-ghcr-downloads

Conversation

@GordonBeeming

@GordonBeeming GordonBeeming commented Oct 7, 2026 •

Copy link
Copy Markdown
Owner

Adds a daily GHCR download tracker, stores a rolling 90-day CSV history, generates an SVG trend chart, and adds a documentation page for viewing the chart.

The history begins with the first successful workflow run because GHCR does not expose historical daily download counts retroactively.

Summary by CodeRabbit

  • New Features
    • Added a GHCR download chart that tracks daily package downloads and displays trends over a rolling 90-day period.
    • Download totals are updated automatically, with missing counts treated as zero.
  • Documentation
    • Added guidance on the chart, its download history, and the available tracking details.

Copilot AI balanced review requested due to automatic review settings October 7, 2026 10:45
@chatgpt-codex-connector

chatgpt-codex-connector Bot commented Oct 7, 2026 •

Copy link
Copy Markdown

Codex Review Summary

This comment shows the latest Codex review activity on this pull request.

Review Status Commit Review trigger
📝 Code Review ✅ Completed 2026-10-07T10:48:35.790311Z 4a7c7ac PR opened
🔒 Security Review ✅ Completed 2026-10-07T10:52:13.743621Z 4a7c7ac PR opened
ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review" or "@codex security review".

Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings.

@coderabbitai

coderabbitai Bot commented Oct 7, 2026

Copy link
Copy Markdown

Review in Change Stack →

Note

Currently processing new changes in this PR. This may take a few minutes, please wait...

⚙️ Run configuration
  • Configuration used: defaults
  • Review profile: CHILL
  • Plan: Advanced
  • Run ID: f3297046-4806-4aa3-aec2-b826f7783c03
📥 Commits

Reviewing files that changed from the base of the PR and between b65db7e and 4a7c7ac.

📒 Files selected for processing (2)
  • .github/workflows/track-ghcr-downloads.yml
  • docs/ghcr-downloads.md
 ________________________________________________________________________________________________________________________
< Don't assume it - prove it. Prove your assumptions in the actual environment - with real data and boundary conditions. >
 ------------------------------------------------------------------------------------------------------------------------
  \
   \   (\__/)
       (•ㅅ•)
       /   づ
✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Commit to this branch
  • Create a new PR
  • Autopilot · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

@GordonBeeming
GordonBeeming merged commit aa3b159 into main Oct 7, 2026
13 of 14 checks passed
@GordonBeeming
GordonBeeming deleted the chore/track-ghcr-downloads branch October 7, 2026 10:46

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 4a7c7acd7d

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

Comment on lines +32 to +33
gh api --paginate "/users/${{ github.repository_owner }}/packages/container/copilot_here/versions?per_page=100" --jq '.[].download_count // 0' |
awk '{ total += $1 } END { print total + 0 }'

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P1 Badge Read download statistics from a supported API field

The documented response schema for this package-versions endpoint does not contain download_count; container versions expose fields such as id, name, timestamps, and metadata. Consequently, // 0 silently converts the missing field to zero for every version, and the workflow records a total of zero rather than actual GHCR downloads. Use an API field that exposes package download statistics, and avoid defaulting a missing metric to a valid count.

Useful? React with 👍 / 👎.

Comment on lines +138 to +140
if git diff --quiet -- docs/ghcr-downloads.csv docs/ghcr-downloads.svg; then
echo "No statistics changes to commit."
exit 0

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P1 Badge Stage generated files before checking for changes

On the initial run, both generated files are untracked because neither is included in this commit. git diff --quiet compares the working tree with the index and does not report untracked files, as reflected in the git diff documentation, so this condition succeeds and exits before git add. Every subsequent run starts from the same checkout and repeats this behavior, meaning the CSV and SVG are never committed; stage the paths before checking the cached diff, or explicitly account for untracked files.

Useful? React with 👍 / 👎.

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copilot review overview

🟡 Changes recommended

The workflow cannot obtain valid download counts or publish its initially generated files.

Review effort: Balanced
Findings: 2 High severity · 1 Medium severity

Open (3)
What changed in this PR

Introduces download-history tracking for the project’s GHCR container image.

Changes:

  • Adds a scheduled and manually triggered workflow to collect counts, maintain 90-day CSV history, and generate an SVG chart.
  • Adds documentation linking to the chart and raw history.
File Description
docs/​ghcr-downloads.md Documents the chart, history, and collection limits.
.github/​workflows/​track-ghcr-downloads.yml Collects statistics, generates artifacts, and attempts to commit updates.

💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.

run: |
set -euo pipefail
total="$(
gh api --paginate "/users/${{ github.repository_owner }}/packages/container/copilot_here/versions?per_page=100" --jq '.[].download_count // 0' |
shell: bash
run: |
set -euo pipefail
if git diff --quiet -- docs/ghcr-downloads.csv docs/ghcr-downloads.svg; then
y_span = max(max_count - y_min, 1)

def x(i):
return left + (plot_w * i / max(len(points) - 1, 1))
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.

2 participants