Skip to content

[Github Automation] Update Execute command #81002

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 8 commits into from
Mar 5, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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