Skip to content

Commit 3929f91

Browse files
committed
Release Workflow: Remove cherry-pick-failed label when pull request is created
Reviewed By: nikic Differential Revision: https://reviews.llvm.org/D121032
1 parent 382797d commit 3929f91

File tree

1 file changed

+8
-1
lines changed

1 file changed

+8
-1
lines changed

llvm/utils/git/github-automation.py

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -49,6 +49,8 @@ def setup_llvmbot_git(git_dir = '.'):
4949

5050
class ReleaseWorkflow:
5151

52+
CHERRY_PICK_FAILED_LABEL = 'release:cherry-pick-failed'
53+
5254
"""
5355
This class implements the sub-commands for the release-workflow command.
5456
The current sub-commands are:
@@ -146,14 +148,17 @@ def issue_notify_cherry_pick_failure(self, commit:str) -> github.IssueComment.Is
146148
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>`"
147149
issue = self.issue
148150
comment = issue.create_comment(message)
149-
issue.add_to_labels('release:cherry-pick-failed')
151+
issue.add_to_labels(self.CHERRY_PICK_FAILED_LABEL)
150152
return comment
151153

152154
def issue_notify_pull_request_failure(self, branch:str) -> github.IssueComment.IssueComment:
153155
message = "Failed to create pull request for {} ".format(branch)
154156
message += self.action_url
155157
return self.issue.create_comment(message)
156158

159+
def issue_remove_cherry_pick_failed_label(self):
160+
if self.CHERRY_PICK_FAILED_LABEL in [l.name for l in self.issue.labels]:
161+
self.issue.remove_from_labels(self.CHERRY_PICK_FAILED_LABEL)
157162

158163
def create_branch(self, commits:List[str]) -> bool:
159164
"""
@@ -183,6 +188,7 @@ def create_branch(self, commits:List[str]) -> bool:
183188
local_repo.git.push(push_url, 'HEAD:{}'.format(branch_name))
184189

185190
self.issue_notify_branch()
191+
self.issue_remove_cherry_pick_failed_label()
186192
return True
187193

188194

@@ -216,6 +222,7 @@ def create_pull_request(self, owner:str, branch:str) -> bool:
216222
return False
217223

218224
self.issue_notify_pull_request(pull)
225+
self.issue_remove_cherry_pick_failed_label()
219226

220227
# TODO(tstellar): Do you really want to always return True?
221228
return True

0 commit comments

Comments
 (0)