Skip to content

Commit d703f40

Browse files
authored
Update the list_pull_request 401 case (#89)
* Update the list_pull_request 401 case Hi, I find this http request is also missing the 401 case. * Update CHANGELOG.md
1 parent 4155448 commit d703f40

2 files changed

Lines changed: 4 additions & 3 deletions

File tree

CHANGELOG.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,7 @@ represented by the pull requests that fixed them. Critical items to know are:
1414
Versions correspond with GitHub releases that can be referenced with @ using actions.
1515

1616
## [master](https://github.com/vsoch/pull-request-action/tree/master) (master)
17+
- bugfix of token handling if 401 error received (missing 401 case) (1.0.21)
1718
- bugfix of writing to environment file (missing newline) (1.0.19)
1819
- bugfix of missing from branch with scheduled run (1.0.16)
1920
- forgot to add assignees (1.0.15)

pull-request.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -180,8 +180,8 @@ def list_pull_requests(target, source):
180180
print("Params for checking if pull request exists: %s" % params)
181181
response = requests.get(PULLS_URL, params=params)
182182

183-
# Case 1: 404 might warrant needing a token
184-
if response.status_code == 404:
183+
# Case 1: 401, 404 might warrant needing a token
184+
if response.status_code in [401, 404]:
185185
response = requests.get(PULLS_URL, params=params, headers=HEADERS)
186186
if response.status_code != 200:
187187
abort_if_fail(response, "Unable to retrieve information about pull requests")
@@ -238,7 +238,7 @@ def find_default_branch():
238238
"""Find default branch for a repo (only called if branch not provided)"""
239239
response = requests.get(REPO_URL)
240240

241-
# Case 1: 404 might need a token
241+
# Case 1: 401, 404 might need a token
242242
if response.status_code in [401, 404]:
243243
response = requests.get(REPO_URL, headers=HEADERS)
244244
if response.status_code != 200:

0 commit comments

Comments
 (0)