[llvm] 3929f91 - Release Workflow: Remove cherry-pick-failed label when pull request is created

Tom Stellard via llvm-commits llvm-commits at lists.llvm.org
Fri Mar 25 00:45:58 PDT 2022


Author: Tom Stellard
Date: 2022-03-25T00:45:28-07:00
New Revision: 3929f91397159adbb7e84e215a8c7bc6db31db97

URL: https://github.com/llvm/llvm-project/commit/3929f91397159adbb7e84e215a8c7bc6db31db97
DIFF: https://github.com/llvm/llvm-project/commit/3929f91397159adbb7e84e215a8c7bc6db31db97.diff

LOG: Release Workflow: Remove cherry-pick-failed label when pull request is created

Reviewed By: nikic

Differential Revision: https://reviews.llvm.org/D121032

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 95db66a5ade49..aa4284c1e1921 100755
--- a/llvm/utils/git/github-automation.py
+++ b/llvm/utils/git/github-automation.py
@@ -49,6 +49,8 @@ def setup_llvmbot_git(git_dir = '.'):
 
 class ReleaseWorkflow:
 
+    CHERRY_PICK_FAILED_LABEL = 'release:cherry-pick-failed'
+
     """
     This class implements the sub-commands for the release-workflow command.
     The current sub-commands are:
@@ -146,7 +148,7 @@ def issue_notify_cherry_pick_failure(self, commit:str) -> github.IssueComment.Is
         message += "Please manually backport the fix and push it to your github fork.  Once this is done, please add a comment like this:\n\n`/branch <user>/<repo>/<branch>`"
         issue = self.issue
         comment = issue.create_comment(message)
-        issue.add_to_labels('release:cherry-pick-failed')
+        issue.add_to_labels(self.CHERRY_PICK_FAILED_LABEL)
         return comment
 
     def issue_notify_pull_request_failure(self, branch:str) -> github.IssueComment.IssueComment:
@@ -154,6 +156,9 @@ def issue_notify_pull_request_failure(self, branch:str) -> github.IssueComment.I
         message += self.action_url
         return self.issue.create_comment(message)
 
+    def issue_remove_cherry_pick_failed_label(self):
+        if self.CHERRY_PICK_FAILED_LABEL in [l.name for l in self.issue.labels]:
+            self.issue.remove_from_labels(self.CHERRY_PICK_FAILED_LABEL)
 
     def create_branch(self, commits:List[str]) -> bool:
         """
@@ -183,6 +188,7 @@ def create_branch(self, commits:List[str]) -> bool:
         local_repo.git.push(push_url, 'HEAD:{}'.format(branch_name))
 
         self.issue_notify_branch()
+        self.issue_remove_cherry_pick_failed_label()
         return True
 
 
@@ -216,6 +222,7 @@ def create_pull_request(self, owner:str, branch:str) -> bool:
             return False
 
         self.issue_notify_pull_request(pull)
+        self.issue_remove_cherry_pick_failed_label()
 
         # TODO(tstellar): Do you really want to always return True?
         return True


        


More information about the llvm-commits mailing list