Skip to content

Commit

Permalink
Merge pull request #386 from gitautoai/wes
Browse files Browse the repository at this point in the history
Fix a 404 error in check_user_is_collaborator()
  • Loading branch information
hiroshinishio authored Nov 21, 2024
2 parents ca3ddc9 + 10b8441 commit e063445
Showing 1 changed file with 5 additions and 0 deletions.
5 changes: 5 additions & 0 deletions services/github/user_manager.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,5 +10,10 @@ def check_user_is_collaborator(owner: str, repo: str, user: str, token: str) ->
url = f"{GITHUB_API_URL}/repos/{owner}/{repo}/collaborators/{user}"
headers = create_headers(token=token)
response = requests.get(url=url, headers=headers, timeout=TIMEOUT)

# Return False if 404 (user is not a collaborator)
if response.status_code == 404:
return False

response.raise_for_status()
return response.status_code == 204

0 comments on commit e063445

Please sign in to comment.