feat: add logging

This commit is contained in:
Florian Bezannier
2023-01-02 23:33:51 +01:00
committed by Florian BEZANNIER
parent 9e05cc8f1f
commit d8050f6c36
+5 -1
View File
@@ -8,7 +8,11 @@ logger = logging.getLogger(__name__)
def get_github_sha_from_file(user, repo, directory, filename):
res = requests.get("https://api.github.com/repos/{}/{}/git/trees/main:{}".format(user, repo, directory)).json()
file_info = next((file for file in res["tree"] if file['path'] == filename))
try:
file_info = next((file for file in res["tree"] if file['path'] == filename))
except KeyError as e:
logger.error("can't get github file: %s", res)
raise e
return file_info["sha"]