Created
April 10, 2011 11:59
-
-
Save pk/912280 to your computer and use it in GitHub Desktop.
Exports open issues for one project as CSV.
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 | |
# 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