Created
July 31, 2011 19:54
-
-
Save visnup/1117145 to your computer and use it in GitHub Desktop.
hacky script to import pivotal tracker csv into github issues
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
#!/usr/bin/env ruby | |
require 'rubygems' | |
require 'FasterCSV' | |
require 'httparty' | |
require 'json' | |
class GitHub | |
include HTTParty | |
base_uri 'https://api.github.com' | |
basic_auth user, password | |
end | |
FasterCSV.open ARGV.shift, :headers => true do |csv| | |
csv.each do |r| | |
# POST /repos/nko2/website/issues | |
# title, body, assignee, milestone, labels | |
body = { | |
:title => r['Story'], | |
:body => r['Description'], | |
} | |
body[:labels] = [ r['Labels'] ] if r['Labels'] != '' | |
issue = GitHub.post '/repos/nko2/website/issues', :body => JSON.generate(body) | |
p issue | |
r.each do |f| | |
if f[0] == 'Note' | |
next unless f[1] | |
# POST /repos/nko2/website/issues/:id/comments | |
body = { :body => f[1] } | |
GitHub.post "/repos/nko2/website/issues/#{issue.parsed_response['number']}/comments", :body => JSON.generate(body) | |
end | |
end | |
end | |
end |
of course, adjust accordingly to your repo and username/password. :P
i made some hacky patches https://gist.github.com/2257596
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
dude - awesome