From e001a309beb96e1f149a4e2eb8720ad99e7608e5 Mon Sep 17 00:00:00 2001 From: Anonymous Maarten Date: Sat, 2 Nov 2024 04:20:32 +0100 Subject: [PATCH] create-release.py: use head of git ref as default commit --- build-scripts/create-release.py | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/build-scripts/create-release.py b/build-scripts/create-release.py index 221444993..14916fa8b 100755 --- a/build-scripts/create-release.py +++ b/build-scripts/create-release.py @@ -23,18 +23,20 @@ def determine_remote() -> str: def main(): default_remote = determine_remote() - current_commit = subprocess.check_output(["git", "rev-parse", "HEAD"], cwd=ROOT, text=True).strip() - parser = argparse.ArgumentParser(allow_abbrev=False) parser.add_argument("--ref", required=True, help=f"Name of branch or tag containing release.yml") parser.add_argument("--remote", "-R", default=default_remote, help=f"Remote repo (default={default_remote})") - parser.add_argument("--commit", default=current_commit, help=f"Commit (default={current_commit})") + parser.add_argument("--commit", help=f"Input 'commit' of release.yml (default is the hash of the ref)") args = parser.parse_args() + if args.commit is None: + args.commit = subprocess.check_output(["git", "rev-parse", args.ref], cwd=ROOT, text=True).strip() + print(f"Running release.yml workflow:") - print(f" commit = {args.commit}") print(f" remote = {args.remote}") + print(f" ref = {args.ref}") + print(f" commit = {args.commit}") subprocess.check_call(["gh", "-R", args.remote, "workflow", "run", "release.yml", "--ref", args.ref, "-f", f"commit={args.commit}"], cwd=ROOT)