fix: keep git output out of the changelog increment file#113
Open
bearomorphism wants to merge 1 commit into
Open
fix: keep git output out of the changelog increment file#113bearomorphism wants to merge 1 commit into
bearomorphism wants to merge 1 commit into
Conversation
When `changelog_increment_filename` is set, the action redirects the bump command's stdout to that file. Without `--git-output-to-stderr`, the post-bump `git commit` output (e.g. `[main abcdef] bump: version 0.0.0 -> 0.1.0` and the `2 files changed, ...` summary) ends up appended to the changelog file, producing a noisy artifact that has to be hand-cleaned before it can be used as a release body. When `changelog_increment_filename` is supplied, force `--git-output-to-stderr` unless the user already enabled it via `git_redirect_stderr: true`. The changelog file then contains only the actual changelog content. Closes commitizen-tools#82 Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
This was referenced May 10, 2026
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.
Why
When
changelog_increment_filenameis set, the action redirects thebump command's stdout to that file:
�ash "${CZ_CMD[@]}" >"$INPUT_CHANGELOG_INCREMENT_FILENAME"By default
cz bumpprints its post-bumpgit commitoutput tostdout as well, so the file ends up containing not just the changelog
section but also the git noise:
The user has to clean those last lines out before they can be used as
e.g. a release body, as reported in #82.
What
When
changelog_increment_filenameis supplied, automatically pass--git-output-to-stderrtocz bump(unless the user already setgit_redirect_stderr: true). The git commit summary then goes tostderr (so it still shows in the action log) and the changelog file
contains only the changelog section.
How
The fix is local to the
INPUT_CHANGELOG_INCREMENT_FILENAMEbranchin
entrypoint.sh; behaviour is unchanged whenchangelog_increment_filenameis not used. Users who want the gitoutput in their changelog file can still get it by leaving
git_redirect_stderrat its default offalseand not settingchangelog_increment_filename... which is the original use of theflag.
Verification
Repro on a fresh test repo with one
feat:commit, simulating therelevant section of
entrypoint.sh:Before (current
master) --increment.mdcontents:After this fix --
increment.mdcontents:The git output (
[main f21d45e] ...and the file-change summary)appears on stderr instead, so it still shows up in the workflow log
but no longer pollutes the file.
Closes #82