Created
October 31, 2018 11:15
-
-
Save c80609a/ba8e692d2928cdeeac1b5eed0b3c1257 to your computer and use it in GitHub Desktop.
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 | |
require 'open-uri' | |
require 'json' | |
require 'csv' | |
require 'time' | |
headers = { 'PRIVATE-TOKEN' => ENV['GL_TOKEN'] } | |
issues = Enumerator.new do |result| | |
page = 1 | |
data = open("https://gitlab.key-g.com/api/v4/issues?state=closed&scope=all&project_id=google-autocomplete-proxy&per_page=10&page=#{page}", headers).read | |
_issues = JSON.load(data) | |
while _issues.any? | |
_issues.each { |i| result << i } | |
page += 1 | |
data = open("https://gitlab.key-g.com/api/v4/issues?state=closed&scope=all&project_id=google-autocomplete-proxy&per_page=10&page=#{page}", headers) | |
_issues = JSON.load(data) | |
end | |
end | |
CSV(File.new('./issues.csv', 'wb+')) do |csv| | |
csv << ["title", "assignee.name", "closed_at", 'created_at', 'url'] | |
june = Time.parse('2018-07-01 00:00:00 +0300') | |
issues | |
.to_a | |
.each { |data| puts data.inspect } | |
.each { |data| | |
s = [ | |
data['title'], | |
data['assignees'].map{ |ii| ii['name'] }.join(','), | |
data['created_at'], | |
(data['closed_at'] ? data['closed_at'] : data['updated_at']), | |
data['web_url'] | |
] | |
csv << s | |
} | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment