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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 9c086304da503565e7523ba4fd203c7dbffd58d9ca46b04eee2c9fc87e98818c
4
- data.tar.gz: 2c2c3913f9a401f4de921977e2945bdc7780bea9df79d3bc02aaf9da557c0ae7
3
+ metadata.gz: 22232c98b56cf47802bd550a4cd785d01ec19c08d4af87d08d99426f4acdc2ae
4
+ data.tar.gz: e5699cd16c9b3507b68a1135a6db5e295b2a8e3fbb659a438dccc8a0320798e1
5
5
  SHA512:
6
- metadata.gz: 0f946629afb02b2508f770abb971af05cd1ff4a4fcc4e92b8c103bd4edae8a9ed50bf8cbdc16b5e5deb1735dac3e6e5388287eac93a8861e7bb28b1040e346f5
7
- data.tar.gz: b4f95a32ac94b35158f4da8de3a6eb94939d78e9e8e80c1d13a05a624f75417d0f02f9fd503dfe4bf9cbb95e8535bb745b94456575e077e5b23e653d2710cd07
6
+ metadata.gz: a4f2dc88efe9d83bbf96548c6ee9212f93318009c7c4f4a63c6e10c49b531328792c3532bcd5917a0dbf39ba001515360e03067c28486ce15756b8114ebfe53b
7
+ data.tar.gz: 5afd46cf2fe3af636c5ab7f136ef8d1aaa0078e6432115e240e0144297a6a035cf7462e2b4a6466a1e3791f8049abb47c2d10616ba3866de443fc4317f5ff0f0
@@ -1,3 +1,3 @@
1
1
  module Reviewer
2
- VERSION = "0.0.3".freeze
2
+ VERSION = "0.0.4".freeze
3
3
  end
@@ -70,18 +70,14 @@ module GitHub
70
70
  reviewRequests(first: 10) {
71
71
  edges {
72
72
  node {
73
- reviewer {
74
- login
75
- }
73
+ id
76
74
  }
77
75
  }
78
76
  }
79
77
  reviews(first: 10) {
80
78
  edges {
81
79
  node {
82
- author {
83
- login
84
- }
80
+ id
85
81
  }
86
82
  }
87
83
  }
@@ -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
- current = current_reviewers
9
+ current_count = current_reviewers_count
10
10
 
11
11
  # Check if we already have enough reviewers
12
- return if current.count >= max_reviewers
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 - current.count))
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 current_reviewers
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.3
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-05-29 00:00:00.000000000 Z
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