From b975736f5ad7f07c429474b8204c6fad18f18655 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Skyler=20M=C3=A4ntysaari?= Date: Sat, 29 Mar 2025 11:39:41 +0200 Subject: [PATCH] fix(ci): Improve handling of annotations string in YAML dump --- .github/scripts/renovate-releasenotes.py | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/.github/scripts/renovate-releasenotes.py b/.github/scripts/renovate-releasenotes.py index 9207dff..4dbf817 100755 --- a/.github/scripts/renovate-releasenotes.py +++ b/.github/scripts/renovate-releasenotes.py @@ -9,7 +9,7 @@ from pathlib import Path from ruamel.yaml import YAML from ruamel.yaml.comments import CommentedMap -from ruamel.yaml.scalarstring import LiteralScalarString +from ruamel.yaml.scalarstring import LiteralScalarString, PreservedScalarString from typing import List app = typer.Typer(add_completion=False) @@ -191,15 +191,15 @@ def main( if annotations: annotations_stream = io.StringIO() - yaml.dump(annotations, annotations_stream) + yaml.dump_all([annotations], annotations_stream) - annotations_string = annotations_stream.getvalue() + annotations_string = annotations_stream.getvalue().strip() annotations_stream.close() if "annotations" not in new_chart_metadata: new_chart_metadata["annotations"] = CommentedMap() - new_chart_metadata["annotations"]["artifacthub.io/changes"] = LiteralScalarString(annotations_string.strip()) + new_chart_metadata["annotations"]["artifacthub.io/changes"] = LiteralScalarString(annotations_string) logger.debug(f"Annotations: {annotations_string}") logger.debug(new_chart_metadata)