Skip to content

Commit

Permalink
feat: remove obsolete labels in closed/merged PRs
Browse files Browse the repository at this point in the history
  • Loading branch information
navinkarkera committed Jan 20, 2025
1 parent 4e2da26 commit 4803aea
Show file tree
Hide file tree
Showing 2 changed files with 27 additions and 0 deletions.
21 changes: 21 additions & 0 deletions openedx_webhooks/labels.py
Original file line number Diff line number Diff line change
Expand Up @@ -14,3 +14,24 @@
"blended",
"open-source-contribution",
}

GITHUB_MERGED_PR_OBSOLETE_LABELS = {
"blocked by other work",
"changes requested",
"inactive",
"needs maintainer attention",
"needs more product information",
"needs rescoping",
"needs reviewer assigned",
"needs test run",
"waiting for eng review",
"waiting on author",
}

GITHUB_CLOSED_PR_OBSOLETE_LABELS = {
"needs maintainer attention",
"needs reviewer assigned",
"needs test run",
"waiting for eng review",
"waiting on author",
}
6 changes: 6 additions & 0 deletions openedx_webhooks/tasks/pr_tracking.py
Original file line number Diff line number Diff line change
Expand Up @@ -59,6 +59,8 @@
)
from openedx_webhooks.labels import (
GITHUB_CATEGORY_LABELS,
GITHUB_CLOSED_PR_OBSOLETE_LABELS,
GITHUB_MERGED_PR_OBSOLETE_LABELS,
GITHUB_STATUS_LABELS,
)
from openedx_webhooks import settings
Expand Down Expand Up @@ -477,6 +479,10 @@ def _fix_github_labels(self) -> None:
"""
desired_labels = set(self.desired.github_labels)
ad_hoc_labels = self.current.github_labels - GITHUB_CATEGORY_LABELS - GITHUB_STATUS_LABELS
if self.pr["state"] == "closed":
ad_hoc_labels -= GITHUB_CLOSED_PR_OBSOLETE_LABELS
elif self.pr["state"] == "merged":
ad_hoc_labels -= GITHUB_MERGED_PR_OBSOLETE_LABELS
desired_labels.update(ad_hoc_labels)

if desired_labels != self.current.github_labels:
Expand Down

0 comments on commit 4803aea

Please sign in to comment.