gitea: Support missing head/base refs.

This commit is contained in:
Alex Vandiver 2023-07-21 09:36:19 -04:00 committed by Tim Abbott
parent f64d5e1db6
commit 74ac8c140c
1 changed files with 4 additions and 2 deletions

View File

@ -31,7 +31,9 @@ def format_pull_request_event(payload: WildValue, include_title: bool = False) -
target_branch = None target_branch = None
base_branch = None base_branch = None
if action != "edited": if action != "edited":
if "head" in payload["pull_request"]:
target_branch = payload["pull_request"]["head"]["ref"].tame(check_string) target_branch = payload["pull_request"]["head"]["ref"].tame(check_string)
if "base" in payload["pull_request"]:
base_branch = payload["pull_request"]["base"]["ref"].tame(check_string) base_branch = payload["pull_request"]["base"]["ref"].tame(check_string)
title = payload["pull_request"]["title"].tame(check_string) if include_title else None title = payload["pull_request"]["title"].tame(check_string) if include_title else None
stringified_assignee = assignee["login"].tame(check_string) if assignee else None stringified_assignee = assignee["login"].tame(check_string) if assignee else None