Skip to content

Commit 624934b

Browse files
committedDec 21, 2022
CLA: Handle commits with no author information
1 parent d8a2095 commit 624934b

File tree

1 file changed

+6
-4
lines changed

1 file changed

+6
-4
lines changed
 

‎.github/workflows/check-cla.yml

+6-4
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,6 @@ jobs:
1010
run: |
1111
import urllib.request
1212
import json
13-
import itertools
1413
import sys
1514
def jsonRequest(url, data={}):
1615
req = urllib.request.Request(url,
@@ -19,9 +18,12 @@ jobs:
1918
with urllib.request.urlopen(req) as response:
2019
return json.loads(response.read().decode('utf-8'))
2120
prCommits = jsonRequest('https://api.github.com/repos/juce-framework/JUCE/pulls/${{ github.event.number }}/commits')
22-
authors = map(lambda commit: [commit['author']['login'], commit['committer']['login']], prCommits)
23-
uniqueAuthors = [name for name in list(set(itertools.chain.from_iterable(authors))) if name != 'web-flow']
24-
print(f'\nPR authors: {", ".join(uniqueAuthors)}')
21+
allAuthors = [commit[authorType]['login'] for authorType in ['author', 'committer'] for commit in prCommits if commit[authorType]]
22+
uniqueAuthors = [name for name in list(set(allAuthors)) if name != 'web-flow']
23+
if (len(uniqueAuthors) == 0):
24+
print(f'\nNo author or committer user IDs contained within commit information\n\n{prCommits}\n')
25+
sys.exit(1)
26+
print(f'Authors: {uniqueAuthors}')
2527
claResult = jsonRequest('https://cla.juce.com/check', {'logins': uniqueAuthors})
2628
unsignedLogins = claResult['unsigned']
2729
if (len(unsignedLogins) != 0):

0 commit comments

Comments
 (0)
Please sign in to comment.