1
0
Fork 0
mirror of https://github.com/juce-framework/JUCE.git synced 2026-01-09 23:34:20 +00:00

Update the GitHub Issue and PR templates to a new format and add a CLA workflow

This commit is contained in:
Tom Poole 2022-01-20 10:12:52 +00:00
parent bd52350c00
commit bbbb967c63
7 changed files with 172 additions and 23 deletions

30
.github/workflows/check-cla.yml vendored Normal file
View file

@ -0,0 +1,30 @@
name: check-CLA
on: [pull_request_target]
jobs:
check-cla:
runs-on: ubuntu-latest
env:
PR_NUMBER: ${{ github.event.number }}
steps:
- name: check-CLA
run: |
import urllib.request
import json
import itertools
import sys
def jsonRequest(url, data={}):
req = urllib.request.Request(url,
headers={'Content-Type': 'application/json'},
data=json.dumps(data).encode('utf-8') if data else None)
with urllib.request.urlopen(req) as response:
return json.loads(response.read().decode('utf-8'))
prCommits = jsonRequest('https://api.github.com/repos/juce-framework/JUCE/pulls/${{ github.event.number }}/commits')
authors = map(lambda commit: [commit['author']['login'], commit['committer']['login']], prCommits)
uniqueAuthors = list(set(itertools.chain.from_iterable(authors)))
print(f'\nPR authors: {", ".join(uniqueAuthors)}')
claResult = jsonRequest('https://cla.juce.com/check', {'logins': uniqueAuthors})
unsignedLogins = claResult['unsigned']
if (len(unsignedLogins) != 0):
print(f'\nThe following GitHub users need to sign the JUCE CLA: {", ".join(unsignedLogins)}\n\nPlease go to https://cla.juce.com to sign the JUCE Contributor Licence Agreement\n')
sys.exit(1)
shell: python