aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--bot/constants.py1
-rw-r--r--bot/exts/evergreen/issues.py13
2 files changed, 9 insertions, 5 deletions
diff --git a/bot/constants.py b/bot/constants.py
index 416dd0e7..e59fa641 100644
--- a/bot/constants.py
+++ b/bot/constants.py
@@ -168,6 +168,7 @@ class Emojis:
issue_closed = "<:IssueClosed:629695470570307614>"
pull_request = "<:PROpen:629695470175780875>"
pull_request_closed = "<:PRClosed:629695470519713818>"
+ pull_request_draft = "<:PRDraft:829755345425399848>"
merge = "<:PRMerged:629695470570176522>"
number_emojis = {
diff --git a/bot/exts/evergreen/issues.py b/bot/exts/evergreen/issues.py
index 4a73d20b..e83f1a3e 100644
--- a/bot/exts/evergreen/issues.py
+++ b/bot/exts/evergreen/issues.py
@@ -100,7 +100,7 @@ class Issues(commands.Cog):
for number in numbers:
url = f"https://api.github.com/repos/{user}/{repository}/issues/{number}"
- merge_url = f"https://api.github.com/repos/{user}/{repository}/pulls/{number}/merge"
+ pulls_url = f"https://api.github.com/repos/{user}/{repository}/pulls/{number}"
log.trace(f"Querying GH issues API: {url}")
async with self.bot.http_session.get(url, headers=REQUEST_HEADERS) as r:
json_data = await r.json()
@@ -123,12 +123,15 @@ class Issues(commands.Cog):
# we know that a PR has been requested and a call to the pulls API endpoint is necessary
# to get the desired information for the PR.
else:
- log.trace(f"PR provided, querying GH pulls API for additional information: {merge_url}")
- async with self.bot.http_session.get(merge_url) as m:
- if json_data.get("state") == "open":
+ log.trace(f"PR provided, querying GH pulls API for additional information: {pulls_url}")
+ async with self.bot.http_session.get(pulls_url) as p:
+ pull_data = await p.json()
+ if pull_data["draft"]:
+ icon_url = Emojis.pull_request_draft
+ elif pull_data["state"] == "open":
icon_url = Emojis.pull_request
# When the status is 204 this means that the state of the PR is merged
- elif m.status == 204:
+ elif pull_data["merged_at"] is not None:
icon_url = Emojis.merge
else:
icon_url = Emojis.pull_request_closed