The JUCE cross-platform C++ framework, with DISTRHO/KXStudio specific changes
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

33 lines
1.6KB

  1. name: check-CLA
  2. on: [pull_request_target]
  3. jobs:
  4. check-cla:
  5. runs-on: ubuntu-latest
  6. env:
  7. PR_NUMBER: ${{ github.event.number }}
  8. steps:
  9. - name: check-CLA
  10. run: |
  11. import urllib.request
  12. import json
  13. import sys
  14. def jsonRequest(url, data={}):
  15. req = urllib.request.Request(url,
  16. headers={'Content-Type': 'application/json'},
  17. data=json.dumps(data).encode('utf-8') if data else None)
  18. with urllib.request.urlopen(req) as response:
  19. return json.loads(response.read().decode('utf-8'))
  20. prCommits = jsonRequest('https://api.github.com/repos/juce-framework/JUCE/pulls/${{ github.event.number }}/commits')
  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}')
  27. claResult = jsonRequest('https://cla.juce.com/check', {'logins': uniqueAuthors})
  28. unsignedLogins = claResult['unsigned']
  29. if (len(unsignedLogins) != 0):
  30. 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')
  31. sys.exit(1)
  32. shell: python