use dict.get to make code more rebust

This commit is contained in:
Bram 2024-03-25 03:59:02 +01:00
parent a3788101b8
commit ed6ef63d41

View file

@ -89,7 +89,7 @@ async def github(request):
print(f"Hook type: {hook_type}") print(f"Hook type: {hook_type}")
try: try:
repository = request.json["repository"]["name"] repository = request.json.get("repository", {}).get("name")
# do not notify if the repo is 'apps_translations' # do not notify if the repo is 'apps_translations'
if repository == "apps_translations": if repository == "apps_translations":