gitlab-triage 0.16.0 → 0.17.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
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 50e7ccde3708d94fd7af8e08648c66c808efc29d65af9ef1daed5b2d93e8d186
|
4
|
+
data.tar.gz: 6d56190f6a55e5458a8a2a0dde2cd6d148c8cadc7b3171323c1f06c3165b38bf
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: e3e8a45c76ec475486acfc23f555b3c71e90086fa0424efc36411de1caa32fee9471a2f2a751eac0a834a0a320e5293582e4b9011d39e09d0e40925ba1f64da1
|
7
|
+
data.tar.gz: ffc308fedc4e4d1f64ab028ef25ec46e4382990d601ff78137cbbc5d613bf3b8b5a299d8a2a31d32e09e9003ff6033eba6f464de0cd0b21d2df1db8b6cbf2a5d
|
data/README.md
CHANGED
@@ -636,6 +636,9 @@ Placeholders work regularly for `item`, but for `summary` only
|
|
636
636
|
`{{title}}`, `{{items}}`, `{{type}}` are supported because it's not tied to a
|
637
637
|
particular resource like the comment action.
|
638
638
|
|
639
|
+
**Note:**: No issues will be created if the specific policy doesn't yield
|
640
|
+
any resources.
|
641
|
+
|
639
642
|
**Note:**: `redact_confidential_resources` defaults to `true`, so fields on
|
640
643
|
confidential resources will be converted to `(confidential)` except for
|
641
644
|
`{{web_url}}`. Setting it to `false` will reveal the confidential fields.
|
@@ -774,6 +777,10 @@ Which could generate an issue like:
|
|
774
777
|
/label ~"needs attention"
|
775
778
|
```
|
776
779
|
|
780
|
+
**Note:**: If a specific policy doesn't yield any resources, it will not generate
|
781
|
+
the corresponding description. If all policies yield no resources, then
|
782
|
+
no issues will be created.
|
783
|
+
|
777
784
|
### Ruby expression API
|
778
785
|
|
779
786
|
Here's a list of currently available Ruby expression API:
|
@@ -6,9 +6,7 @@ module Gitlab
|
|
6
6
|
module Triage
|
7
7
|
module EntityBuilders
|
8
8
|
class IssueBuilder
|
9
|
-
|
10
|
-
|
11
|
-
def initialize(type:, action:, resources:, network:)
|
9
|
+
def initialize(type:, action:, resources:, network:, separator: "\n")
|
12
10
|
@type = type
|
13
11
|
@item_template = action[:item]
|
14
12
|
@title_template = action[:title]
|
@@ -17,6 +15,7 @@ module Gitlab
|
|
17
15
|
action[:redact_confidential_resources] != false
|
18
16
|
@resources = resources
|
19
17
|
@network = network
|
18
|
+
@separator = separator
|
20
19
|
end
|
21
20
|
|
22
21
|
def title
|
@@ -28,7 +27,11 @@ module Gitlab
|
|
28
27
|
end
|
29
28
|
|
30
29
|
def valid?
|
31
|
-
title =~ /\S+/
|
30
|
+
title =~ /\S+/ && any_resources?
|
31
|
+
end
|
32
|
+
|
33
|
+
def any_resources?
|
34
|
+
@resources.any?
|
32
35
|
end
|
33
36
|
|
34
37
|
private
|
@@ -42,11 +45,16 @@ module Gitlab
|
|
42
45
|
end
|
43
46
|
|
44
47
|
def items
|
45
|
-
@items ||= @resources.map(&method(:build_item)).join(
|
48
|
+
@items ||= @resources.map(&method(:build_item)).join(@separator)
|
46
49
|
end
|
47
50
|
|
48
51
|
def build_item(resource)
|
49
|
-
|
52
|
+
case resource
|
53
|
+
when IssueBuilder
|
54
|
+
resource.description
|
55
|
+
else
|
56
|
+
build_text(resource, @item_template)
|
57
|
+
end
|
50
58
|
end
|
51
59
|
|
52
60
|
def build_text(resource, template)
|
@@ -12,19 +12,19 @@ module Gitlab
|
|
12
12
|
def build_issue
|
13
13
|
action = actions[:summarize]
|
14
14
|
|
15
|
+
issues =
|
16
|
+
resources.map do |inner_policy_spec, inner_resources|
|
17
|
+
Policies::RulePolicy.new(
|
18
|
+
type, inner_policy_spec, inner_resources, network)
|
19
|
+
.build_issue
|
20
|
+
end
|
21
|
+
|
15
22
|
EntityBuilders::IssueBuilder.new(
|
16
23
|
type: type,
|
17
24
|
action: action,
|
18
|
-
resources:
|
19
|
-
network: network
|
20
|
-
|
21
|
-
resources.map do |inner_policy_spec, inner_resources|
|
22
|
-
Policies::RulePolicy.new(
|
23
|
-
type, inner_policy_spec, inner_resources, network)
|
24
|
-
.build_issue
|
25
|
-
.description
|
26
|
-
end.join("\n\n")
|
27
|
-
end
|
25
|
+
resources: issues.select(&:any_resources?),
|
26
|
+
network: network,
|
27
|
+
separator: "\n\n")
|
28
28
|
end
|
29
29
|
|
30
30
|
# Due to resources is a different type, this will never work
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: gitlab-triage
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
4
|
+
version: 0.17.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- GitLab
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2019-
|
11
|
+
date: 2019-03-18 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: activesupport
|
@@ -208,7 +208,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
208
208
|
- !ruby/object:Gem::Version
|
209
209
|
version: '0'
|
210
210
|
requirements: []
|
211
|
-
rubygems_version: 3.0.
|
211
|
+
rubygems_version: 3.0.3
|
212
212
|
signing_key:
|
213
213
|
specification_version: 4
|
214
214
|
summary: GitLab triage automation project.
|