Skip to content

Commit 04fdf63

Browse files
committed
build: if draft, return early
1 parent 2891e01 commit 04fdf63

File tree

1 file changed

+29
-28
lines changed

1 file changed

+29
-28
lines changed

src/towncrier/build.py

Lines changed: 29 additions & 28 deletions
Original file line numberDiff line numberDiff line change
@@ -240,38 +240,39 @@ def __main(
240240
err=to_err,
241241
)
242242
click.echo(content)
243-
else:
244-
click.echo("Writing to newsfile...", err=to_err)
245-
news_file = config.filename
246-
247-
if config.single_file is False:
248-
# The release notes for each version are stored in a separate file.
249-
# The name of that file is generated based on the current version and project.
250-
news_file = news_file.format(
251-
name=project_name, version=project_version, project_date=project_date
252-
)
253-
254-
append_to_newsfile(
255-
base_directory,
256-
news_file,
257-
config.start_string,
258-
top_line,
259-
content,
260-
single_file=config.single_file,
243+
return
244+
245+
click.echo("Writing to newsfile...", err=to_err)
246+
news_file = config.filename
247+
248+
if config.single_file is False:
249+
# The release notes for each version are stored in a separate file.
250+
# The name of that file is generated based on the current version and project.
251+
news_file = news_file.format(
252+
name=project_name, version=project_version, project_date=project_date
261253
)
262254

263-
click.echo("Staging newsfile...", err=to_err)
264-
_git.stage_newsfile(base_directory, news_file)
255+
append_to_newsfile(
256+
base_directory,
257+
news_file,
258+
config.start_string,
259+
top_line,
260+
content,
261+
single_file=config.single_file,
262+
)
265263

266-
click.echo("Removing news fragments...", err=to_err)
267-
if should_remove_fragment_files(
268-
fragment_filenames,
269-
answer_yes,
270-
answer_keep,
271-
):
272-
_git.remove_files(fragment_filenames)
264+
click.echo("Staging newsfile...", err=to_err)
265+
_git.stage_newsfile(base_directory, news_file)
266+
267+
click.echo("Removing news fragments...", err=to_err)
268+
if should_remove_fragment_files(
269+
fragment_filenames,
270+
answer_yes,
271+
answer_keep,
272+
):
273+
_git.remove_files(fragment_filenames)
273274

274-
click.echo("Done!", err=to_err)
275+
click.echo("Done!", err=to_err)
275276

276277

277278
def should_remove_fragment_files(

0 commit comments

Comments
 (0)