-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathget-pr.py
More file actions
23 lines (17 loc) · 705 Bytes
/
Copy pathget-pr.py
File metadata and controls
23 lines (17 loc) · 705 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
#!/usr/bin/env python3
from github import Github
import csv
import getpass
# using an access token
token = getpass.getpass(prompt="github.com personal access token: ", stream=None)
g = Github(token)
r = raw_input("org/repo: ")
repo = g.get_repo(r)
with open("github-pr-merged.csv", "w") as csvFile:
fieldnames = ['number', 'closed_at', 'url']
writer = csv.DictWriter(csvFile, fieldnames=fieldnames)
writer.writeheader()
# https://pygithub.readthedocs.io/en/latest/github_objects/PullRequest.html
pulls = repo.get_pulls(state='closed', sort='created', base='master')
for pr in pulls:
writer.writerow({'number' : pr.number, 'closed_at' : pr.closed_at, "url" : pr.url})