Skip to content

Commit 9a894e7

Browse files
authored
[Github Automation] Allow colon after cherry-pick command (#81002)
Fixes: #64803 Removed unsupported branch command and changed Regex to accept /cherry-pick: command.
1 parent 2984699 commit 9a894e7

File tree

1 file changed

+8
-10
lines changed

1 file changed

+8
-10
lines changed

llvm/utils/git/github-automation.py

Lines changed: 8 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -616,22 +616,20 @@ def create_pull_request(
616616
def execute_command(self) -> bool:
617617
"""
618618
This function reads lines from STDIN and executes the first command
619-
that it finds. The 2 supported commands are:
620-
/cherry-pick commit0 <commit1> <commit2> <...>
621-
/branch <owner>/<repo>/<branch>
619+
that it finds. The supported command is:
620+
/cherry-pick< ><:> commit0 <commit1> <commit2> <...>
622621
"""
623622
for line in sys.stdin:
624623
line.rstrip()
625-
m = re.search(r"/([a-z-]+)\s(.+)", line)
624+
m = re.search(r"/cherry-pick\s*:? *(.*)", line)
626625
if not m:
627626
continue
628-
command = m.group(1)
629-
args = m.group(2)
630627

631-
if command == "cherry-pick":
632-
arg_list = args.split()
633-
commits = list(map(lambda a: extract_commit_hash(a), arg_list))
634-
return self.create_branch(commits)
628+
args = m.group(1)
629+
630+
arg_list = args.split()
631+
commits = list(map(lambda a: extract_commit_hash(a), arg_list))
632+
return self.create_branch(commits)
635633

636634
print("Do not understand input:")
637635
print(sys.stdin.readlines())

0 commit comments

Comments
 (0)