-
Notifications
You must be signed in to change notification settings - Fork 3
Expand file tree
/
Copy pathgenerate-voters.py
More file actions
executable file
·32 lines (26 loc) · 970 Bytes
/
generate-voters.py
File metadata and controls
executable file
·32 lines (26 loc) · 970 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
32
#!/usr/bin/env python3
import subprocess
import json
import sys
def QueryGroup(group):
ghCommand = ['gh', 'api', '-H', 'Accept: application/vnd.github+json',
'-H', 'X-GitHub-Api-Version: 2022-11-28', '--paginate',
'/orgs/llvm/teams/%s/members' % group]
status = subprocess.check_output(ghCommand)
committers = json.loads(status)
return committers
def QueryCommitters():
return QueryGroup('llvm-committers')
def QueryTriagers():
return QueryGroup('llvm-triagers')
def main():
committers = [committer['login'] for committer in QueryCommitters()]
committers.extend([committer['login'] for committer in QueryTriagers() if committer not in committers])
print('%d committers identified' % len(committers))
if len(sys.argv) > 1:
with open(sys.argv[1], 'w') as file:
file.write('eligible_voters:\n')
for committer in committers:
file.write(' - %s\n' % committer)
if __name__ == '__main__':
main()