@@ -32,7 +32,7 @@ <h1 class="title">Module <code>continuous_delivery_scripts.assert_news</code></h
32
32
< span > Expand source code</ span >
33
33
</ summary >
34
34
< pre > < code class ="python "> #
35
- # Copyright (C) 2020-2023 Arm Limited or its affiliates and Contributors. All rights reserved.
35
+ # Copyright (C) 2020-2025 Arm Limited or its affiliates and Contributors. All rights reserved.
36
36
# SPDX-License-Identifier: Apache-2.0
37
37
#
38
38
"""Checks if valid news files are created for changes in the project."""
@@ -41,7 +41,7 @@ <h1 class="title">Module <code>continuous_delivery_scripts.assert_news</code></h
41
41
import pathlib
42
42
import re
43
43
import sys
44
- from typing import List, Union
44
+ from typing import Union, Optional, Iterable, Any, List
45
45
46
46
from continuous_delivery_scripts.utils.configuration import configuration, ConfigurationVariable
47
47
from continuous_delivery_scripts.utils.git_helpers import ProjectTempClone, LocalProjectRepository, GitWrapper
@@ -131,6 +131,12 @@ <h1 class="title">Module <code>continuous_delivery_scripts.assert_news</code></h
131
131
validate_news_file(absolute_file_path)
132
132
133
133
134
+ def _convert_to_string_iter(list: Optional[List[Any]]) -> Iterable[str]:
135
+ if list is None:
136
+ return []
137
+ return [str(item) for item in list]
138
+
139
+
134
140
def generate_news_file(git: GitWrapper, news_dir: pathlib.Path) -> pathlib.Path:
135
141
"""Adds a news file if the branch corresponds to an dependency update.
136
142
@@ -147,8 +153,9 @@ <h1 class="title">Module <code>continuous_delivery_scripts.assert_news</code></h
147
153
if not configuration.get_value(ConfigurationVariable.AUTOGENERATE_NEWS_FILE_ON_DEPENDENCY_UPDATE):
148
154
raise EnvironmentError(f"Branch {current_branch} must contain a news file.")
149
155
156
+ list_groups = _convert_to_string_iter(groups)
150
157
message = str(configuration.get_value(ConfigurationVariable.DEPENDENCY_UPDATE_NEWS_MESSAGE)).format(
151
- message=", ".join(groups )
158
+ message=", ".join(list_groups )
152
159
)
153
160
logger.info(f"Generating a news file with content: {message}...")
154
161
return create_news_file(
@@ -163,7 +170,7 @@ <h1 class="title">Module <code>continuous_delivery_scripts.assert_news</code></h
163
170
logger.info(f"Committing news file {str(news_file)}...")
164
171
if not local:
165
172
git.configure_for_github()
166
- git.add(str( news_file) )
173
+ git.add(news_file)
167
174
git.commit("📰 Automatic changes ⚙ Adding news file")
168
175
if not local:
169
176
git.push()
@@ -289,8 +296,9 @@ <h2 id="args">Args</h2>
289
296
if not configuration.get_value(ConfigurationVariable.AUTOGENERATE_NEWS_FILE_ON_DEPENDENCY_UPDATE):
290
297
raise EnvironmentError(f"Branch {current_branch} must contain a news file.")
291
298
299
+ list_groups = _convert_to_string_iter(groups)
292
300
message = str(configuration.get_value(ConfigurationVariable.DEPENDENCY_UPDATE_NEWS_MESSAGE)).format(
293
- message=", ".join(groups )
301
+ message=", ".join(list_groups )
294
302
)
295
303
logger.info(f"Generating a news file with content: {message}...")
296
304
return create_news_file(
0 commit comments