aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorGravatar Hedy Li <[email protected]>2020-10-03 16:06:57 +0800
committerGravatar Hedy Li <[email protected]>2020-10-03 16:07:04 +0800
commit9a5219bf62f9d502387a22701ca0c329088042f3 (patch)
treee8d83d17f398d05aebd439b30ee64e7531f0da20
parentAuthenticate GitHub API requests for the Hacktoberfest issue finder. (diff)
exclude spam label in get_october_prs
for hacktoberstats, prs with spam labels doesnt count
-rw-r--r--bot/exts/halloween/hacktoberstats.py9
1 files changed, 5 insertions, 4 deletions
diff --git a/bot/exts/halloween/hacktoberstats.py b/bot/exts/halloween/hacktoberstats.py
index ed1755e3..a6ed765e 100644
--- a/bot/exts/halloween/hacktoberstats.py
+++ b/bot/exts/halloween/hacktoberstats.py
@@ -162,7 +162,7 @@ class HacktoberStats(commands.Cog):
"""
Query GitHub's API for PRs created by a GitHub user during the month of October.
- PRs with the 'invalid' tag are ignored
+ PRs with an 'invalid' or 'spam' label are ignored
If a valid github_username is provided, an embed is generated and posted to the channel
@@ -220,7 +220,7 @@ class HacktoberStats(commands.Cog):
"""
Query GitHub's API for PRs created during the month of October by github_username.
- PRs with an 'invalid' tag are ignored
+ PRs with an 'invalid' or 'spam' label are ignored
If PRs are found, return a list of dicts with basic PR information
@@ -235,7 +235,7 @@ class HacktoberStats(commands.Cog):
"""
logging.info(f"Generating Hacktoberfest PR query for GitHub user: '{github_username}'")
base_url = "https://api.github.com/search/issues?q="
- not_label = "invalid"
+ not_labels = ("invalid", "spam")
action_type = "pr"
is_query = f"public+author:{github_username}"
not_query = "draft"
@@ -243,7 +243,8 @@ class HacktoberStats(commands.Cog):
per_page = "300"
query_url = (
f"{base_url}"
- f"-label:{not_label}"
+ f"-label:{not_labels[0]}"
+ f"-label:{not_labels[1]}"
f"+type:{action_type}"
f"+is:{is_query}"
f"+-is:{not_query}"