Skip to content

Commit

Permalink
feat: log when a repo is renamed (#230)
Browse files Browse the repository at this point in the history
  • Loading branch information
ericboucher authored Sep 16, 2023
1 parent ecc495c commit 292bcb3
Showing 1 changed file with 11 additions and 1 deletion.
12 changes: 11 additions & 1 deletion tap_github/repository_streams.py
Original file line number Diff line number Diff line change
Expand Up @@ -120,7 +120,9 @@ def validate_response(self, response: requests.Response) -> None:
if item == "rateLimit":
continue
try:
org, repo = record[item]["nameWithOwner"].split("/")
repo_full_name = "/".join(repo_list[int(item[4:])])
name_with_owner = record[item]["nameWithOwner"]
org, repo = name_with_owner.split("/")
except TypeError:
# one of the repos returned `None`, which means it does
# not exist, log some details, and move on to the next one
Expand All @@ -130,6 +132,14 @@ def validate_response(self, response: requests.Response) -> None:
"Removing it from list"
)
continue
# check if repo has moved or been renamed
if repo_full_name.lower() != name_with_owner.lower():
# the repo name has changed, log some details, and move on.
self.logger.info(
f"Repository name changed: {repo_full_name} \t"
f"New name: {name_with_owner}"
)

repos_with_ids.append(
{"org": org, "repo": repo, "repo_id": record[item]["databaseId"]}
)
Expand Down

0 comments on commit 292bcb3

Please sign in to comment.