Skip to content

fail when a released changelog section is edited #669

Description

@haribo

Why

An entry added to a released section of CHANGELOG.md is invisible to every check.

It has now happened twice, in the same place, for the same reason:

The mechanism is not carelessness, it is a property of the file. A release rolls
[Unreleased] into [X.Y.Z] and leaves a fresh [Unreleased] behind that carries only the
sections the next PRs add
. So right after a release, "the first ### Fixed in the file"
belongs to the version just published. Anything that appends relative to a section heading —
a script, an editor macro, a person scrolling — lands in the wrong one, and the result reads
perfectly.

test/changelog-rule.sh cannot see it: it validates the entries inside [Unreleased], so
an entry that is not there is not checked, it is absent.

Build

A check that a released section has not changed. The cheapest honest form: every
## [X.Y.Z] section is immutable once its tag exists, so compare each one against the same
section at that tag and fail on a difference.

git show vX.Y.Z:CHANGELOG.md   # the section as released

That is exact rather than heuristic, needs no new file to maintain, and gives a message that
can say which version was edited and how. It needs the tags present in the checkout — CI
fetches them for the release workflow, but the depth used by the other jobs has to be checked
before relying on it.

Deliberate consequence: a correction to a published section — a typo, a broken link — then
fails the gate. That is the right default (the section is history), and the escape is to say
so in the PR and let a human override, not to weaken the check.

Validation

  • Moving one word in a released section turns the check red, naming the version.
  • [Unreleased] is untouched by the new check — the word-count rule already owns it.
  • The check is added to the list CLAUDE.md tells a contributor to run before opening a PR, or
    it is a check nobody runs.

Out of scope

Preventing the misfile in the first place (a --unreleased insertion helper, a lint on section
order). Worth considering later; catching it is what stops it shipping.

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

    type: choreCI, tooling, maintenance

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions