[Chore] Provide token when getting 401 error

Issue #87

In GHE, token is necessary when querying the repo API,
When it fails, it returns 401 error. Will need to specify the token in
this case.
This commit is contained in:
Kane Ho
2022-09-21 23:44:03 -07:00
parent e64deeba68
commit 667293445b

View File

@@ -239,7 +239,7 @@ def find_default_branch():
response = requests.get(REPO_URL)
# Case 1: 404 might need a token
if response.status_code == 404:
if response.status_code in [401, 404]:
response = requests.get(REPO_URL, headers=HEADERS)
if response.status_code != 200:
abort_if_fail(response, "Unable to retrieve default branch")