-
-
Save richbs/5970958 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 = [ | |
'Id', | |
'Story', | |
'Labels', | |
'Story Type', | |
'Estimate', | |
'Current State', | |
'Created At', | |
'Accepted At', | |
'Deadline', | |
'Requested By', | |
'Owned By', | |
'Description', | |
'Note', | |
'Note' | |
] | |
# write pivotals header rows | |
pivotal_csv.writerow(headers) | |
# 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 | |
] | |
pivotal_csv.writerow(story) | |
if __name__ == '__main__': | |
run_csv() |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment