Skip to content

Commit

Permalink
Merge pull request #352 from gitautoai/wes
Browse files Browse the repository at this point in the history
Fix KeyError: 'owner' in handle_check_run()
  • Loading branch information
hiroshinishio authored Oct 27, 2024
2 parents 4b9d8db + ba74085 commit edba9ff
Showing 1 changed file with 15 additions and 4 deletions.
19 changes: 15 additions & 4 deletions services/check_run_handler.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,11 @@
# Local imports
import json
from config import GITHUB_APP_USER_NAME, STRIPE_PRODUCT_ID_FREE, SUPABASE_URL, SUPABASE_SERVICE_ROLE_KEY
from config import (
GITHUB_APP_USER_NAME,
STRIPE_PRODUCT_ID_FREE,
SUPABASE_URL,
SUPABASE_SERVICE_ROLE_KEY,
)
from services.github.actions_manager import get_workflow_run_logs, get_workflow_run_path
from services.github.github_manager import (
get_installation_access_token,
Expand All @@ -14,6 +19,7 @@
CheckRun,
CheckRunCompletedPayload,
CheckSuite,
Owner,
PullRequest,
Repository,
)
Expand Down Expand Up @@ -43,9 +49,14 @@ def handle_check_run(payload: CheckRunCompletedPayload) -> None:
is_fork: bool = repo.get("fork", False)

# Extract owner related variables
owner_type: str = repo["owner"]["type"]
owner_id: int = repo["owner"]["id"]
owner_name: str = repo["owner"]["login"]
owner: Owner = repo.get("owner", {})
if owner is None:
msg = "Skipping because owner is not found"
print(colorize(text=msg, color="yellow"))
return
owner_type: str = owner["type"]
owner_id: int = owner["id"]
owner_name: str = owner["login"]

# Extract branch related variables
check_suite: CheckSuite = check_run["check_suite"]
Expand Down

0 comments on commit edba9ff

Please sign in to comment.