danger-reviewer 0.0.3 → 0.0.4
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/reviewer/gem_version.rb +1 -1
- data/lib/reviewer/github.rb +2 -6
- data/lib/reviewer/plugin.rb +5 -8
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 22232c98b56cf47802bd550a4cd785d01ec19c08d4af87d08d99426f4acdc2ae
|
4
|
+
data.tar.gz: e5699cd16c9b3507b68a1135a6db5e295b2a8e3fbb659a438dccc8a0320798e1
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: a4f2dc88efe9d83bbf96548c6ee9212f93318009c7c4f4a63c6e10c49b531328792c3532bcd5917a0dbf39ba001515360e03067c28486ce15756b8114ebfe53b
|
7
|
+
data.tar.gz: 5afd46cf2fe3af636c5ab7f136ef8d1aaa0078e6432115e240e0144297a6a035cf7462e2b4a6466a1e3791f8049abb47c2d10616ba3866de443fc4317f5ff0f0
|
data/lib/reviewer/gem_version.rb
CHANGED
data/lib/reviewer/github.rb
CHANGED
data/lib/reviewer/plugin.rb
CHANGED
@@ -6,14 +6,14 @@ require_relative './github'
|
|
6
6
|
module Danger
|
7
7
|
class DangerReviewer < Plugin
|
8
8
|
def assign(team, max_reviewers = 2, user_blacklist = [])
|
9
|
-
|
9
|
+
current_count = current_reviewers_count
|
10
10
|
|
11
11
|
# Check if we already have enough reviewers
|
12
|
-
return if
|
12
|
+
return if current_count >= max_reviewers
|
13
13
|
|
14
14
|
authors = find_authors
|
15
15
|
members = team_members(team)
|
16
|
-
reviewers = find_reviewers((authors & members), members, user_blacklist, (max_reviewers -
|
16
|
+
reviewers = find_reviewers((authors & members), members, user_blacklist, (max_reviewers - current_count))
|
17
17
|
|
18
18
|
request_reviews(reviewers)
|
19
19
|
end
|
@@ -69,14 +69,11 @@ module Danger
|
|
69
69
|
reviewers
|
70
70
|
end
|
71
71
|
|
72
|
-
def
|
72
|
+
def current_reviewers_count
|
73
73
|
owner, repo = env.ci_source.repo_slug.split('/')
|
74
74
|
|
75
75
|
result = GitHub::Client.query(GitHub::ReviewerQuery, variables: { repo: repo, owner: owner, number: github.pr_json[:number] })
|
76
|
-
|
77
|
-
result.data.repository.pull_request.review_requests.edges.map { |edge| edge.node.reviewer.login },
|
78
|
-
result.data.repository.pull_request.reviews.edges.map { |edge| edge.node.author.login },
|
79
|
-
].flatten.uniq
|
76
|
+
result.data.repository.pull_request.review_requests.edges.count + result.data.repository.pull_request.reviews.edges.count
|
80
77
|
end
|
81
78
|
|
82
79
|
def team_members(team)
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: danger-reviewer
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.0.
|
4
|
+
version: 0.0.4
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Mikko Kokkonen
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2018-
|
11
|
+
date: 2018-06-11 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: danger-plugin-api
|