github_issue_stats 0.4.0 → 0.8.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +5 -5
- data/bin/github_issue_stats +2 -2
- data/lib/github_issue_stats.rb +11 -11
- metadata +7 -8
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
|
-
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
2
|
+
SHA256:
|
3
|
+
metadata.gz: d25cdfb7662608b213500671a85befa8a145bbb62329193046fc45c86a36bafe
|
4
|
+
data.tar.gz: e6d1bd9974d03410667862a2f7e149f1f624ac6eca137a3c1a17b99db091f0d5
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 149cf84a3bd29c1a4c907b0d52490fd79bb27d6b727bc5ac2b1fe78f40820db0830c814ed8878aa44b5dee552bef9d05d88e3e76508a0cb4a64d5dafb77e0db8
|
7
|
+
data.tar.gz: '03752413094dcf9b997df108d0bf703d02ee76886d57398e9e23f84c860a8de28ebb22a7a209a9434957599d2bd804727eb78aac4565b608b0cdc01b0e4582a8'
|
data/bin/github_issue_stats
CHANGED
@@ -40,7 +40,7 @@ Commander.configure do
|
|
40
40
|
options.intervals = Array(options.intervals)
|
41
41
|
|
42
42
|
raise ArgumentError.new("--token is required") if options.token.nil?
|
43
|
-
raise ArgumentError.new("invalid --token format") unless /\A\h{40}\z/.match(options.token)
|
43
|
+
raise ArgumentError.new("invalid --token format") unless (/\A\h{40}\z/.match(options.token) || /\Agh(p|o|u|s|r)_[A-Za-z0-9]+\z/.match(options.token))
|
44
44
|
raise ArgumentError.new("--scopes is required") if options.scopes.nil?
|
45
45
|
raise ArgumentError.new("invalid --intervals format") if options.intervals.nil?
|
46
46
|
raise ArgumentError.new("invalid --output_format") unless /\A(text)|(markdown)\z/.match(options.output_format)
|
@@ -86,7 +86,7 @@ Commander.configure do
|
|
86
86
|
options.labels = Array(options.labels)
|
87
87
|
|
88
88
|
raise ArgumentError.new("--token is required") if options.token.nil?
|
89
|
-
raise ArgumentError.new("invalid --token format") unless /\A\h{40}\z/.match(options.token)
|
89
|
+
raise ArgumentError.new("invalid --token format") unless (/\A\h{40}\z/.match(options.token) || /\Agh(p|o|u|s|r)_[A-Za-z0-9]+\z/.match(options.token))
|
90
90
|
raise ArgumentError.new("--scopes is required") if options.scopes.nil?
|
91
91
|
raise ArgumentError.new("invalid --interval_length format") unless /\A\d[hdwmy]\z/.match(options.interval_length)
|
92
92
|
raise ArgumentError.new("invalid --interval_count format") if options.interval_count.nil? || options.interval_count < 1
|
data/lib/github_issue_stats.rb
CHANGED
@@ -1,5 +1,5 @@
|
|
1
1
|
require "logger"
|
2
|
-
require "
|
2
|
+
require "octokit"
|
3
3
|
require "time"
|
4
4
|
require "text-table"
|
5
5
|
|
@@ -30,7 +30,7 @@ module Enumerable
|
|
30
30
|
end
|
31
31
|
|
32
32
|
class GitHubIssueStats
|
33
|
-
VERSION = "0.
|
33
|
+
VERSION = "0.8.0"
|
34
34
|
|
35
35
|
attr_accessor :client, # Octokit client for acesing the API
|
36
36
|
:logger, # Logger for writing debugging info
|
@@ -47,7 +47,7 @@ class GitHubIssueStats
|
|
47
47
|
begin
|
48
48
|
@client = Octokit::Client.new(
|
49
49
|
:access_token => token,
|
50
|
-
:auto_paginate =>
|
50
|
+
:auto_paginate => false,
|
51
51
|
:user_agent => "GitHubIssueStats/#{VERSION} (@izuzak) #{Octokit.user_agent}"
|
52
52
|
)
|
53
53
|
|
@@ -197,7 +197,7 @@ class GitHubIssueStats
|
|
197
197
|
STDERR.flush
|
198
198
|
end
|
199
199
|
|
200
|
-
result = @client.search_issues(query_string)
|
200
|
+
result = @client.search_issues(query_string, {:per_page => 1})
|
201
201
|
@logger.debug "Total count: #{result.total_count}"
|
202
202
|
|
203
203
|
if result.incomplete_results
|
@@ -275,15 +275,15 @@ class GitHubIssueStats
|
|
275
275
|
|
276
276
|
rate_limit_data = @client.get("https://api.github.com/rate_limit")
|
277
277
|
|
278
|
-
if rate_limit_data[:resources][:core][:remaining]
|
278
|
+
if rate_limit_data[:resources][:core][:remaining] <= 2
|
279
279
|
reset_timestamp = rate_limit_data[:resources][:core][:reset]
|
280
|
-
sleep_seconds = reset_timestamp - Time.now.to_i
|
281
|
-
@logger.warn "Remaining regular API rate limit is 0, sleeping for #{sleep_seconds} seconds."
|
280
|
+
sleep_seconds = reset_timestamp - Time.now.to_i + 3
|
281
|
+
@logger.warn "Remaining regular API rate limit is close to 0, sleeping for #{sleep_seconds} seconds."
|
282
282
|
sleep(sleep_seconds)
|
283
|
-
|
283
|
+
elsif rate_limit_data[:resources][:search][:remaining] <= 2
|
284
284
|
reset_timestamp = rate_limit_data[:resources][:search][:reset]
|
285
|
-
sleep_seconds = reset_timestamp - Time.now.to_i
|
286
|
-
@logger.warn "Remaining search API rate limit is 0, sleeping for #{sleep_seconds} seconds."
|
285
|
+
sleep_seconds = reset_timestamp - Time.now.to_i + 3
|
286
|
+
@logger.warn "Remaining search API rate limit is close to 0, sleeping for #{sleep_seconds} seconds."
|
287
287
|
sleep(sleep_seconds)
|
288
288
|
elsif
|
289
289
|
sleep(1)
|
@@ -307,7 +307,7 @@ class GitHubIssueStats
|
|
307
307
|
elsif options[:label] == "pulls"
|
308
308
|
query += "is:pr "
|
309
309
|
else
|
310
|
-
query += "label
|
310
|
+
query += "label:\"#{options[:label]}\" "
|
311
311
|
end
|
312
312
|
|
313
313
|
if !options[:state].nil?
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: github_issue_stats
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
4
|
+
version: 0.8.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Ivan Zuzak
|
8
|
-
autorequire:
|
8
|
+
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date:
|
11
|
+
date: 2021-10-01 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: commander
|
@@ -58,7 +58,7 @@ dependencies:
|
|
58
58
|
- - ">="
|
59
59
|
- !ruby/object:Gem::Version
|
60
60
|
version: 1.2.4
|
61
|
-
description:
|
61
|
+
description:
|
62
62
|
email: izuzak@gmail.com
|
63
63
|
executables:
|
64
64
|
- github_issue_stats
|
@@ -71,7 +71,7 @@ homepage: https://github.com/izuzak/github_issue_stats
|
|
71
71
|
licenses:
|
72
72
|
- MIT
|
73
73
|
metadata: {}
|
74
|
-
post_install_message:
|
74
|
+
post_install_message:
|
75
75
|
rdoc_options: []
|
76
76
|
require_paths:
|
77
77
|
- lib
|
@@ -86,9 +86,8 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
86
86
|
- !ruby/object:Gem::Version
|
87
87
|
version: '0'
|
88
88
|
requirements: []
|
89
|
-
|
90
|
-
|
91
|
-
signing_key:
|
89
|
+
rubygems_version: 3.2.15
|
90
|
+
signing_key:
|
92
91
|
specification_version: 4
|
93
92
|
summary: Utility for collecting stats on number of open issues over time in GitHub
|
94
93
|
repositories.
|