Delete redundant LABEL_ prefix

This commit is contained in:
Mikhail f. Shiryaev 2022-09-16 10:23:49 +02:00
parent ab7bd95d8b
commit 6a17d4e705
No known key found for this signature in database
GPG Key ID: 4B02ED204C7D93F4

View File

@ -44,11 +44,11 @@ from ssh import SSHKey
class Labels:
LABEL_MUST_BACKPORT = "pr-must-backport"
LABEL_BACKPORT = "pr-backport"
LABEL_BACKPORTS_CREATED = "pr-backports-created"
LABEL_CHERRYPICK = "pr-cherrypick"
LABEL_DO_NOT_TEST = "do not test"
MUST_BACKPORT = "pr-must-backport"
BACKPORT = "pr-backport"
BACKPORTS_CREATED = "pr-backports-created"
CHERRYPICK = "pr-cherrypick"
DO_NOT_TEST = "do not test"
class ReleaseBranch:
@ -204,8 +204,8 @@ Merge it only if you intend to backport changes to the target branch, otherwise
base=self.backport_branch,
head=self.cherrypick_branch,
)
self.cherrypick_pr.add_to_labels(Labels.LABEL_CHERRYPICK)
self.cherrypick_pr.add_to_labels(Labels.LABEL_DO_NOT_TEST)
self.cherrypick_pr.add_to_labels(Labels.CHERRYPICK)
self.cherrypick_pr.add_to_labels(Labels.DO_NOT_TEST)
self._assign_new_pr(self.cherrypick_pr)
def create_backport(self):
@ -236,7 +236,7 @@ Merge it only if you intend to backport changes to the target branch, otherwise
base=self.name,
head=self.backport_branch,
)
self.backport_pr.add_to_labels(Labels.LABEL_BACKPORT)
self.backport_pr.add_to_labels(Labels.BACKPORT)
self._assign_new_pr(self.backport_pr)
def _assign_new_pr(self, new_pr: PullRequest):
@ -321,8 +321,8 @@ class Backport:
tomorrow = date.today() + timedelta(days=1)
logging.info("Receive PRs suppose to be backported")
self.prs_for_backport = self.gh.get_pulls_from_search(
query=f"{self._query} -label:{Labels.LABEL_BACKPORTS_CREATED}",
label=",".join(self.labels_to_backport + [Labels.LABEL_MUST_BACKPORT]),
query=f"{self._query} -label:{Labels.BACKPORTS_CREATED}",
label=",".join(self.labels_to_backport + [Labels.MUST_BACKPORT]),
merged=[since_date, tomorrow],
)
logging.info(
@ -342,7 +342,7 @@ class Backport:
def process_pr(self, pr: PullRequest):
pr_labels = [label.name for label in pr.labels]
if Labels.LABEL_MUST_BACKPORT in pr_labels:
if Labels.MUST_BACKPORT in pr_labels:
branches = [
ReleaseBranch(br, pr) for br in self.release_branches
] # type: List[ReleaseBranch]
@ -407,11 +407,11 @@ class Backport:
if self.dry_run:
logging.info("DRY RUN: would mark PR #%s as done", pr.number)
return
pr.add_to_labels(Labels.LABEL_BACKPORTS_CREATED)
pr.add_to_labels(Labels.BACKPORTS_CREATED)
logging.info(
"PR #%s is successfully labeled with `%s`",
pr.number,
Labels.LABEL_BACKPORTS_CREATED,
Labels.BACKPORTS_CREATED,
)
@property