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>
Why
When changelog_increment_filename is set, the action redirects the
bump command's stdout to that file:
�ash "${CZ_CMD[@]}" >"$INPUT_CHANGELOG_INCREMENT_FILENAME"
By default cz bump prints its post-bump git commit output to
stdout 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_filename is supplied, automatically pass
--git-output-to-stderr to cz bump (unless the user already set
git_redirect_stderr: true). The git commit summary then goes to
stderr (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_FILENAME branch
in entrypoint.sh; behaviour is unchanged when
changelog_increment_filename is not used. Users who want the git
output in their changelog file can still get it by leaving
git_redirect_stderr at its default of false and not setting
changelog_increment_filename... which is the original use of the
flag.
Verification
Repro on a fresh test repo with one feat: commit, simulating the
relevant section of entrypoint.sh:
Before (current master) -- increment.md contents:
After this fix -- increment.md contents:
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