Skip to content

Instantly share code, notes, and snippets.

@kobakou
Created June 23, 2018 07:44
Show Gist options
  • Save kobakou/e54fc08464cdb874697bcc292187c262 to your computer and use it in GitHub Desktop.
Save kobakou/e54fc08464cdb874697bcc292187c262 to your computer and use it in GitHub Desktop.
get-issues-from-github-repo
from github import Github
import pandas as pd
# or using an access token
g = Github("")
for _repo in g.get_organization('your-org').get_repos(type='private'):
if _repo.name == 'your-repo':
repo = _repo
break
issueslist = []
for _issue in repo.get_issues(state=('open')):
#print('{:<4}\t{}\t{}\t{}\t{}'.format(_issue.number, _issue.title, _issue.labels, _issue.created_at, _issue.closed_at))
issueslist.append([_issue.number, _issue.title, _issue.labels, _issue.created_at, _issue.closed_at])
for _issue in repo.get_issues(state=('closed')):
#print('{:<4}\t{}\t{}\t{}\t{}'.format(_issue.number, _issue.title, _issue.labels, _issue.created_at, _issue.closed_at))
issueslist.append([_issue.number, _issue.title, _issue.labels, _issue.created_at, _issue.closed_at])
issuedf = pd.DataFrame(issueslist, columns=['id','title','labels','create_at','closed_at'])
issuedf.to_csv('issues.tsv', sep='\t', index=False)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment