emmby
emmby

Reputation: 100454

How do I export issues from a Google Code project to Github?

I'm trying to move a project from Google Code to Github, and I can't find a way to migrate the issue tickets.

I found https://github.com/arthur-debert/google-code-issues-migrator which appears to be the top hit in a google search for "migrate issues from google code to github", but all I ever get when I attempt to use it is a 404.

It appears that I can export Google Code tickets as CSV, but a) I don't see a way to import CSV into github, and b) it only seems to be the barest data about each ticket.

Is there another way to migrate my issues from Google Code to Github?

Upvotes: 5

Views: 1022

Answers (2)

Brett Zamir
Brett Zamir

Reputation: 14345

As per the issue mentioned in the original post, there has since been a pull request which supposedly fixes the 404 error.

Upvotes: 0

emmby
emmby

Reputation: 100454

I exported my google code issues into CSV (which sadly does not include comments), and then used the following script to import them into github:

#!/usr/bin/env ruby

# Based on https://gist.github.com/visnup/1117145

require 'rubygems'
require 'FasterCSV'
require 'httparty'
require 'json'

github_user = 'xxx'
github_repo = 'xxx'
gcode_repo = 'xxx'

class GitHub
  include HTTParty
  base_uri 'https://api.github.com'
  basic_auth "xxx", "xxx"
end

FasterCSV.open ARGV.shift, :headers => true do |csv|
  csv.each do |r|
    # title, body, assignee, milestone, labels
    body = {
      :title => r['Summary'],
      :body => "Issue Migrated from http://code.google.com/p/#{gcode_repo}/issues/detail?id=#{r['ID']}",
      :labels => [ "gcode"]
    }
    issue = GitHub.post "/repos/#{github_user}/#{github_repo}/issues", :body => JSON.generate(body)
    p issue
  end
end

Replace xxx with the appropriate values for your usage, and make sure you run it on a test repo first.

I then closed all the issues in google code with a comment pointing to the github issue list. Using the advanced tab of the Admin menu in Google code, I replaced the Issues tab with a wiki page that also pointed people to the github issue list.

Upvotes: 3

Related Questions