]> git.ipfire.org Git - thirdparty/pdns.git/blobdiff - build-scripts/changelog-from-pr.py
Merge pull request #9016 from omoerbeek/random-engine
[thirdparty/pdns.git] / build-scripts / changelog-from-pr.py
index 7ae9584e7a33d1db968a3093c2d18a79b4eca42f..174c0fa686848a58269883f113efdca55ac55dc5 100755 (executable)
@@ -35,7 +35,8 @@ for pr in arguments.pullrequest:
     try:
         if access_token:
             res = requests.get('https://api.github.com/repos/PowerDNS/pdns/pulls/'
-                               '{}?access_token={}'.format(pr, access_token))
+                               '{}'.format(pr),
+                               headers={'Authorization': 'token ' + access_token})
         else:
             res = requests.get('https://api.github.com/repos/PowerDNS/pdns/pulls/'
                                '{}'.format(pr), auth=httpAuth)
@@ -61,20 +62,22 @@ for pr in arguments.pullrequest:
             tickets = re.findall(ticket_regex, body)
             if len(tickets):
                 out += '    :tickets: {}\n'.format(', '.join(tickets))
-        out += '\n    {}'.format(pr_info['title'].capitalize())
+        out += '\n    {}'.format(pr_info['title'][0].capitalize() + pr_info['title'][1:])
 
     if pr_info['user']['login'].lower() not in ['ahupowerdns', 'habbie',
                                                 'pieterlexis', 'rgacogne',
-                                                'aerique', 'chbruyand']:
+                                                'aerique', 'chbruyand',
+                                                'omoerbeek']:
         try:
             if access_token:
-                user_info = requests.get(pr_info['user']['url'] + '?access_token=' + access_token, auth=httpAuth).json()
+                user_info = requests.get(pr_info['user']['url'],
+                                         headers={'Authorization': 'token ' + access_token}).json()
             else:
                 user_info = requests.get(pr_info['user']['url'], auth=httpAuth).json()
         except (requests.exceptions.HTTPError, ValueError) as e:
             print(e)
             sys.exit(1)
-        if 'name'in user_info:
+        if 'name' in user_info:
             out += ' ({})'.format(user_info['name'])
         else:
             out += ' (@{})'.format(user_info['login'])