The release PR converts an Unreleased heading instead of orphaning it - #41
Merged
Merged
Conversation
A repository that accumulates notes under `## Unreleased` between releases means that block: the release being cut IS those notes. The step prepended a new `## vX.Y.Z` section above it instead, which left `## Unreleased` stranded below a released version and filed the release's own notes under "Unreleased" in the published CHANGELOG.md. audiodsp had two such headings by the time v0.5.1 was cut. Now the first level-2 heading decides. If it is `## Unreleased`, that heading becomes the version and the generated git log joins the section under the notes already written. Otherwise the new section is inserted above the first level-2 heading, which also stops a `# Changelog` title and its preamble -- audiocomponents' shape -- being pushed below the release. The logic has to live in the workflow, because a reusable workflow runs against the caller's checkout and has no copy of this repository's scripts/. So tests/test_prepare_release_pr.py lifts the heredoc out of the YAML and runs it over fixture changelogs, the same way the mip synchronize tests do. Closes #40
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Fixes #40.
reusable-prepare-release-pr.ymlprepended its## vX.Y.Z (date)section tothe top of
CHANGELOG.md. Where a repository keeps a## Unreleasedblockbetween releases, that left the block stranded below a released version, and
the notes written for the release being cut shipped under "Unreleased" in the
published artifact.
Now the first level-2 heading decides what happens:
## Unreleased, that heading becomes## vX.Y.Z (date)and thegenerated
git logbullets are appended under the notes already written.rather than at the top of the file. That also fixes a second case nobody had
hit yet:
audiocomponentsopens with a# Changelogtitle and a paragraph,and the old code would have pushed both below the release section.
How it was proved
The logic has to live inline in the workflow — a reusable workflow runs
against the caller's checkout, so it has no copy of this repository's
scripts/.tests/test_prepare_release_pr.pytherefore lifts the exactheredoc out of the YAML and runs it, the same trick
tests/test_synchronize_mip_package.pyalready uses for the lockfile step.Eight fixtures: the reported bug, the title-and-preamble shape, no changelog
at all, no
Unreleasedblock, an empty one, no commits since the tag, and anUnreleasedheading that sits below a release (left alone — only the firstlevel-2 heading is the block being released).
The old shell run against the same fixture, to show the test is not passing
vacuously:
actionlintis clean on every workflow, every workflow still parses as YAML,and
ruff check scripts/ tests/passes.I also swept every
CHANGELOG.mdin the workspace for headings alreadyorphaned by past releases — the thing the issue asked to check. There are
none left; the two in
audiodspwere the ones fixed by hand on the v0.5.1release branch.