From c8fc68f3209e763a9192819215dc0f84d98f6e4e Mon Sep 17 00:00:00 2001 From: KevinTran3011 <112609054+KevinTran3011@users.noreply.github.com> Date: Mon, 24 Aug 2026 10:47:42 +1000 Subject: [PATCH] fix: avoid shell interpretation in release tooling --- runtime/python/prompty/scripts/release.py | 16 +++++++++------- 1 file changed, 9 insertions(+), 7 deletions(-) diff --git a/runtime/python/prompty/scripts/release.py b/runtime/python/prompty/scripts/release.py index 02137cef7..adc3ee7ee 100644 --- a/runtime/python/prompty/scripts/release.py +++ b/runtime/python/prompty/scripts/release.py @@ -19,6 +19,7 @@ import argparse import re +import shlex import subprocess import sys from pathlib import Path @@ -76,9 +77,10 @@ def bump_version(current: str, bump: str) -> str: sys.exit(1) -def run(cmd: str) -> None: - print(f" $ {cmd}") - subprocess.run(cmd, cwd=REPO_ROOT, shell=True, check=True) +def run(cmd: list[str]) -> None: + """Run a release command without invoking a shell.""" + print(f" $ {shlex.join(cmd)}") + subprocess.run(cmd, cwd=REPO_ROOT, check=True) def main() -> None: @@ -116,12 +118,12 @@ def main() -> None: # Git commit, tag, push print("\nšŸ”– Creating commit and tag...\n") - run("git add runtime/python/prompty/prompty/_version.py") - run(f'git commit -m "chore(python): release v{new_version}"') - run(f'git tag -a {tag} -m "{tag}"') + run(["git", "add", "runtime/python/prompty/prompty/_version.py"]) + run(["git", "commit", "-m", f"chore(python): release v{new_version}"]) + run(["git", "tag", "-a", tag, "-m", tag]) print("\nšŸš€ Pushing to origin...\n") - run("git push origin main --follow-tags") + run(["git", "push", "origin", "main", "--follow-tags"]) print(f"\nāœ… Done! Tag {tag} pushed.") print(" CI will build, test, and publish to PyPI.\n")