Build pull request changelogs from release membership - #15
Merged
Merged
Conversation
The prs data source compared adjacent tags reachable from the current
branch, so what a section contained depended on where it was generated
from, and commits without a pull request were dropped in silence. A
repository with more than one release line, such as a 6.x branch beside
master, lost whole sections.
A release now contains the commits reachable from its tag but not from
any tag of a lower version, read from the local clone. Each commit
belongs to the lowest release that contains it, so a section comes out
the same on every branch, and sections are ordered by semver.
Three options go with it:
pullRequestRepos other repositories to look for pull requests in,
such as an upstream, a fork, or where the project
used to live
commitNotes what to say about a commit with no pull request, or
which pull request a cherry-pick came from
frozenBefore keep the sections of older releases as they are
A commit that matches neither a pull request nor a commitNotes entry is
reported with an entry to paste into the configuration, rather than
disappearing from the changelog.
Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
git writes an ISO 8601 date for UTC as either Z or +00:00, depending on its version, so tests that compared the string failed on a newer git than the one they were written on. The dates are only ever read as instants, so normalise them where they are read and the tool behaves the same on every version of git. Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
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.
The problem
With
--data-source=prs, a section was built by comparing a tag with the tag before it, using only tags reachable from the branchgrenhappened to run on. Three things followed from that:masterin a repository with a6.xline left out every section for tags that are not ancestors ofmaster. In xml-crypto that is 6.0.1–6.1.2, 3.2.x, 2.1.5–2.1.6 and 1.5.4–1.5.6.What this changes
A release contains the commits reachable from its tag but not from any tag of a lower version, read from the local clone with
git rev-list. Each commit belongs to the lowest release that contains it. That rule follows both parents of a merge and ignores the current branch, so a section comes out the same wherever it is generated, and sections are ordered by semver rather than by date.Three options come with it:
--pull-request-reposcommitNotes(config only)pr: 330— includingowner/repo#330— and take all of that from it. That is the entry to use for a cherry-pick pushed without a pull request of its own.--frozen-beforeCHANGELOG.md, so a version bump only has to review what is new.A commit matching neither a pull request nor a
commitNotesentry is now reported after generating, with an entry to paste into the configuration, instead of disappearing.Compatibility
The new options are additive and the other data sources are untouched, so this is a minor release. Existing
prsusers should expect a large diff on their first regeneration: sections that were missing appear, entries move to the release that actually contains them, and commits without a pull request are reported rather than dropped. Generate to a scratch file and read the diff before letting it writeCHANGELOG.md.grennow reads the local clone, so it needs the tags fetched and the full history —git fetch --unshallow, orfetch-depth: 0foractions/checkout. It stops rather than generating a thin changelog from a shallow one.Verification
pullRequestReposlookup gets most of the time.pullRequestRepos). Both byte-identical across every round of review fixes.🤖 Generated with Claude Code