-
Notifications
You must be signed in to change notification settings - Fork 13.4k
Github Automation: Add support for an optional colon after command name #66540
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
base: main
Are you sure you want to change the base?
Github Automation: Add support for an optional colon after command name #66540
Conversation
execute_command function (example -> /cherry-pick:)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Assuming the regex is correct, I'm fine with this.
I tested it with a lot of sample strings and it worked so I think it's correct. |
""" | ||
for line in sys.stdin: | ||
line.rstrip() | ||
m = re.search(r"/([a-z-]+)\s(.+)", line) | ||
m = re.search(r"/([a-z-]+)(?::)?\s(.+)", line) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
How about:
m = re.search(r"/([a-z-]+)(?::)?\s(.+)", line) | |
m = re.search(r"/([a-z-]+):?\s(.+)", line) |
Then the reader doesn't have to remember the rules for (?:...)
s
I think after #66781 this will no longer work. |
@llvm/pr-subscribers-github-workflow ChangesAs requested in #64803 example -> /cherry-pick: or /branch: Full diff: https://github.com/llvm/llvm-project/pull/66540.diff 1 Files Affected:
diff --git a/llvm/utils/git/github-automation.py b/llvm/utils/git/github-automation.py
index eac5816b5499f6a..090359b8822a73a 100755
--- a/llvm/utils/git/github-automation.py
+++ b/llvm/utils/git/github-automation.py
@@ -572,12 +572,12 @@ 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>
+ /cherry-pick<:> commit0 <commit1> <commit2> <...>
+ /branch<:> <owner>/<repo>/<branch>
"""
for line in sys.stdin:
line.rstrip()
- m = re.search(r"/([a-z-]+)\s(.+)", line)
+ m = re.search(r"/([a-z-]+)(?::)?\s(.+)", line)
if not m:
continue
command = m.group(1)
|
Error: Command failed due to missing milestone. |
1 similar comment
Error: Command failed due to missing milestone. |
Yes? The colon would still work if it's followed by a space. |
As requested in #64803
example -> /cherry-pick: or /branch: