Skip to content

Fix: Register CHANGELOG.md as a commit pattern in the release hook - #8

Merged
tajobe merged 1 commit into
mainfrom
fix/changelog-commit-pattern
Jul 22, 2026
Merged

tajobe merged 1 commit into
mainfrom
fix/changelog-commit-pattern

Conversation

@tajobe

@tajobe tajobe commented Jul 22, 2026

Copy link
Copy Markdown
Contributor

Summary

  • axion-release's built-in commit hook only stages files explicitly registered via HookContext.addCommitPattern() — it does not commit all working-tree changes, only what's registered.
  • Our changelog-patching hook wrote CHANGELOG.md to disk but never registered it as a commit pattern, so the release commit ended up empty and the patched changelog was discarded.
  • This is exactly what caused the real v0.3.0 release to go out broken: the tag was created against an empty "Release version: 0.3.0" commit with CHANGELOG.md still showing [Unreleased], which made the downstream git-release action fail (it couldn't find a "0.3.0" section) — no GitHub release or package was published for that tag.
  • Fix: call context.addCommitPattern("CHANGELOG.md") alongside the existing patchChangelogToVersion(context.releaseVersion) call in the pre-release hook.

Test plan

  • Reproduced and confirmed the root cause by inspecting the real failed run's logs and the actual (empty) release commit on main
  • Verified the fix end-to-end using axion's release.localOnly mode in an isolated git worktree off main (with the fix applied and a throwaway commit ahead of the last tag, so axion would compute a real next version): the resulting local release commit now includes the full CHANGELOG.md diff — new version header, moved unreleased entries, regenerated compare links — instead of being empty
  • ./gradlew clean build passes

axion-release's built-in commit hook only stages files explicitly
registered via HookContext.addCommitPattern() - it does not commit
all working-tree changes. Our changelog-patching hook wrote
CHANGELOG.md to disk but never registered it, so the release commit
was empty and the patched changelog was discarded.

Verified the fix locally with axion's release.localOnly mode in an
isolated worktree: the resulting commit now includes the changelog
diff (new version header, moved entries, regenerated compare links).

This bug caused the real v0.3.0 release to go out with an unpatched
CHANGELOG.md and an empty release commit, which in turn made the
git-release action fail (it couldn't find a "0.3.0" section) - no
GitHub release or package was published for that tag. The v0.3.0 tag
is being deleted and the release re-run after this merges.

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This PR fixes the axion-release pre-release changelog patching hook so the updated CHANGELOG.md is actually staged and included in the release commit (axion only commits files explicitly registered via HookContext.addCommitPattern(...)).

Changes:

  • Update the axion scmVersion { hooks { pre { ... } } } hook to register CHANGELOG.md via context.addCommitPattern("CHANGELOG.md").
  • Document the release-commit staging fix in CHANGELOG.md.

Reviewed changes

Copilot reviewed 1 out of 2 changed files in this pull request and generated no comments.

File Description
build.gradle.kts Registers CHANGELOG.md as a commit pattern in the axion pre-release hook so the patched changelog is included in the release commit.
CHANGELOG.md Notes the fix in the Unreleased “Fixed” section for release workflow transparency.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

@tajobe
tajobe merged commit e0b7616 into main Jul 22, 2026
2 checks passed
@tajobe
tajobe deleted the fix/changelog-commit-pattern branch July 22, 2026 17:21
tajobe added a commit that referenced this pull request Jul 22, 2026
axion-release's built-in commit hook only stages files explicitly
registered via HookContext.addCommitPattern() - it does not commit
all working-tree changes. Our changelog-patching hook wrote
CHANGELOG.md to disk but never registered it, so the release commit
was empty and the patched changelog was discarded.

Verified the fix locally with axion's release.localOnly mode in an
isolated worktree: the resulting commit now includes the changelog
diff (new version header, moved entries, regenerated compare links).

This bug caused the real v0.3.0 release to go out with an unpatched
CHANGELOG.md and an empty release commit, which in turn made the
git-release action fail (it couldn't find a "0.3.0" section) - no
GitHub release or package was published for that tag. The v0.3.0 tag
is being deleted and the release re-run after this merges.
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.

2 participants