Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
17 changes: 13 additions & 4 deletions src/psrt_ghsa_bot/app.py
Original file line number Diff line number Diff line change
Expand Up @@ -134,9 +134,14 @@ def credit_if_uncredited(login: str, type: str) -> None:
per_page=100,
).content
)
except RequestFailed:
capture_exception()
raise RuntimeError("Request to list pull requests failed") from None
except RequestFailed as e:
# If there are no pull requests the API
# returns 404. Skip instead of erroring.
if e.response.status_code == 404:
pull_requests = []
else:
capture_exception()
raise RuntimeError("Request to list pull requests failed") from None

for pull_request in pull_requests:
pull_request_author = pull_request["user"]["login"]
Expand All @@ -149,7 +154,11 @@ def credit_if_uncredited(login: str, type: str) -> None:
pull_number=pull_request["number"],
).content
)
except RequestFailed:
except RequestFailed as e:
# If there are no pull request reviews the API
# returns 404. Skip instead of erroring.
if e.response.status_code == 404:
continue
capture_exception()
raise RuntimeError("Request to list pull requests reviews failed") from None

Expand Down