Skip to content

Instantly share code, notes, and snippets.

What would you like to do?
Export your open issues in github to a pivotal tracker friendly csv for import, requires github2 python api-client
import csv
from github2.client import Github
# api settings for github
git_username = 'your_git_username'
git_api_token = 'your_git_api_token'
git_repo = 'username/repo_name'
# import all issues as this story type
pivotal_story_type = 'Bug'
# csv name
csv_name = "open_git_hub_issues.csv"
def run_csv():
Export your open github issues into a csv format for
pivotal tracker import
pivotal_csv = csv.writer(open(csv_name, 'wb'), delimiter=',')
github = Github(username=git_username, api_token=git_api_token)
# pivotals csv headers
headers = [
'Story Type',
'Current State',
'Created At',
'Accepted At',
'Requested By',
'Owned By',
# write pivotals header rows
# get the git issues and write the rows to the csv
git_issues = github.issues.list(git_repo, state="open")
for git_issue in git_issues:
labels = ','.join(git_issue.labels)
# alot of these are blank because they are not really
# needed but if you need them just fill them out
story = [
'', # id
git_issue.title, # story
labels, # labels
pivotal_story_type, # story type
'', # estimate
'', # current stats
git_issue.created_at, # created at
'', # accepted at
'', # deadline
'', # requested by
'', # owned by
git_issue.body, # description
'', # note 1
'', # note 2
if __name__ == '__main__':

This comment has been minimized.

Copy link

@shyam-habarakada shyam-habarakada commented Jun 6, 2013

I put a more recent version of similar functionality here - Let me know if you'd like to be added as a contributor to make any changes.


This comment has been minimized.

Copy link

@mchoimis mchoimis commented Aug 11, 2013

Thanks, @glenbot ! How many issues can I export at one time? Githup api v3 only let me 30 issues at a time....
@shyam-habarakada, but it's in ruby?


This comment has been minimized.

Copy link
Owner Author

@glenbot glenbot commented Apr 14, 2014

For some reason I never got notifications for these comments so sorry about the very late replies. @shyam-habarakada sure that would be nice.

@mchoimis I'm not sure, I think when I wrote this it was on an earlier version of this apt. That said, you can always run it in a generator to request the next "30" until you are done.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment