Creating empty/placeholder github issues automatically

I'm in the process of migrating WheelCMS's issue tracker from redmine to Github. The issues in redmine are numbered up to about number 800 (shared with many other trackers, there aren't that many WheelCMS issues yet :) and if I start "fresh" in Github, older commit messages will start referring to the new, irrelevant Github issues.

So I need to make sure that, somehow, new Github issues will start at, around, number 800. There's no way to tell Github to start at a certain number so the only option is to create empty (closed) issues.

For 800 issues, this means scripting of course. There are a number of Github API's libraries for Python and after looking at a few (and trying some of them) I've decided to go for "PyGithub".

The code to create the issues looks as follows (really simple actually):

from github import Github

username = "xxx"
password = "yyy"
organization = "wheelcms"
repo = "wheelcms_axle"
limit = 800
milestone = 1

gh = Github(username, password)
authuser = gh.get_user()
nameduser = gh.get_user(username)
organization = gh.get_organization(organization)
repo = organization.get_repo(repo)
milestone = repo.get_milestone(1)

while True:
issue = repo.create_issue("Placeholder issue", "This issue was originally created in an internal tracker and has not been migrated to Github.", milestone=milestone)
if issue.number >= limit:

 In this case the issues are assigned to Milestone "1" which I've created through the web, but you could also do this using the same API of course. If you also want to assign the issues to a user, use the "nameduser" as name argument to create_issue.

Last updated Sept. 14, 2013, 7:16 p.m. | api issue redmine github
comments powered by Disqus