Skip to content

Commit

Permalink
[Chore] Provide token when getting 401 error
Browse files Browse the repository at this point in the history
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.
  • Loading branch information
Kane Ho committed Sep 22, 2022
1 parent e64deeb commit 6672934
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion pull-request.py
Original file line number Diff line number Diff line change
Expand Up @@ -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")
Expand Down

0 comments on commit 6672934

Please sign in to comment.