[PATCH] D125744: github: Add a helpful message for issues without milestones
Tom Stellard via Phabricator via llvm-commits
llvm-commits at lists.llvm.org
Thu Jul 7 17:55:58 PDT 2022
tstellar updated this revision to Diff 443098.
tstellar added a comment.
Address review comments.
Repository:
rG LLVM Github Monorepo
CHANGES SINCE LAST ACTION
https://reviews.llvm.org/D125744/new/
https://reviews.llvm.org/D125744
Files:
llvm/utils/git/github-automation.py
Index: llvm/utils/git/github-automation.py
===================================================================
--- llvm/utils/git/github-automation.py
+++ llvm/utils/git/github-automation.py
@@ -150,6 +150,19 @@
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'):
@@ -157,7 +170,7 @@
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"
@@ -385,6 +398,9 @@
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:
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D125744.443098.patch
Type: text/x-patch
Size: 1976 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20220708/7f45655f/attachment.bin>
More information about the llvm-commits
mailing list