Merge pull request #40845 from ClickHouse/cherry-pick-assignees

Assign new cherry-pick and backport PRs
This commit is contained in:
Mikhail f. Shiryaev 2022-09-01 18:32:46 +02:00 committed by GitHub
commit 9e4f5d5006
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -206,14 +206,7 @@ Merge it only if you intend to backport changes to the target branch, otherwise
)
self.cherrypick_pr.add_to_labels(Labels.LABEL_CHERRYPICK)
self.cherrypick_pr.add_to_labels(Labels.LABEL_DO_NOT_TEST)
if self.pr.assignees:
logging.info(
"Assing to assignees of the original PR: %s",
", ".join(user.login for user in self.pr.assignees),
)
self.cherrypick_pr.add_to_assignees(*self.pr.assignees)
logging.info("Assign to the author of the original PR: %s", self.pr.user.login)
self.cherrypick_pr.add_to_assignees(self.pr.user)
self._assign_new_pr(self.cherrypick_pr)
def create_backport(self):
# Checkout the backport branch from the remote and make all changes to
@ -244,14 +237,21 @@ Merge it only if you intend to backport changes to the target branch, otherwise
head=self.backport_branch,
)
self.backport_pr.add_to_labels(Labels.LABEL_BACKPORT)
self._assign_new_pr(self.backport_pr)
def _assign_new_pr(self, new_pr: PullRequest):
"""Assign `new_pr` to author, merger and assignees of an original PR"""
# It looks there some race when multiple .add_to_assignees are executed,
# so we'll add all at once
assignees = [self.pr.user, self.pr.merged_by]
if self.pr.assignees:
logging.info(
"Assing to assignees of the original PR: %s",
", ".join(user.login for user in self.pr.assignees),
)
self.cherrypick_pr.add_to_assignees(*self.pr.assignees)
logging.info("Assign to the author of the original PR: %s", self.pr.user.login)
self.backport_pr.add_to_assignees(self.pr.user)
assignees.extend(self.pr.assignees)
logging.info(
"Assing #%s to author and assignees of the original PR: %s",
new_pr.number,
", ".join(user.login for user in assignees),
)
new_pr.add_to_assignees(*assignees)
@property
def backported(self) -> bool: