Created
November 5, 2012 16:09
-
-
Save rodrei/4018021 to your computer and use it in GitHub Desktop.
Github Issues export to Assembla CSV
This file contains hidden or 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
require 'github_api' | |
components = %w{ tag1 tag2 tag3 tag4 } | |
users = { | |
'github-username' => 'new-system-username' | |
} | |
assembla_issues = [] | |
client = Github.new login: 'user', password: 'password' | |
github_issues = client.issues.list_repo 'user', 'repo', per_page: 100 | |
puts "FETCHED #{github_issues.count} issues" | |
github_issues.each do |issue| | |
assembla_issues << { | |
component: (issue.labels.map(&:name) & components).first, | |
summary: issue.title.gsub('"', '\"'), | |
assigned_to: issue.assignee ? (users[issue.assignee.login] || issue.assignee.login) : '', | |
description: issue.body.gsub('"', '\"') | |
} | |
end | |
File.open 'tickets.csv', 'w+' do |file| | |
file << "summary,assigned_to,description,component\n" | |
assembla_issues.each do |issue| | |
file << ["\"#{issue[:summary]}\"", issue[:assigned_to], "\"#{issue[:description]}\"", issue[:component]].join(',') | |
file << "\n" | |
end | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment