Enable ignoring PRs by author
This commit is contained in:
parent
8db16e8cb1
commit
8ffb3a1fc1
1 changed files with 6 additions and 0 deletions
|
@ -158,6 +158,7 @@ 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
|
||||||
|
@ -178,6 +179,10 @@ 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 (
|
||||||
|
@ -237,6 +242,7 @@ 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"]
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue