Failure list
This commit is contained in:
@ -67,7 +67,9 @@ def main():
|
||||
break
|
||||
|
||||
pull_path = 'repos/docs/'
|
||||
status_path = 'repos/docs/'
|
||||
pulls = []
|
||||
failed_commits = []
|
||||
|
||||
for repo in repositories:
|
||||
try:
|
||||
@ -76,6 +78,28 @@ def main():
|
||||
if res.json():
|
||||
for pull in res.json():
|
||||
pulls.append(pull)
|
||||
|
||||
for pull in pulls:
|
||||
try:
|
||||
url = args.url + status_path + repo['name'] + '/commits/' + pull['head']['ref'] + '/statuses?limit=1'
|
||||
res_sta = requests.request('GET', url=url, headers=headers)
|
||||
if res_sta.json():
|
||||
if res_sta.json()[0]['status'] == 'failure':
|
||||
# print("Pull Request " + pull['url'] + " has a failed check!")
|
||||
failed_commits.append({
|
||||
'url': pull['url'],
|
||||
'status': res_sta.json()[0]['status'],
|
||||
'target_url': res_sta.json()[0]['target_url'],
|
||||
'created_at': pull['created_at'],
|
||||
'updated_at': res_sta.json()[0]['updated_at']
|
||||
})
|
||||
continue
|
||||
else:
|
||||
continue
|
||||
except Exception as e:
|
||||
print("An error has occured: " + str(e))
|
||||
print("The request status is: " + str(res_sta.status_code) + " | " + str(res_sta.reason))
|
||||
break
|
||||
continue
|
||||
else:
|
||||
continue
|
||||
@ -84,7 +108,12 @@ def main():
|
||||
print("The request status is: " + str(res.status_code) + " | " + str(res.reason))
|
||||
break
|
||||
|
||||
# print(len(pulls))
|
||||
|
||||
print(json.dumps(failed_commits))
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
Reference in New Issue
Block a user