Skip to content

Commit e5fb8ed

Browse files
authored
reuse APPROVED constant
1 parent 71586ee commit e5fb8ed

File tree

2 files changed

+4
-2
lines changed

2 files changed

+4
-2
lines changed

.github/workflows/scripts/constants.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,7 @@
1111
SUCCESS_STR: str = "success"
1212
FAILURE_STR: str = "failure"
1313
QUEUED_STR: str = "queued"
14+
APPROVED: str = "APPROVED"
1415

1516
SUPPORTED_LABELS: set[str] = {
1617
f"{LABEL_PREFIX}{WIP_LABEL_STR}",

.github/workflows/scripts/pr_workflow.py

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,7 @@
2020
SUPPORTED_LABELS,
2121
VERIFIED_LABEL_STR,
2222
WELCOME_COMMENT,
23+
APPROVED,
2324
)
2425
from github import Github, UnknownObjectException
2526
from simple_logger.logger import get_logger
@@ -264,7 +265,7 @@ def pull_request_review_label_actions(
264265
label_to_remove = None
265266
label_to_add = None
266267

267-
if self.review_state == "APPROVED":
268+
if self.review_state == APPROVED:
268269
label_to_remove = change_requested_label
269270
label_to_add = lgtm_label
270271

@@ -339,7 +340,7 @@ def dismiss_pr_approval(self) -> None:
339340
LOGGER.info(f"Looking for approving review by user {current_user}")
340341
# The reviews are paginated in chronological order. We need to get the newest by our account
341342
for review in all_reviews.reversed:
342-
if review.user.login == current_user and review.state == "APPROVED":
343+
if review.user.login == current_user and review.state == APPROVED:
343344
LOGGER.info(f"found review by user {current_user} with id {review.id}")
344345
review.dismiss(message="Dismissing review due to '/lgtm cancel' comment")
345346

0 commit comments

Comments
 (0)