[PATCH] D125744: github: Add a helpful message for issues without milestones

Tom Stellard via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Mon May 16 22:32:24 PDT 2022


tstellar created this revision.
Herald added a project: All.
tstellar requested review of this revision.
Herald added a project: LLVM.

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.


Repository:
  rG LLVM Github Monorepo

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,10 @@
     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 issue_notify_no_milestone(self, comment) -> None:
+        message = "<!--IGNORE-->\n>{}\n\nError: Command failed due to missing milestone.".format(comment)
+        self.issue.create_comment(message)
+
     @property
     def action_url(self) -> str:
         if os.getenv('CI'):
@@ -443,6 +447,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(''.join(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.429935.patch
Type: text/x-patch
Size: 1211 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20220517/3710f8bf/attachment.bin>


More information about the llvm-commits mailing list