Fix: enforce non-empty asset list when publishing (#13201)

This patch closes a logic gap in [tools/devops/create-release.py](cci:7://file:///c:/Users/T2430514/Downloads/WSL/tools/devops/create-release.py:0:0-0:0): * **Problem** – The script’s `--publish` mode was intended to require at least one asset, but Click passes an empty tuple if no assets are provided. The original guard (`if assets is None`) never triggered, allowing empty releases to be drafted. * **Solution** – Replace the check with `if not assets:` which catches both `None` and empty collections, preventing accidental empty releases. * **Impact** – Ensures CI and manual runs cannot publish a release without payload, aligning behavior with the CLI contract and avoiding junk tags that require manual cleanup. Co-authored-by: Odio Marcelino <odiomarcelino@gmail.com>

S. M. Mohiuddin Khan Shiam committed Jul 24, 2025 at 23:51 UTC 41f97bbc816ddeabf7975f8701d307212cef183c
1 file changed +4 -1
tools/devops/create-release.py
+4 -1
@@ -22,7 +22,10 @@ from urllib.parse import urlparse
22 @click.option('--auto-release-notes', is_flag=True, default=False)
23 def main(version: str, previous: str, max_message_lines: int, publish: bool, assets: list, no_fetch: bool, github_token: str, use_current_ref: bool, auto_release_notes: bool):
24 if publish:
25 - if assets is None:
25 + # Click provides an empty tuple when no assets are passed. Guard against both
26 + # an explicit None (older Click versions / direct invocation) and an empty
27 + # collection so we do not accidentally create a release without payload.
28 + if not assets:
29 raise RuntimeError('--publish requires at least one asset')
30
31 if github_token is None: