Skip to content

Commit

Permalink
[Github Automation] Allow colon after cherry-pick command (#81002)
Browse files Browse the repository at this point in the history
Fixes: #64803

Removed unsupported branch command and changed Regex to
accept /cherry-pick: command.
  • Loading branch information
Sh0g0-1758 committed Mar 5, 2024
1 parent 2984699 commit 9a894e7
Showing 1 changed file with 8 additions and 10 deletions.
18 changes: 8 additions & 10 deletions llvm/utils/git/github-automation.py
Original file line number Diff line number Diff line change
Expand Up @@ -616,22 +616,20 @@ def create_pull_request(
def execute_command(self) -> bool:
"""
This function reads lines from STDIN and executes the first command
that it finds. The 2 supported commands are:
/cherry-pick commit0 <commit1> <commit2> <...>
/branch <owner>/<repo>/<branch>
that it finds. The supported command is:
/cherry-pick< ><:> commit0 <commit1> <commit2> <...>
"""
for line in sys.stdin:
line.rstrip()
m = re.search(r"/([a-z-]+)\s(.+)", line)
m = re.search(r"/cherry-pick\s*:? *(.*)", line)
if not m:
continue
command = m.group(1)
args = m.group(2)

if command == "cherry-pick":
arg_list = args.split()
commits = list(map(lambda a: extract_commit_hash(a), arg_list))
return self.create_branch(commits)
args = m.group(1)

arg_list = args.split()
commits = list(map(lambda a: extract_commit_hash(a), arg_list))
return self.create_branch(commits)

print("Do not understand input:")
print(sys.stdin.readlines())
Expand Down

0 comments on commit 9a894e7

Please sign in to comment.