Skip to content

Add [DockerLastUpdated] badge for newest image date - #12105

Merged
PyvesB merged 2 commits into
badges:masterfrom
KesleyDavid:feat/badge-6016-docker-last-updated
Aug 10, 2026
Merged

Add [DockerLastUpdated] badge for newest image date#12105
PyvesB merged 2 commits into
badges:masterfrom
KesleyDavid:feat/badge-6016-docker-last-updated

Conversation

@KesleyDavid

Copy link
Copy Markdown
Contributor

Description

Adds a Docker Hub last updated badge that shows when the newest image tag (or a specific tag) was last pushed.

  • Newest tag: /docker/last-updated/:user/:repo
  • Specific tag: /docker/last-updated/:user/:repo/:tag
  • Uses the public Docker Hub tags API with ordering=last_updated (same family as existing Docker badges)
  • Renders via renderDateBadge (activity color scale by age)

Examples:

  • https://img.shields.io/docker/last-updated/_/alpine
  • https://img.shields.io/docker/last-updated/_/alpine/latest
  • https://img.shields.io/docker/last-updated/datadog/dogstatsd

Live API verification

GET https://registry.hub.docker.com/v2/repositories/library/alpine/tags?page_size=1&ordering=last_updated
→ 200, results[0].last_updated present

GET https://registry.hub.docker.com/v2/repositories/library/alpine/tags/latest
→ 200, last_updated present

Tests

  • Unit: npm run test:core -- --grep DockerLastUpdated → 4 passing
  • Live service: npm run test:services -- --only=DockerLastUpdated → 6 passing
  • Prettier + ESLint via pre-commit hook

References

AI note

Drafted with AI assistance; API responses, service pattern, and tests were verified locally before submitting.

@github-actions

github-actions Bot commented Aug 7, 2026

Copy link
Copy Markdown
Contributor
Messages
📖 ✨ Thanks for your contribution to Shields, @KesleyDavid!

Generated by 🚫 dangerJS against 2df0136

})

t.create('docker last updated (valid, user)')
.get('/datadog/dogstatsd.json')

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Love this example 🐶

return { date: data.last_updated }
}
if (data.count === 0 || data.results.length === 0) {
throw new NotFound({ prettyMessage: 'repository not found' })

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Wouldn't "repository not found" be triggered by a 404? Couldn't this case instead happen for a repository that does exist but that has not yet published any images?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Good catch — you’re right.

A 404 from the Hub API is already mapped to repository or tag not found. Hitting count === 0 / empty results on a 200 is a different case: the repository is there, it just doesn’t have any tags published yet.

I’ve updated the message to no tags found and adjusted the unit tests to match. Thanks for spotting that.

@KesleyDavid

Copy link
Copy Markdown
Contributor Author

Thanks for the review, @PyvesB.

Pushed a small fix for the empty-results path: that case now surfaces as no tags found instead of repository not found, since a missing repo/tag already comes through as a 404. Left the dogstatsd example as-is 🐶

Show when the newest (or a specific) Docker Hub image tag was last
updated, using the public registry tags API ordered by last_updated.
Empty Hub results mean a repository with no published tags, not a
missing repository. 404s already map to repository or tag not found.
@KesleyDavid
KesleyDavid force-pushed the feat/badge-6016-docker-last-updated branch from 70467c1 to 2df0136 Compare August 10, 2026 13:29

@PyvesB PyvesB left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Thanks for another good contribution!

@PyvesB
PyvesB added this pull request to the merge queue Aug 10, 2026
Merged via the queue into badges:master with commit 19ab51f Aug 10, 2026
19 checks passed
@PyvesB PyvesB added the service-badge New or updated service badge label Aug 11, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

service-badge New or updated service badge

Development

Successfully merging this pull request may close these issues.

Badge request: Newest dockerhub image

2 participants