Skip to content

Commit

Permalink
Allow discovery of commitless repos
Browse files Browse the repository at this point in the history
  • Loading branch information
luandy64 committed Apr 25, 2023
1 parent ad178cd commit efcd42f
Showing 1 changed file with 20 additions and 4 deletions.
24 changes: 20 additions & 4 deletions tap_github/client.py
Original file line number Diff line number Diff line change
Expand Up @@ -229,6 +229,13 @@ def verify_repo_access(self, url_for_repo, repo):
# Throwing user-friendly error message as it checks token access
message = "HTTP-error-code: 404, Error: Please check the repository name \'{}\' or you do not have sufficient permissions to access this repository.".format(repo)
raise NotFoundException(message) from None
except ConflictError as err:
LOGGER.warning("Got error %s", err)
self.authed_get(
"verifying repository access",
'{}/repos/{}'.format(self.base_url, repo),
)
LOGGER.info("Ignoring error because of successful request")

def verify_access_for_repo(self):
"""
Expand Down Expand Up @@ -326,10 +333,19 @@ def get_all_repos(self, organizations: list):
repo_full_name = repo.get('full_name')
LOGGER.info("Verifying access of repository: %s", repo_full_name)

self.verify_repo_access(
'{}/repos/{}/commits'.format(self.base_url,repo_full_name),
repo
)

try:
self.verify_repo_access(
'{}/repos/{}/commits'.format(self.base_url,repo_full_name),
repo
)
except ConflictError as err:
LOGGER.warning("Got error %s", err)
self.verify_repo_access(
'{}/repos/{}'.format(self.base_url,repo_full_name),
repo
)
LOGGER.info("Ignoring error because of successful request")

repos.append(repo_full_name)
except NotFoundException:
Expand Down

0 comments on commit efcd42f

Please sign in to comment.