[llvm] 405932a - [llvm][github] Allow github links in /cherry-pick actions
Timm Bäder via llvm-commits
llvm-commits at lists.llvm.org
Tue May 23 03:32:40 PDT 2023
Author: Timm Bäder
Date: 2023-05-23T12:31:07+02:00
New Revision: 405932afc053920a41ea93666a575fe03521b49c
URL: https://github.com/llvm/llvm-project/commit/405932afc053920a41ea93666a575fe03521b49c
DIFF: https://github.com/llvm/llvm-project/commit/405932afc053920a41ea93666a575fe03521b49c.diff
LOG: [llvm][github] Allow github links in /cherry-pick actions
Differential Revision: https://reviews.llvm.org/D151191
Added:
Modified:
llvm/utils/git/github-automation.py
Removed:
################################################################################
diff --git a/llvm/utils/git/github-automation.py b/llvm/utils/git/github-automation.py
index 1790de1152a93..1ec58fef573dc 100755
--- a/llvm/utils/git/github-automation.py
+++ b/llvm/utils/git/github-automation.py
@@ -155,6 +155,19 @@ def phab_get_commit_approvers(phab_token: str, commit: github.Commit.Commit) ->
return accepted
+def extract_commit_hash(arg: str):
+ """
+ Extract the commit hash from the argument passed to /action github
+ comment actions. We currently only support passing the commit hash
+ directly or use the github URL, such as
+ https://github.com/llvm/llvm-project/commit/2832d7941f4207f1fcf813b27cf08cecc3086959
+ """
+ github_prefix = "https://github.com/llvm/llvm-project/commit/"
+ if arg.startswith(github_prefix):
+ return arg[len(github_prefix) :]
+ return arg
+
+
class ReleaseWorkflow:
CHERRY_PICK_FAILED_LABEL = "release:cherry-pick-failed"
@@ -460,7 +473,9 @@ def execute_command(self) -> bool:
args = m.group(2)
if command == "cherry-pick":
- return self.create_branch(args.split())
+ arg_list = args.split()
+ commits = list(map(lambda a: extract_commit_hash(a), arg_list))
+ return self.create_branch(commits)
if command == "branch":
m = re.match("([^/]+)/([^/]+)/(.+)", args)
More information about the llvm-commits
mailing list