Skip to content

bin/release: the version check scans every ## header, so an ## Unreleased section makes it re-register the last release #280

Description

@1-Bort-1

Found while preparing v4.4.0 (#276). Not blocking that release — once the
version-bump PR for #276 merges, main's top header carries v4.4.0 and the
check behaves — but the failure mode is aimed squarely at the release procedure
in AGENTS.md §4.

bin/release:56 reads the changelog version with

awk '/^## / {for (i = 1; i <= NF; i++) if ($i ~ /^v[0-9]/) {print $i; exit}}' CHANGELOG.md

exit fires only when a v[0-9] field is found, so a top header without one —
## Unreleased — does not stop the scan. It falls through to the next ##
header and returns that version. The guard at :57 then compares the previous
release against Project.toml and passes, while the message at :60 ("Update
CHANGELOG.md so its first ## header matches the package version") shows the
first header is what was meant.

Both stanzas run against main at 0a8f046, where the top section was
## Unreleased:

Project.toml version:        4.3.1
CHANGELOG top version token: v4.3.1     <- from the v4.3.1 header, two sections down
notes extracted:             the Unreleased section (5 bullets, "### Added" only)

So ./bin/release on that tree would not have refused. It would have reported
v4.3.1 — a tag that already exists — carrying the unreleased notes, and posted
@JuliaRegistrator register for an already-registered version. Anyone running
agent release before the version-bump PR merges hits exactly this.

Fix: move the exit out of the if, so the scan stops at the first ## line
whether or not it matched, and an unversioned top header fails the guard.

awk '/^## / {for (i = 1; i <= NF; i++) if ($i ~ /^v[0-9]/) print $i; exit}' CHANGELOG.md

Worth a test that feeds it a changelog whose top section is ## Unreleased and
asserts a non-zero exit.

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions