Skip to content

Commit 9be2afd

Browse files
committed
Fetch raw github repository config
Rather than fetching base64-encoded json and decoding it ourselves, request the raw text of the config file available in the github repository. This aligns with the approach used in llnl#145.
1 parent 9631cc5 commit 9be2afd

File tree

1 file changed

+2
-12
lines changed

1 file changed

+2
-12
lines changed

src/hubcast/clients/github/client.py

Lines changed: 2 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,3 @@
1-
import base64
21
import logging
32

43
import aiohttp
@@ -10,10 +9,6 @@
109
log = logging.getLogger(__name__)
1110

1211

13-
class InvalidConfigEncodingError(Exception):
14-
pass
15-
16-
1712
class InvalidConfigYAMLError(Exception):
1813
pass
1914

@@ -84,13 +79,8 @@ async def get_repo_config(self):
8479

8580
# get the contents of the repository hubcast.yml file
8681
url = f"/repos/{self.repo_owner}/{self.repo_name}/contents/.github/hubcast.yml"
87-
data = await gh.getitem(url)
88-
89-
# decode returned file
90-
if data["encoding"] == "base64":
91-
config_str = base64.b64decode(data["content"])
92-
else:
93-
raise InvalidConfigEncodingError()
82+
# get raw contents rather than base64 encoded json
83+
config_str = await gh.getitem(url, accept="application/vnd.github.raw+json")
9484

9585
try:
9686
config = yaml.safe_load(config_str)

0 commit comments

Comments
 (0)