Skip to content

Commit a6eef11

Browse files
committed
Support heroku in prerelease update
1 parent 342dc20 commit a6eef11

File tree

1 file changed

+6
-3
lines changed

1 file changed

+6
-3
lines changed

core/clients.py

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -61,7 +61,6 @@ class GitHub:
6161

6262
BASE = "https://api.github.com"
6363
REPO = BASE + "/repos/kyb3r/modmail"
64-
HEAD = REPO + "/git/refs/heads/master"
6564
MERGE_URL = BASE + "/repos/{username}/modmail/merges"
6665
FORK_URL = REPO + "/forks"
6766
STAR_URL = BASE + "/user/starred/kyb3r/modmail"
@@ -77,6 +76,10 @@ def __init__(self, bot, access_token: str = "", username: str = "", **kwargs):
7776
if self.access_token:
7877
self.headers = {"Authorization": "token " + str(access_token)}
7978

79+
@property
80+
def BRANCH(self):
81+
return "master" if not self.bot.version.is_prerelease else "development"
82+
8083
async def request(
8184
self,
8285
url: str,
@@ -151,10 +154,10 @@ async def update_repository(self, sha: str = None) -> Optional[dict]:
151154
raise commands.CommandInvokeError("Username not found.")
152155

153156
if sha is None:
154-
resp: dict = await self.request(self.HEAD)
157+
resp: dict = await self.request(self.REPO + "/git/refs/heads/" + self.BRANCH)
155158
sha = resp["object"]["sha"]
156159

157-
payload = {"base": "master", "head": sha, "commit_message": "Updating bot"}
160+
payload = {"base": self.BRANCH, "head": sha, "commit_message": "Updating bot"}
158161

159162
merge_url = self.MERGE_URL.format(username=self.username)
160163

0 commit comments

Comments
 (0)