gitlab-triage 1.22.0 → 1.23.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 +4 -4
- data/README.md +29 -0
- data/lib/gitlab/triage/engine.rb +13 -0
- data/lib/gitlab/triage/resource/issue.rb +16 -0
- data/lib/gitlab/triage/resource/shared/issuable.rb +4 -0
- data/lib/gitlab/triage/version.rb +1 -1
- 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: f64813b8d681fea2e5b23b4e53682089f4642a38037019658a3798456d219a77
|
4
|
+
data.tar.gz: 626bfa2d49c630ddab0f28c032b7665a96f07a65faa9b20da3812c538f3fcb42
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 5114d8ccdeccf7da91c2326f0b25c8ab3fe2c478ac4a90051f0757b545a90fc7087b16f573eae22e6ca85f0c3e9ded9e3e8d9299f8aad806325edee83b72753b
|
7
|
+
data.tar.gz: e03e119075fb170f5cfd424b6ec07c6739efc0975c928aeeea04c60cb01e2e89e0f596b1a84cd0d446073d0d20bcb6c9cc9bad7c65f590fd1ec9c15093b9556b
|
data/README.md
CHANGED
@@ -153,6 +153,7 @@ Used to declare a condition that must be satisfied by a resource before actions
|
|
153
153
|
Available condition types:
|
154
154
|
- [`date` condition](#date-condition)
|
155
155
|
- [`milestone` condition](#milestone-condition)
|
156
|
+
- [`iteration` condition](#iteration-condition)
|
156
157
|
- [`state` condition](#state-condition)
|
157
158
|
- [`upvotes` condition](#upvotes-condition)
|
158
159
|
- [`labels` condition](#labels-condition)
|
@@ -209,6 +210,25 @@ conditions:
|
|
209
210
|
milestone: v1
|
210
211
|
```
|
211
212
|
|
213
|
+
##### Iteration condition
|
214
|
+
|
215
|
+
Accepts the name of an iteration to filter upon. Also accepts the following
|
216
|
+
timebox values:
|
217
|
+
|
218
|
+
- `none`
|
219
|
+
- `any`
|
220
|
+
|
221
|
+
See the [`iteration_id` API field documentation](https://docs.gitlab.com/ee/api/issues.html) for their meaning.
|
222
|
+
|
223
|
+
Example:
|
224
|
+
|
225
|
+
```yml
|
226
|
+
conditions:
|
227
|
+
iteration: none
|
228
|
+
```
|
229
|
+
|
230
|
+
> **Note:** This query is not supported using GraphQL yet.
|
231
|
+
|
212
232
|
##### State condition
|
213
233
|
|
214
234
|
Accepts a string.
|
@@ -1060,6 +1080,7 @@ Here's a list of currently available Ruby expression API:
|
|
1060
1080
|
| ---- | ---- | ---- |
|
1061
1081
|
| resource | Hash | The hash containing the raw data of the resource. Note that `resource[:type]` is the type of the policy (`issues`, `merge_requests`, or `epics`), not the API `type` field. |
|
1062
1082
|
| author | String | The username of the resource author |
|
1083
|
+
| state | String | The state of the resource |
|
1063
1084
|
| milestone | Milestone | The milestone attached to the resource |
|
1064
1085
|
| labels | [Label] | A list of labels, having only names |
|
1065
1086
|
| labels_with_details | [Label] | A list of labels which has more information loaded from another API request |
|
@@ -1069,6 +1090,14 @@ Here's a list of currently available Ruby expression API:
|
|
1069
1090
|
| project_path | String | The path with namespace to the issues or merge requests project |
|
1070
1091
|
| full_resource_reference | String | A full reference including project path to the issue or merge request |
|
1071
1092
|
|
1093
|
+
##### Methods for `Issue` (issue context)
|
1094
|
+
|
1095
|
+
| Name | Return type | Description |
|
1096
|
+
| ---- | ---- | ---- |
|
1097
|
+
| merge_requests_count | Integer | The number of merge requests related to the issue |
|
1098
|
+
| related_merge_requests | [MergeRequest] | The list of merge requests related to the issue |
|
1099
|
+
| closed_by | [MergeRequest] | The list of merge requests that close the issue |
|
1100
|
+
|
1072
1101
|
##### Methods for `MergeRequest` (merge request context)
|
1073
1102
|
|
1074
1103
|
| Method | Return type | Description |
|
data/lib/gitlab/triage/engine.rb
CHANGED
@@ -38,6 +38,7 @@ module Gitlab
|
|
38
38
|
merge_requests: %w[opened closed merged]
|
39
39
|
}.with_indifferent_access.freeze
|
40
40
|
MILESTONE_TIMEBOX_VALUES = %w[none any upcoming started].freeze
|
41
|
+
ITERATION_SELECTION_VALUES = %w[none any].freeze
|
41
42
|
EpicsTriagingForProjectImpossibleError = Class.new(StandardError)
|
42
43
|
|
43
44
|
def initialize(policies:, options:, network_adapter_class: DEFAULT_NETWORK_ADAPTER, graphql_network_adapter_class: DEFAULT_GRAPHQL_ADAPTER)
|
@@ -436,9 +437,21 @@ module Gitlab
|
|
436
437
|
APIQueryBuilders::SingleQueryParamBuilder.new(*args)
|
437
438
|
end
|
438
439
|
|
440
|
+
def iteration_condition_builder(iteration_value)
|
441
|
+
# Issues API should use the `iteration_id` param for timebox values, and `iteration_title` for iteration title
|
442
|
+
args =
|
443
|
+
if ITERATION_SELECTION_VALUES.include?(iteration_value.downcase)
|
444
|
+
['iteration_id', iteration_value.titleize] # The API only accepts titleized values.
|
445
|
+
else
|
446
|
+
['iteration_title', iteration_value]
|
447
|
+
end
|
448
|
+
APIQueryBuilders::SingleQueryParamBuilder.new(*args)
|
449
|
+
end
|
450
|
+
|
439
451
|
def issues_resource_query(conditions)
|
440
452
|
[].tap do |condition_builders|
|
441
453
|
condition_builders << APIQueryBuilders::SingleQueryParamBuilder.new('weight', conditions[:weight]) if conditions[:weight]
|
454
|
+
condition_builders << iteration_condition_builder(conditions[:iteration]) if conditions[:iteration]
|
442
455
|
end
|
443
456
|
end
|
444
457
|
|
@@ -8,6 +8,22 @@ module Gitlab
|
|
8
8
|
module Resource
|
9
9
|
class Issue < Base
|
10
10
|
include Shared::Issuable
|
11
|
+
|
12
|
+
def merge_requests_count
|
13
|
+
@merge_requests_count ||= resource.dig(:merge_requests_count)
|
14
|
+
end
|
15
|
+
|
16
|
+
def related_merge_requests
|
17
|
+
@related_merge_requests ||= network.query_api_cached(
|
18
|
+
resource_url(sub_resource_type: 'related_merge_requests'))
|
19
|
+
.map { |merge_request| MergeRequest.new(merge_request, parent: self) }
|
20
|
+
end
|
21
|
+
|
22
|
+
def closed_by
|
23
|
+
@closed_by ||= network.query_api_cached(
|
24
|
+
resource_url(sub_resource_type: 'closed_by'))
|
25
|
+
.map { |merge_request| MergeRequest.new(merge_request, parent: self) }
|
26
|
+
end
|
11
27
|
end
|
12
28
|
end
|
13
29
|
end
|
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: 1.
|
4
|
+
version: 1.23.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- GitLab
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2022-
|
11
|
+
date: 2022-02-28 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: activesupport
|