Skip to content

Instantly share code, notes, and snippets.

@pk
Created April 10, 2011 11:59
Show Gist options
  • Save pk/912280 to your computer and use it in GitHub Desktop.
Save pk/912280 to your computer and use it in GitHub Desktop.
Exports open issues for one project as CSV.
#!/usr/bin/env ruby
# Exports open issues for one project as CSV
#
# Usage:
# ./list-issues.rb > my-project-issues.csv
require 'net/http'
require 'json'
require 'csv'
issues = nil
Net::HTTP.start('github.com') {|http|
req = Net::HTTP::Get.new('/api/v2/json/issues/list/your-github-name/your-project/open')
req.basic_auth 'your-github-name/token', 'your-github-token'
response = http.request(req)
issues = JSON.parse(response.body)
}
csv_string = CSV.generate do |csv|
issues['issues'].each do |issue|
csv << [issue['number'], issue['title'], issue['labels'].sort.join(',')]
end
end
puts csv_string
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment