From 1600a47c09e620cb5ec10e69ba8f1ea7e1be5347 Mon Sep 17 00:00:00 2001 From: Tim Hsiung Date: Sun, 10 May 2026 14:58:12 +0800 Subject: [PATCH] fix: keep git output out of the changelog increment file 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 #82 Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com> --- entrypoint.sh | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/entrypoint.sh b/entrypoint.sh index 9e3c655..38d4f71 100755 --- a/entrypoint.sh +++ b/entrypoint.sh @@ -95,6 +95,12 @@ if [[ $INPUT_MANUAL_VERSION ]]; then CZ_CMD+=("$INPUT_MANUAL_VERSION") fi if [[ $INPUT_CHANGELOG_INCREMENT_FILENAME ]]; then + # Avoid polluting the changelog increment file with git's commit output + # (e.g. "[main abcdef] bump: ..." and the file-change summary). + # Force git output to stderr unless the user already enabled it. + if [[ $INPUT_GIT_REDIRECT_STDERR != 'true' ]]; then + CZ_CMD+=('--git-output-to-stderr') + fi CZ_CMD+=('--changelog-to-stdout') echo "${CZ_CMD[@]}" ">$INPUT_CHANGELOG_INCREMENT_FILENAME" "${CZ_CMD[@]}" >"$INPUT_CHANGELOG_INCREMENT_FILENAME"