[llvm] [Utils] Add new merge-release-pr.py script. (PR #101630)
Aiden Grossman via llvm-commits
llvm-commits at lists.llvm.org
Fri Aug 2 01:20:28 PDT 2024
================
@@ -0,0 +1,239 @@
+#!/usr/bin/env python3
+# ===-- merge-release-pr.py ------------------------------------------------===#
+#
+# Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
+# See https://llvm.org/LICENSE.txt for license information.
+# SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
+#
+# ===------------------------------------------------------------------------===#
+#
+# Helper script that will merge a Pull Request into a release branch. It will first
+# do some validations of the PR then rebase and finally push the changes to the
+# release branch.
+#
+# Usage: merge-release-pr.py <PR id>
+# By default it will push to the 'upstream' origin, but you can pass
+# --upstream-origin/-o <origin> if you want to change it.
+#
+# If you want to skip a specific validation, like the status checks you can
+# pass -s status_checks, this argument can be passed multiple times.
+#
+import argparse
+import json
+import subprocess
+import sys
+import time
+from typing import List
+
+
+class PRMerger:
+ def __init__(self, args):
+ self.pr = args.pr
+ self.args = args
+
+ def run_gh(self, gh_cmd: str, args: List[str]) -> str:
+ cmd = ["gh", gh_cmd, "-Rllvm/llvm-project"] + args
+ p = subprocess.run(cmd, capture_output=True)
+ if p.returncode != 0:
+ print(p.stderr)
+ raise RuntimeError("Failed to run gh")
+ return p.stdout
+
+ # Validate the state of the PR, this means making sure that it is
----------------
boomanaiden154 wrote:
Doc string here.
https://github.com/llvm/llvm-project/pull/101630
More information about the llvm-commits
mailing list