Skip to content

Fix pre-release badges to actually track pre-releases#145

Merged
ptr727 merged 1 commit into
developfrom
fix-prerelease-badges
May 13, 2026
Merged

Fix pre-release badges to actually track pre-releases#145
ptr727 merged 1 commit into
developfrom
fix-prerelease-badges

Conversation

@ptr727
Copy link
Copy Markdown
Owner

@ptr727 ptr727 commented May 13, 2026

Summary

  • Adds &filter=*-g* to the prereleaseversion-shield URL in README.md so the GitHub Pre-Release badge filters to tags with the Nerdbank -g<short-sha> suffix only.
  • Drops the NuGet Pre-Release badge entirely (both the in-body usage and the link-reference definition). Shields' NuGet endpoint does not accept a filter; no clean fix exists.

Why

Observed after #144 merged: the GitHub Pre-Release badge displayed v1.2.42 (a full release), even though the actual latest pre-release at the time was 1.2.40-g0f69a1b0a0. Same for the NuGet Pre-Release badge.

Root cause is shields.io semantics:

  • github/v/release/...?include_prereleases and nuget/vpre/... both mean "include pre-releases as candidates and return the latest by published date / highest version" — not "show pre-releases only".
  • After every develop → main release merge, Nerdbank.GitVersioning publishes a full release with a height higher than any preceding pre-release, so both pre-release badges converge to their release-only siblings within seconds.

For GitHub there's a clean fix: shields.io's github/v/release endpoint accepts a filter glob. The Nerdbank short-sha suffix -g<10hex> only appears on pre-release tags, so filter=*-g* cleanly selects pre-releases.

For NuGet there isn't:

  • The NuGet shield ignores filter silently.
  • The dynamic/json shield rejects JSONPath filter predicates (query not supported).
  • NuGet's flat-container index is semver-sorted (pre-releases ahead of their stable counterparts), so $.versions[-1] lands on the same stable.

No way to filter to pre-releases only without a custom hosted endpoint. Dropping it is cleaner than carrying a redundant badge — the GitHub Pre-Release badge now carries the develop-side signal on its own.

Verification

Hit the new shield URLs directly:

  • GitHub Pre-Release with filter=*-g*v1.2.40-g0f69a1b0a0
  • GitHub Release (unchanged) → v1.2.42

Upstream

The upstream ptr727/ProjectTemplate README likely carries the same badge pattern and the same bug. A separate issue will be filed there with details for replication.

Test plan

  • Copilot review on the current head — no factual / phrasing pushback.
  • Check pull request workflow status green.
  • After the next pre-release publish on develop, the GitHub Pre-Release badge updates to the new pre-release tag (not the latest stable).

Both `shields.io/github/v/release/...?include_prereleases` and
`shields.io/nuget/vpre/...` use "include pre-releases as candidates,
return latest by date/version" semantics — not "show pre-releases
only". After every develop → main release merge a full release is
published with a higher Nerdbank.GitVersioning height than the
preceding pre-releases, so both pre-release badges converged to the
same value as their release-only siblings within seconds. Observed
today after #144 landed: the GitHub Pre-Release badge showed
`v1.2.42` (a full release) while the actual latest pre-release was
`1.2.40-g0f69a1b0a0`.

Two changes:

- Add `&filter=*-g*` to the GitHub pre-release shield URL. The
  `filter` glob is supported on `github/v/release` and matches the
  Nerdbank `-g<short-sha>` suffix that only pre-release tags carry;
  stable tags (`1.2.42`) don't. Verified live: the filtered URL
  renders `v1.2.40-g0f69a1b0a0` correctly.
- Drop the NuGet pre-release badge entirely. The NuGet shield
  endpoint accepts only the path-level `v`/`vpre` variant and ignores
  `filter`; the `dynamic/json` escape hatch doesn't support JSONPath
  filter predicates (`query not supported`), and NuGet's
  flat-container index is semver-sorted so `[-1]` lands on the same
  stable. No clean shields.io fix exists, and the data is structurally
  redundant with the NuGet Release badge whenever a higher stable
  exists. The GitHub Pre-Release badge now carries the pre-release
  signal on its own.

The upstream template carries the same badge pattern and is tracked
separately for replication.
Copilot AI review requested due to automatic review settings May 13, 2026 19:17
@ptr727 ptr727 enabled auto-merge (squash) May 13, 2026 19:18
Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

Updates the README badges so the “GitHub Pre-Release” badge reflects develop-side Nerdbank.GitVersioning pre-release tags (with -g<short-sha> suffix) rather than drifting to the latest stable release.

Changes:

  • Updated the GitHub pre-release shields.io URL to include filter=*-g* (while still including prereleases).
  • Removed the NuGet pre-release badge and its link reference definition since shields.io can’t reliably filter NuGet prereleases.

@ptr727 ptr727 merged commit f16a9ae into develop May 13, 2026
13 checks passed
ptr727 added a commit that referenced this pull request May 13, 2026
Release: pre-release badges actually track pre-releases (#145)
@ptr727 ptr727 deleted the fix-prerelease-badges branch May 13, 2026 19:44
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