fix(bump): Preserve existing changelog header when changelog_merge_prerelease is used with cz bump --changelog#1850
Open
edgarrmondragon wants to merge 4 commits intocommitizen-tools:masterfrom
Conversation
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## master #1850 +/- ##
=======================================
Coverage 97.99% 97.99%
=======================================
Files 60 60
Lines 2691 2693 +2
=======================================
+ Hits 2637 2639 +2
Misses 54 54 ☔ View full report in Codecov by Sentry. |
Signed-off-by: Edgar Ramírez Mondragón <edgarrm358@gmail.com>
…rerelease` is used with `cz bump --changelog` Signed-off-by: Edgar Ramírez Mondragón <edgarrm358@gmail.com>
…rerelease` is used with `cz bump --changelog`, and no prereleases exist Signed-off-by: Edgar Ramírez Mondragón <edgarrm358@gmail.com>
0c3bced to
778edcb
Compare
edgarrmondragon
added a commit
to meltano/meltano
that referenced
this pull request
Feb 5, 2026
<!-- Please, go through these steps when you submit a PR. 1. Make sure your branch is not protected. In particular, avoid making PRs from the `main` branch of your fork. 2. Give a descriptive title to your PR. We use semantic titles, and the accepted types and scopes are listed in https://github.com/meltano/meltano/blob/main/.github/semantic.yml. A good title should look like this: ``` feat(cli): The `meltano run` command now accepts a `--timeout` option to limit the time it runs ``` 3. Provide a description of your changes. 4. Put "Closes #XXXX" in your comment to auto-close the issue that your PR fixes (if such). --> ## Description <!-- Describe the changes introduced by this PR --> ## Related Issues * commitizen-tools/commitizen#1850 Signed-off-by: Edgar Ramírez Mondragón <edgarrm358@gmail.com>
edgarrmondragon
added a commit
to meltano/meltano
that referenced
this pull request
Feb 5, 2026
<!-- Please, go through these steps when you submit a PR. 1. Make sure your branch is not protected. In particular, avoid making PRs from the `main` branch of your fork. 2. Give a descriptive title to your PR. We use semantic titles, and the accepted types and scopes are listed in https://github.com/meltano/meltano/blob/main/.github/semantic.yml. A good title should look like this: ``` feat(cli): The `meltano run` command now accepts a `--timeout` option to limit the time it runs ``` 3. Provide a description of your changes. 4. Put "Closes #XXXX" in your comment to auto-close the issue that your PR fixes (if such). --> ## Description <!-- Describe the changes introduced by this PR --> ## Related Issues * commitizen-tools/commitizen#1850 Signed-off-by: Edgar Ramírez Mondragón <edgarrm358@gmail.com>
bearomorphism
approved these changes
Feb 5, 2026
Collaborator
bearomorphism
left a comment
There was a problem hiding this comment.
Thanks you for reporting this issue and providing a fix! A few nits
Comment on lines
+1532
to
+1533
| assert out.startswith("# Changelog\n") | ||
| assert "All notable changes to this project will be documented here." in out |
Collaborator
There was a problem hiding this comment.
These assertions aren't needed
Comment on lines
+1576
to
+1578
| assert out.startswith("# Changelog\n") | ||
| assert "All notable changes." in out | ||
| assert "## 0.1.0 (1970-01-01)" in out |
Comment on lines
+233
to
+242
| has_prereleases_to_merge = latest_full_release_info.index is not None and ( | ||
| latest_full_release_info.name is None | ||
| or ( | ||
| changelog_meta.latest_version_position is not None | ||
| and changelog_meta.latest_version_position | ||
| < latest_full_release_info.index | ||
| ) | ||
| ) | ||
|
|
||
| if has_prereleases_to_merge and latest_full_release_info.index is not None: |
Collaborator
There was a problem hiding this comment.
Suggested change
| has_prereleases_to_merge = latest_full_release_info.index is not None and ( | |
| latest_full_release_info.name is None | |
| or ( | |
| changelog_meta.latest_version_position is not None | |
| and changelog_meta.latest_version_position | |
| < latest_full_release_info.index | |
| ) | |
| ) | |
| if has_prereleases_to_merge and latest_full_release_info.index is not None: | |
| if latest_full_release_info.index is not None and ( | |
| latest_full_release_info.name is None | |
| or ( | |
| changelog_meta.latest_version_position is not None | |
| and changelog_meta.latest_version_position | |
| < latest_full_release_info.index | |
| ) | |
| ): |
While has_prereleases_to_merge is descriptive, the condition latest_full_release_info.index is not None is duplicated and removing it will make mypy unhappy. The above comment is enough to help reader understand the intention behind this long expression.
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.
Description
Fixes a regression introduced in v4.11.3 (370ac9d, #1700) where using
cz bump --changelogwithchangelog_merge_prerelease = trueresults in the header of the existing changelog file being removed.Checklist
Was generative AI tooling used to co-author this PR?
Generated-by: Claude Code following the guidelines
Code Changes
uv run poe alllocally to ensure this change passes linter check and testsDocumentation Changes
uv run poe doclocally to ensure the documentation pages renders correctlyExpected Behavior
Steps to Test This Pull Request
Additional Context