Skip to content

Commit 0799a5d

Browse files
Merge pull request #4772 from linuxfoundation/unicron-fix-missing-enqueued-pr-event-handling-2
Followup
2 parents 3771ab2 + f66a283 commit 0799a5d

File tree

1 file changed

+16
-4
lines changed

1 file changed

+16
-4
lines changed

cla-backend/cla/models/github_models.py

Lines changed: 16 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -466,10 +466,22 @@ def process_enqueued_pull_request(self, data):
466466
:param data: The data returned from GitHub on this webhook.
467467
:type data: dict
468468
"""
469-
pull_request_id = data["pull_request"]["number"]
470-
github_repository_id = data["repository"]["id"]
471-
installation_id = data["installation"]["id"]
472-
self.update_change_request(installation_id, github_repository_id, pull_request_id)
469+
merge_group_sha = data.get("pull_request", {}).get("merge_commit_sha")
470+
github_repository_id = data.get("repository", {}).get("id")
471+
installation_id = data.get("installation", {}).get("id")
472+
pull_request_id = data.get("pull_request", {}).get("number")
473+
if None in (installation_id, github_repository_id, merge_group_sha, pull_request_id):
474+
cla.log.warning(
475+
"process_enqueued_pull_request: Missing required field(s): "
476+
f"installation_id={installation_id}, "
477+
f"github_repository_id={github_repository_id}, "
478+
f"merge_group_sha={merge_group_sha}, "
479+
f"pull_request_id={pull_request_id}. "
480+
"Aborting update_merge_group."
481+
)
482+
return
483+
484+
self.update_merge_group(installation_id, github_repository_id, merge_group_sha, pull_request_id)
473485

474486
def process_checks_requested_merge_group(self, data):
475487
"""

0 commit comments

Comments
 (0)