gitlab-dangerfiles 1.1.0 → 1.1.1
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:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: f5e1069be5416d6980879af3330451834b57881c46101119bfc5917e2057edd7
|
4
|
+
data.tar.gz: e911c514f8d32d65e4aecef6ad111c80c808dd273b12775d57438532ba8a05b3
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: b3814724620240a6485ffce4191fb8a2461c267dda5dad2466b6dc5173fbe848b66cae92aaea69ef82a49dd4726db3a7e77c106fdbd73ea58738eaf4613c4cba
|
7
|
+
data.tar.gz: 0fcabbe03f856d29951ae2f35e9f6f9784fa22af8d8d6bfa13a41452b4a1c35a454135751443882e6a2762325ef05dd6b8bd1b3dde58c5c7661db65ffef4c5d7
|
@@ -2,10 +2,10 @@
|
|
2
2
|
|
3
3
|
require "net/http"
|
4
4
|
require "json"
|
5
|
-
|
6
|
-
require_relative "
|
7
|
-
require_relative "
|
8
|
-
require_relative "
|
5
|
+
|
6
|
+
require_relative "../../gitlab/dangerfiles/changes"
|
7
|
+
require_relative "../../gitlab/dangerfiles/teammate"
|
8
|
+
require_relative "../../gitlab/dangerfiles/title_linting"
|
9
9
|
|
10
10
|
module Danger
|
11
11
|
# Common helper functions for our danger scripts.
|
@@ -99,7 +99,7 @@ module Danger
|
|
99
99
|
return nil unless ci?
|
100
100
|
return nil if defined?(@force_changes_from_git)
|
101
101
|
|
102
|
-
@changes_from_api ||= gitlab_helper.
|
102
|
+
@changes_from_api ||= gitlab_helper.mr_changes.to_h["changes"]
|
103
103
|
rescue
|
104
104
|
# Fallback to the Git strategy in any case
|
105
105
|
@force_changes_from_git = true
|
@@ -229,6 +229,12 @@ module Danger
|
|
229
229
|
gitlab_helper.mr_json["iid"]
|
230
230
|
end
|
231
231
|
|
232
|
+
def mr_author
|
233
|
+
return `whoami`.strip unless ci?
|
234
|
+
|
235
|
+
gitlab_helper.mr_author
|
236
|
+
end
|
237
|
+
|
232
238
|
def mr_title
|
233
239
|
return "" unless ci?
|
234
240
|
|
@@ -247,6 +253,12 @@ module Danger
|
|
247
253
|
gitlab_helper.mr_labels
|
248
254
|
end
|
249
255
|
|
256
|
+
def mr_source_branch
|
257
|
+
return `git rev-parse --abbrev-ref HEAD`.strip unless ci?
|
258
|
+
|
259
|
+
gitlab_helper.mr_json["source_branch"]
|
260
|
+
end
|
261
|
+
|
250
262
|
def mr_target_branch
|
251
263
|
return "" unless ci?
|
252
264
|
|
@@ -1,9 +1,8 @@
|
|
1
1
|
# frozen_string_literal: true
|
2
2
|
|
3
|
-
require_relative "
|
4
|
-
require_relative "
|
5
|
-
require_relative "
|
6
|
-
require_relative "../gitlab/dangerfiles/weightage/reviewers"
|
3
|
+
require_relative "../../gitlab/dangerfiles/teammate"
|
4
|
+
require_relative "../../gitlab/dangerfiles/weightage/maintainers"
|
5
|
+
require_relative "../../gitlab/dangerfiles/weightage/reviewers"
|
7
6
|
|
8
7
|
module Danger
|
9
8
|
# Common helper functions for our danger scripts. See Danger::Helper
|
@@ -19,7 +18,7 @@ module Danger
|
|
19
18
|
Spin = Struct.new(:category, :reviewer, :maintainer, :optional_role, :timezone_experiment)
|
20
19
|
|
21
20
|
def team_mr_author
|
22
|
-
team.find { |person| person.username ==
|
21
|
+
team.find { |person| person.username == helper.mr_author }
|
23
22
|
end
|
24
23
|
|
25
24
|
# Assigns GitLab team members to be reviewer and maintainer
|
@@ -122,21 +121,7 @@ module Danger
|
|
122
121
|
# @param [Teammate] person
|
123
122
|
# @return [Boolean]
|
124
123
|
def mr_author?(person)
|
125
|
-
person.username ==
|
126
|
-
end
|
127
|
-
|
128
|
-
def mr_author_username
|
129
|
-
helper.gitlab_helper&.mr_author || `whoami`
|
130
|
-
end
|
131
|
-
|
132
|
-
def mr_source_branch
|
133
|
-
return `git rev-parse --abbrev-ref HEAD` unless helper.gitlab_helper&.mr_json
|
134
|
-
|
135
|
-
helper.gitlab_helper.mr_json["source_branch"]
|
136
|
-
end
|
137
|
-
|
138
|
-
def mr_labels
|
139
|
-
helper.gitlab_helper&.mr_labels || []
|
124
|
+
person.username == helper.mr_author
|
140
125
|
end
|
141
126
|
|
142
127
|
def new_random(seed)
|
@@ -145,7 +130,7 @@ module Danger
|
|
145
130
|
|
146
131
|
def spin_role_for_category(team, role, project, category)
|
147
132
|
team.select do |member|
|
148
|
-
member.public_send("#{role}?", project, category, mr_labels) # rubocop:disable GitlabSecurity/PublicSend
|
133
|
+
member.public_send("#{role}?", project, category, helper.mr_labels) # rubocop:disable GitlabSecurity/PublicSend
|
149
134
|
end
|
150
135
|
end
|
151
136
|
|
@@ -156,7 +141,7 @@ module Danger
|
|
156
141
|
spin_role_for_category(team, role, project, category)
|
157
142
|
end
|
158
143
|
|
159
|
-
random = new_random(mr_source_branch)
|
144
|
+
random = new_random(helper.mr_source_branch)
|
160
145
|
|
161
146
|
weighted_reviewers = Gitlab::Dangerfiles::Weightage::Reviewers.new(reviewers, traintainers).execute
|
162
147
|
weighted_maintainers = Gitlab::Dangerfiles::Weightage::Maintainers.new(maintainers).execute
|
data/lib/gitlab/dangerfiles.rb
CHANGED
@@ -3,7 +3,7 @@ require "gitlab/dangerfiles/version"
|
|
3
3
|
module Gitlab
|
4
4
|
module Dangerfiles
|
5
5
|
def self.import_plugins(danger)
|
6
|
-
danger.import_plugin(File.expand_path("../danger/*.rb", __dir__))
|
6
|
+
danger.import_plugin(File.expand_path("../danger/plugins/*.rb", __dir__))
|
7
7
|
end
|
8
8
|
end
|
9
9
|
end
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: gitlab-dangerfiles
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.1.
|
4
|
+
version: 1.1.1
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Rémy Coutable
|
8
8
|
autorequire:
|
9
9
|
bindir: exe
|
10
10
|
cert_chain: []
|
11
|
-
date: 2021-
|
11
|
+
date: 2021-04-01 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: danger-gitlab
|
@@ -130,8 +130,8 @@ files:
|
|
130
130
|
- fixtures/emojis/aliases.json
|
131
131
|
- fixtures/emojis/digests.json
|
132
132
|
- gitlab-dangerfiles.gemspec
|
133
|
-
- lib/danger/helper.rb
|
134
|
-
- lib/danger/roulette.rb
|
133
|
+
- lib/danger/plugins/helper.rb
|
134
|
+
- lib/danger/plugins/roulette.rb
|
135
135
|
- lib/gitlab-dangerfiles.rb
|
136
136
|
- lib/gitlab/Dangerfile
|
137
137
|
- lib/gitlab/dangerfiles.rb
|