-
Notifications
You must be signed in to change notification settings - Fork 2
Expand file tree
/
Copy pathfetch_project_results.py
More file actions
32 lines (25 loc) · 974 Bytes
/
fetch_project_results.py
File metadata and controls
32 lines (25 loc) · 974 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
import json
import requests
with open('.githubtoken') as f:
t = f.read()
project_results = []
res = {'total_count': float('inf')}
page = 1
while len(project_results) < res['total_count']:
res = requests.get('https://api.github.com/repos/alonitac/atech-devops-june-2023/actions/runs',
params={
"page": page,
"status": "success",
"per_page": "100"
},
headers={
"Accept": "application/vnd.github+json",
"Authorization": f"Bearer {t}",
"X-GitHub-Api-Version": "2022-11-28"
})
res = res.json()
page += 1
project_results += res['workflow_runs']
data = [d for d in project_results if d['conclusion'] == 'success']
branches = sorted(set([d['head_branch'] for d in data]))
[print(b) for b in branches]