Skip to content

Write an already-released version's changelog entry once - #231

Merged
matt-edmondson merged 1 commit into
mainfrom
fix/changelog-duplicate-on-tagged-head
Oct 9, 2026
Merged

matt-edmondson merged 1 commit into
mainfrom
fix/changelog-duplicate-on-tagged-head

Conversation

@matt-edmondson

Copy link
Copy Markdown
Contributor

Fixes #160

Before

On a HEAD that is already tagged, such as the daily schedule or a manual dispatch with nothing new since the release, ChangelogGenerator.GenerateAsync wrote the version twice. First came a "no significant changes" stub, diffed from the tag to itself. Then the history wrote the real entry for the same tag. LATEST_CHANGELOG.md ended up holding only the stub.

After

When v{version} is already in the tag list, there is no separate current-version entry. The history renders that version once, from its tag, and LATEST_CHANGELOG.md takes that tag's real entry. The rest is unchanged: the per-tag body of the historical loop moved into GetTagNotesAsync so both paths share it.

Because the regenerated files now match what is committed, a scheduled run on a released HEAD leaves the working tree clean, and MetadataService already skips the commit when nothing is staged.

Not done: part 2 of the issue (skip metadata on a Skip increment)

In ci, UpdateMetadataAsync runs before ResolveVersionAsync. The Skip decision is made against the metadata commit, so it doesn't exist yet when metadata is generated. Skipping generation would also leave the workspace without VERSION.md once consumer repositories gitignore it, as .github#6 decides, and the build reads its version from that file. With part 1 in, regenerating on a released HEAD is a no-op, so the gate would add an ordering change without stopping any additional commit. I'm happy to follow up if you still want it.

Testing

  • New GenerateAsync_VersionAlreadyTagged_WritesItsEntryOnceWithItsRealNotes: exactly one ## v1.0.1 heading, no "no significant changes" text, and LATEST_CHANGELOG.md holds v1.0.1's real notes. It fails on main (2 headings) and passes with the fix.
  • Full suite: 765/765 pass.
  • The Sonar local analyzers report nothing in the changed files.

🤖 Generated with Claude Code

https://claude.ai/code/session_01TJeQu4i8WTCDpvC4TN4Rjw


Generated by Claude Code

When the pipeline runs on a HEAD that is already tagged (the daily schedule
or a manual dispatch with nothing new), the version to write is the tag at
the top of the history. GenerateAsync wrote a "no significant changes" stub
for it, diffed from the tag to itself, and then the history wrote the real
entry for the same tag underneath. LATEST_CHANGELOG.md got the stub.

When the current version's tag already exists, the history alone renders it
now, and LATEST_CHANGELOG.md takes that tag's real entry. The regenerated
files then match what is committed, so a scheduled run on a released HEAD
leaves the tree clean and makes no metadata commit.

Fixes #160

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01TJeQu4i8WTCDpvC4TN4Rjw
@sonarqubecloud

sonarqubecloud Bot commented Oct 8, 2026

Copy link
Copy Markdown

@matt-edmondson
matt-edmondson merged commit 0447941 into main Oct 9, 2026
14 checks passed
@matt-edmondson
matt-edmondson deleted the fix/changelog-duplicate-on-tagged-head branch October 9, 2026 07:57
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.

Scheduled run with no new commits writes the current version into CHANGELOG.md twice and the bot commits it

1 participant