zz-export-pull-requests 0.3.14 → 0.3.15
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/bin/epr +10 -6
- metadata +1 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 471d1c3557b3f0a5494f00d8077a93d21b5ed7132172fdc34e43931e35ad27b6
|
4
|
+
data.tar.gz: f5a3eb11e8bd64a6a2f9f78972dc7bb26fd1acd02810def01b9b5fb59dc29355
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: b897f497835022516754f1ab46e6e006240e0f967a5ca331912076bed9edaf1d1c9fdda5ac88c9dd9eb5ffb680ae42b707057d3e2058f80a4081d47bda253f1c
|
7
|
+
data.tar.gz: 850734a2562ef96506cb397c1cd2f2fd703813a94cd57c567887d29821725ccd1b8607801576ab4a712810fa8e5abff0fc10fb255cc92f14059c10178db35de4
|
data/bin/epr
CHANGED
@@ -10,7 +10,7 @@ require "github_api"
|
|
10
10
|
require "gitlab"
|
11
11
|
require "bitbucket_rest_api"
|
12
12
|
|
13
|
-
VERSION = "0.3.
|
13
|
+
VERSION = "0.3.15"
|
14
14
|
SERVICES = %w[github gitlab bitbucket]
|
15
15
|
GIT_CONFIGS = %w[epr.token github.oauth-token]
|
16
16
|
|
@@ -93,8 +93,6 @@ end
|
|
93
93
|
|
94
94
|
def sleep_if_limit_reached
|
95
95
|
executions = $redis.get("bb-executed").to_i
|
96
|
-
$redisLogger.info("We have called the API for #{executions} times") if ENV['SHOW_LOGS']
|
97
|
-
|
98
96
|
if executions >= BITBUCKET_RATE_LIMIT
|
99
97
|
now = Time.now
|
100
98
|
now_formatted = now.strftime("%I:%M:%S")
|
@@ -109,6 +107,12 @@ def sleep_if_limit_reached
|
|
109
107
|
end
|
110
108
|
end
|
111
109
|
|
110
|
+
def check_api_rate_limit
|
111
|
+
executions = $redis.get("bb-executed").to_i
|
112
|
+
$redisLogger.info("We have called the API for #{executions} times") if ENV['SHOW_LOGS']
|
113
|
+
sleep_if_limit_reached
|
114
|
+
end
|
115
|
+
|
112
116
|
def bitbucket(user, repo)
|
113
117
|
# TODO: make sure no need to translate any states
|
114
118
|
# https://developer.atlassian.com/bitbucket/api/2/reference/resource/repositories/%7Busername%7D/%7Brepo_slug%7D/pullrequests
|
@@ -127,7 +131,7 @@ def bitbucket(user, repo)
|
|
127
131
|
|
128
132
|
loop do
|
129
133
|
page += 1
|
130
|
-
|
134
|
+
check_api_rate_limit
|
131
135
|
|
132
136
|
prs = $bitbucket.repos.pull_request.all(user, repo, :page => page, :state => $filter.upcase)
|
133
137
|
prs["values"].each do |pr|
|
@@ -165,14 +169,14 @@ def bitbucket(user, repo)
|
|
165
169
|
|
166
170
|
loop do
|
167
171
|
pr_page += 1
|
168
|
-
|
172
|
+
check_api_rate_limit
|
169
173
|
prs = $bitbucket.repos.pull_request.all(user, repo, :page => pr_page, :state => $filter.upcase)
|
170
174
|
|
171
175
|
prs["values"].each do |pr|
|
172
176
|
comment_page = 0
|
173
177
|
loop do
|
174
178
|
comment_page += 1
|
175
|
-
|
179
|
+
check_api_rate_limit
|
176
180
|
|
177
181
|
comments = $bitbucket.repos.pull_request.comments(user, repo, pr.id, :page => comment_page)
|
178
182
|
comments["values"].each do |comment|
|