Created
January 29, 2015 18:12
-
-
Save naush/d82189fc872e0a3c60a1 to your computer and use it in GitHub Desktop.
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 'octokit' | |
| require 'csv' | |
| client = Octokit::Client.new(access_token: 'ACCESS_TOKEN') | |
| client.auto_paginate = true | |
| open = client.issues('namely/issues', headers: { 'x-oauth-basic' => 'ACCESS_TOKEN' }) | |
| closed = client.issues('namely/issues', headers: { 'x-oauth-basic' => 'ACCESS_TOKEN' }, state: 'closed') | |
| issues = open + closed | |
| CSV.open("filename.csv", "wb") do |csv| | |
| # Github API Documentation on Issues: https://developer.github.com/v3/issues/ | |
| csv << ['number', 'title', 'user', 'labels', 'state', 'assignee', 'milestone', 'created_at', 'closed_at'] | |
| issues.each do |issue| | |
| hash = issue.to_hash | |
| csv << [ | |
| hash[:number], | |
| hash[:title], | |
| hash[:user][:login], | |
| hash[:labels].collect { |label| label[:name] }.join(' ,'), | |
| (hash[:assignee] || {})[:login] || '', | |
| hash[:milsetone], | |
| hash[:created_at], | |
| hash[:closed_at] | |
| ] | |
| end | |
| end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment