From 8fdcfc95a36a10250bb56dbfacfa18af2cef1a82 Mon Sep 17 00:00:00 2001 From: codejedi365 Date: Fri, 6 Dec 2024 23:29:21 -0700 Subject: [PATCH] fix(changelog): ensure user rendered files are trimmed to only a single ending newline --- src/semantic_release/changelog/template.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/semantic_release/changelog/template.py b/src/semantic_release/changelog/template.py index 9c7b74488..c441788ce 100644 --- a/src/semantic_release/changelog/template.py +++ b/src/semantic_release/changelog/template.py @@ -124,9 +124,9 @@ def recursive_render( # is used for inserting into a current changelog. When using stream rendering # of the same file, it always came back empty log.debug("rendering %s to %s", src_file_path, output_file_path) - rendered_file = environment.get_template(src_file_path).render() + rendered_file = environment.get_template(src_file_path).render().rstrip() with open(output_file_path, "w", encoding="utf-8") as output_file: - output_file.write(rendered_file) + output_file.write(f"{rendered_file}\n") rendered_paths.append(output_file_path) else: