[llvm] 51eaaa3 - github: Add a helpful message for issues without milestones
Tom Stellard via llvm-commits
llvm-commits at lists.llvm.org
Fri Jul 15 10:11:50 PDT 2022
Author: Tom Stellard
Date: 2022-07-15T10:11:40-07:00
New Revision: 51eaaa3092c030a57dc4c0016d4c59785563d5b7
URL: https://github.com/llvm/llvm-project/commit/51eaaa3092c030a57dc4c0016d4c59785563d5b7
DIFF: https://github.com/llvm/llvm-project/commit/51eaaa3092c030a57dc4c0016d4c59785563d5b7.diff
LOG: github: Add a helpful message for issues without milestones
The /branch and /cherry-pick commands only work when an isssue has
a milestone, so give the user a helpful error message when they
try these commands on issue without a milestone.
Reviewed By: thieta, kwk
Differential Revision: https://reviews.llvm.org/D125744
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 a868429083533..232a12ed36c6c 100755
--- a/llvm/utils/git/github-automation.py
+++ b/llvm/utils/git/github-automation.py
@@ -134,6 +134,19 @@ def issue_notify_branch(self) -> None:
def issue_notify_pull_request(self, pull:github.PullRequest.PullRequest) -> None:
self.issue.create_comment('/pull-request {}#{}'.format(self.branch_repo_name, pull.number))
+ def make_ignore_comment(self, comment: str) -> str:
+ """
+ Returns the comment string with a prefix that will cause
+ a Github workflow to skip parsing this comment.
+
+ :param str comment: The comment to ignore
+ """
+ return "<!--IGNORE-->\n"+comment
+
+ def issue_notify_no_milestone(self, comment:List[str]) -> None:
+ message = "{}\n\nError: Command failed due to missing milestone.".format(''.join(['>' + line for line in comment]))
+ self.issue.create_comment(self.make_ignore_comment(message))
+
@property
def action_url(self) -> str:
if os.getenv('CI'):
@@ -141,7 +154,7 @@ def action_url(self) -> str:
return ""
def issue_notify_cherry_pick_failure(self, commit:str) -> github.IssueComment.IssueComment:
- message = "<!--IGNORE-->\nFailed to cherry-pick: {}\n\n".format(commit)
+ message = self.make_ignore_comment("Failed to cherry-pick: {}\n\n".format(commit))
action_url = self.action_url
if action_url:
message += action_url + "\n\n"
@@ -295,6 +308,9 @@ def execute_command(self) -> bool:
release_workflow = ReleaseWorkflow(args.token, args.repo, args.issue_number,
args.branch_repo, args.branch_repo_token,
args.llvm_project_dir)
+ if not release_workflow.release_branch_for_issue:
+ release_workflow.issue_notify_no_milestone(sys.stdin.readlines())
+ sys.exit(1)
if args.sub_command == 'print-release-branch':
release_workflow.print_release_branch()
else:
More information about the llvm-commits
mailing list