Skip to content

Commit

Permalink
Try fixing #350
Browse files Browse the repository at this point in the history
!!! This is untested!

This is according to PyGithub/PyGithub#2345 (comment)

Locally I tested that the following works correctly:

```python
In [24]: from github import Github, Auth

In [25]: auth = Auth.Token(token)

In [26]: g = Github(auth=auth)

In [27]: repo = g.get_repo("JuliaRegistries/General")

In [28]: registry_toml = repo.get_contents("Registry.toml")

In [39]: blob = repo.get_git_blob(registry_toml.sha)

In [40]: b64 = base64.b64decode(blob.content)

In [41]: b64.decode("utf8")
```
  • Loading branch information
simeonschaub authored Sep 23, 2024
1 parent 220ae9d commit d5f0679
Showing 1 changed file with 3 additions and 10 deletions.
13 changes: 3 additions & 10 deletions tagbot/action/repo.py
Original file line number Diff line number Diff line change
Expand Up @@ -156,16 +156,9 @@ def _registry_path(self) -> Optional[str]:
registry = toml.load(f)
else:
contents = self._only(self._registry.get_contents("Registry.toml"))
# show file contents if cannot be decoded
try:
string_contents = contents.decoded_content.decode()
except AssertionError:
logger.info(
f"Registry.toml could not be decoded. Raw contents: {contents}"
)
# rethrow now we've logged info
raise

blob = self._registry.get_git_blob(contents.sha)
b64 = b64decode(blob.content)
string_contents = b64.decode("utf8")
registry = toml.loads(string_contents)

if uuid in registry["packages"]:
Expand Down

0 comments on commit d5f0679

Please sign in to comment.