Compare commits
No commits in common. "d497f166444064d47af10ae3eb1fc59976be0aaa" and "2d77b385771481c2444bdde4a04017b6a9d65a04" have entirely different histories.
d497f16644
...
2d77b38577
1 changed files with 3 additions and 13 deletions
|
@ -158,7 +158,6 @@ def maintain(config_path: Path, schedule: timedelta):
|
||||||
client = Client(config["gh-unnotifier"]["api_key"])
|
client = Client(config["gh-unnotifier"]["api_key"])
|
||||||
org_shitlist = config["gh-unnotifier"].get("org_shitlist", [])
|
org_shitlist = config["gh-unnotifier"].get("org_shitlist", [])
|
||||||
team_shitlist = config["gh-unnotifier"].get("team_shitlist", [])
|
team_shitlist = config["gh-unnotifier"].get("team_shitlist", [])
|
||||||
author_shitlist = config["gh-unnotifier"].get("author_shitlist", [])
|
|
||||||
user = client.get_user()
|
user = client.get_user()
|
||||||
user_teams = {it["slug"] for it in client.get_user_teams()}
|
user_teams = {it["slug"] for it in client.get_user_teams()}
|
||||||
mark = savepoint = prev = None
|
mark = savepoint = prev = None
|
||||||
|
@ -179,10 +178,6 @@ def maintain(config_path: Path, schedule: timedelta):
|
||||||
_resolve(notif, "Closed")
|
_resolve(notif, "Closed")
|
||||||
return
|
return
|
||||||
|
|
||||||
if pr["user"]["login"] in author_shitlist:
|
|
||||||
_resolve(notif, "Ignoring PR by author")
|
|
||||||
return
|
|
||||||
|
|
||||||
if notif["reason"] == "review_requested":
|
if notif["reason"] == "review_requested":
|
||||||
reviewers = client.get_pr_reviewers(pr)
|
reviewers = client.get_pr_reviewers(pr)
|
||||||
if (
|
if (
|
||||||
|
@ -224,7 +219,6 @@ def maintain(config_path: Path, schedule: timedelta):
|
||||||
|
|
||||||
def _issue(subject, notif):
|
def _issue(subject, notif):
|
||||||
issue = client.get_issue(url=subject["url"])
|
issue = client.get_issue(url=subject["url"])
|
||||||
|
|
||||||
if issue["state"] == "closed":
|
if issue["state"] == "closed":
|
||||||
comments = client.get_comments(url=issue["comments_url"])
|
comments = client.get_comments(url=issue["comments_url"])
|
||||||
if not any(
|
if not any(
|
||||||
|
@ -232,9 +226,6 @@ def maintain(config_path: Path, schedule: timedelta):
|
||||||
):
|
):
|
||||||
_resolve(notif, "Unengaged issue closed")
|
_resolve(notif, "Unengaged issue closed")
|
||||||
|
|
||||||
if user["author"]["login"] in author_shitlist:
|
|
||||||
_resolve(notif, "Ignoring issue by author")
|
|
||||||
|
|
||||||
while True:
|
while True:
|
||||||
try:
|
try:
|
||||||
savepoint = prev
|
savepoint = prev
|
||||||
|
@ -246,18 +237,17 @@ def maintain(config_path: Path, schedule: timedelta):
|
||||||
notif_timestamp = datetime.fromisoformat(notif["updated_at"])
|
notif_timestamp = datetime.fromisoformat(notif["updated_at"])
|
||||||
if (mark - notif_timestamp).days > 3:
|
if (mark - notif_timestamp).days > 3:
|
||||||
_resolve(notif, "More than 3 days old")
|
_resolve(notif, "More than 3 days old")
|
||||||
continue
|
|
||||||
|
|
||||||
subject = notif["subject"]
|
subject = notif["subject"]
|
||||||
|
|
||||||
match subject["type"].lower():
|
match subject["type"]:
|
||||||
case "pullrequest":
|
case "PullRequest":
|
||||||
_pr(subject, notif)
|
_pr(subject, notif)
|
||||||
|
|
||||||
case "mention":
|
case "mention":
|
||||||
_mention(subject, notif)
|
_mention(subject, notif)
|
||||||
|
|
||||||
case "issue":
|
case "Issue":
|
||||||
_issue(subject, notif)
|
_issue(subject, notif)
|
||||||
|
|
||||||
duration = (tick - datetime.now(timezone.utc)).total_seconds()
|
duration = (tick - datetime.now(timezone.utc)).total_seconds()
|
||||||
|
|
Loading…
Reference in a new issue