Skip to content

Commit

Permalink
Fix: commit_changes_to_remote_branch encountered an AttributeError: '…
Browse files Browse the repository at this point in the history
…list' object has no attribute 'get'
  • Loading branch information
hiroshinishio committed Jul 8, 2024
1 parent 175b404 commit c5bad1f
Showing 1 changed file with 6 additions and 0 deletions.
6 changes: 6 additions & 0 deletions services/github/github_manager.py
Original file line number Diff line number Diff line change
Expand Up @@ -125,6 +125,12 @@ def commit_changes_to_remote_branch(
print(f"{response.status_code=}\n")
if response.status_code == 200:
file_info: GitHubContentInfo = response.json()

# Return if the file_path is a directory. See Example2 at https://docs.github.com/en/rest/repos/contents?apiVersion=2022-11-28
if file_info["type"] == "dir":
return

# Get the original text and SHA of the file
content: str = file_info.get("content")
# content is base64 encoded by default in GitHub API
original_text: str = base64.b64decode(s=content).decode(
Expand Down

0 comments on commit c5bad1f

Please sign in to comment.