Announcements

GitHub issues as CSV with Ruby and HTTParty

Recently we told you about our move to Kanban. To fill the backlog our project manager Nina needed a list of our current GitHub issues, ideally in a spreadsheet format. A couple lines of Ruby produce CSV output consisting of issue title, creation date, reporter and labels, which then can be redirected to a file and opened with any spreadsheet program.

require 'httparty'
 
class GitHubIssues
  include HTTParty
  base_uri 'http://github.com/api/v2/yaml'
 
  def self.show
    # username must be of the form '<username>/token:<token>'
    opts = {:basic_auth => {:username => ''}}
    self.get('/issues/list/<user>/<projects>/open', opts)["issues"].each do |issue|
      puts "#{issue["title"]};#{issue["created_at"]};#{issue["user"]};#{issue["labels"].join(',')}"
    end
  end
end
 
GitHubIssues.show

It’s quick and dirty (e.g. will die if there are no issues), but does exactly what we needed in just a couple of lines thanks to the awesome HTTParty.

Previous Post Next Post

You Might Also Like

No Comments

Leave a Reply