Skip to content

fix(action): restrict prev-nightly lookup to same major.minor series - #44

Merged
BYK merged 1 commit into
mainfrom
fix/action-same-series
Aug 1, 2026
Merged

fix(action): restrict prev-nightly lookup to same major.minor series#44
BYK merged 1 commit into
mainfrom
fix/action-same-series

Conversation

@BYK

@BYK BYK commented Aug 1, 2026

Copy link
Copy Markdown
Owner

The prev-ghcr step walked past all 0.40 nightly tags and onto a stray 0.41 nightly because sort -V orders 0.41 > 0.40 lexicographically. At the time this step runs, the current build's own tag hasn't been pushed yet, so the loop's if [ "$tag" = ... ] break never triggers — the loop ends naturally after iterating every existing tag, and PREV_TAG becomes the 0.41 nightly.

Result: patches were generated FROM the 0.41 binary and stamped with from-version: 0.41.x-dev.Y — useless to any user on the 0.40 series.

Fix

Filter TAGS to only those in the same major.minor series as the current build before iterating. MAJOR_MINOR is parsed from VERSION (echo "${VERSION}" | cut -d. -f1,2 → e.g. 0.40). For 0.40.0-dev.X builds the loop only sees nightly-0.40.x-dev.* tags; for 0.41.0-dev.X only nightly-0.41.x-dev.*. First build of a new series falls through with PREV_TAG="" and the existing skip-empty-PREV path handles it cleanly.

Also uses grep -F (fixed-string) so the dot in MAJOR_MINOR is treated literally rather than as a regex metacharacter.

Relationship to getsentry/cli#1329

This is the action-side port of getsentry/cli#1329's hand-rolled MAJOR_MINOR filter. getsentry/cli is migrating to use this action (PR #1330) so this fix lands ahead of the migration completing.

Verification

  • pnpm test: 58 passed
  • YAML parses cleanly

The `prev-ghcr` step walked past all 0.40 nightly tags and onto a
stray 0.41 nightly because `sort -V` orders 0.41 > 0.40
lexicographically. At the time this step runs, the current build's
own tag hasn't been pushed yet, so the loop's
`if [ "$tag" = ... ]` break never triggers — the loop ends
naturally after iterating every existing tag, and PREV_TAG becomes
the 0.41 nightly.

Result: patches were generated FROM the 0.41 binary and stamped
with `from-version: 0.41.x-dev.Y` — useless to any user on the
0.40 series.

Fix: filter TAGS to only those in the same major.minor series as
the current build before iterating. `MAJOR_MINOR` is parsed from
VERSION (`echo "${VERSION}" | cut -d. -f1,2` → e.g. `0.40`).
For `0.40.0-dev.X` builds the loop only sees
`nightly-0.40.x-dev.*` tags; for `0.41.0-dev.X` only
`nightly-0.41.x-dev.*`. First build of a new series falls through
with PREV_TAG="" and the existing skip-empty-PREV path handles it
cleanly.

Also uses `grep -F` (fixed-string) so the dot in MAJOR_MINOR is
treated literally rather than as a regex metacharacter — defensive
parity with the rest of the script.

Port of getsentry/cli#1329's same-series filter into the action
(so consumers adopting `generate-ghcr` don't need to re-implement
this safeguard).
@BYK
BYK merged commit 2dca87a into main Aug 1, 2026
3 checks passed
@BYK
BYK deleted the fix/action-same-series branch August 1, 2026 00:47
@github-actions

github-actions Bot commented Aug 1, 2026

Copy link
Copy Markdown
Contributor
PR Preview Action v1.8.1
Preview removed because the pull request was closed.
2026-08-01 00:48 UTC

This was referenced Aug 1, 2026
BYK added a commit to getsentry/cli that referenced this pull request Aug 1, 2026
BYK/binpatch#44 ported the same-series filter from #1329
into the binpatch action's prev-ghcr step, so consumers adopting
`generate-ghcr` no longer need to re-implement this safeguard.

This bumps both the runtime dep (`binpatch` ^0.4.1 → ^0.4.2) and
the action ref (BYK/binpatch/action@0.4.1 → @0.4.2) so the
migration actually picks up the action's own fix.
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