ansible/roles/github2fedmsg/files/11776.patch
Michal Konecny 3dc3ca88ae [github2fedmsg] Fix for KeyError
Should fix the issue in https://pagure.io/fedora-infrastructure/issue/11776

Signed-off-by: Michal Konecny <mkonecny@redhat.com>
2024-02-20 11:34:59 +00:00

26 lines
1.2 KiB
Diff

diff --git a/github2fedmsg/views/webhooks.py b/github2fedmsg/views/webhooks.py
index be6b707..0637143 100644
--- a/github2fedmsg/views/webhooks.py
+++ b/github2fedmsg/views/webhooks.py
@@ -167,10 +167,19 @@ def build_fas_lookup(payload):
usernames = set()
# Trawl through every possible corner we can to find github usernames
+ # Fix for https://pagure.io/fedora-infrastructure/issue/11776
if 'commits' in payload:
for commit in payload['commits']:
- usernames.add(commit['committer']['username'])
- usernames.add(commit['author']['username'])
+ if 'committer' in commit:
+ if 'username' in commit['committer']:
+ usernames.add(commit['committer']['username'])
+ elif 'name' in commit['committer']:
+ usernames.add(commit['committer']['name'])
+ if 'author' in commit:
+ if 'username' in commit['author']:
+ usernames.add(commit['author']['username'])
+ elif 'name' in commit['author']:
+ usernames.add(commit['author']['name'])
if 'pusher' in payload:
usernames.add(payload['pusher']['name'])