fix: strip squash-merge "(#N)" suffix from release-note bullets - #11
Merged
Conversation
The v1.3.1 release rendered as: "Tighten release-notes whitespace in cliff template (#10) in [#10](url) by [@fiunchinho]" ^^^^^ ^^^^^ The first "(#10)" is auto-appended by GitHub to squash-merge commit messages; the second is the explicit link we render via cliff's GitHub integration. The first becomes redundant once we have the second. Add a commit_preprocessor that strips the trailing "(#N)" before parsing. The `(?m)` flag is load-bearing — git-cliff's regex defaults to single-line mode, so `$` would only match end-of-text; the squash `(#N)` lives at end-of-subject-line (with a body following), so we need end-of-line semantics. Verified locally that v1.3.1's bullet now renders cleanly without the duplicate ref, and that "(#N)" references inside commit bodies are left untouched.
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.
Summary
v1.3.1's release notes ended up with a duplicate PR reference:
The first
(#10)is auto-appended by GitHub to squash-merge commit messages; the second is the explicit link we render via cliff's GitHub integration. The first becomes redundant once we have the second.Adds a
commit_preprocessorthat strips the trailing(#N)from each commit message before parsing.Diff
(+ documentation comment explaining the
(?m)flag is load-bearing.)Why
(?m)?git-cliff's regex defaults to single-line mode, so
$matches end-of-text. The squash(#N)lives at end-of-subject-line, with the commit body following. Without(?m), the pattern silently fails to match. With it,$matches end-of-line and the trailing ref strips cleanly. Bodies'(#N)references are unaffected.Verified locally
Test plan
(#11)appearing twice in the bullet.