gitlab-triage 1.21.0 → 1.23.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.gitlab/issue_templates/Default.md +11 -0
- data/.gitlab/merge_request_templates/Default.md +9 -0
- data/Gemfile +1 -1
- data/README.md +29 -0
- data/gitlab-triage.gemspec +1 -1
- data/lib/gitlab/triage/engine.rb +14 -1
- data/lib/gitlab/triage/resource/issue.rb +16 -0
- data/lib/gitlab/triage/resource/shared/issuable.rb +7 -1
- data/lib/gitlab/triage/version.rb +1 -1
- metadata +6 -4
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 34fcebd4ec7d33597bb45cf4a48a9708143972b9d5c836f374f2cc629dc392a8
|
4
|
+
data.tar.gz: 48ed9e443369d98b3681d07bd83d81962a82fc5e5449c6c3198935f46a52e764
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: d32b0e581d1067771b25a1124d591e1e084c10e042a82d20e00ac4d00346e0f386c4c0962477db98d166dab2b0e893d82cbc171f7a5e81c398d2758c6839807d
|
7
|
+
data.tar.gz: 94b2712733c583bab7bc2a4f0c7d92155f9b454a257cd8461cecb1290b4e3aef77d758fadbba1b8720f95585372d2b1c4366ed38481d013f8c19a7ae52d19f44
|
@@ -0,0 +1,11 @@
|
|
1
|
+
Before raising an issue to the GitLab issue tracker, please read through our guide for finding help to determine the best place to post:
|
2
|
+
|
3
|
+
* https://about.gitlab.com/getting-help/
|
4
|
+
|
5
|
+
If you are experiencing an issue when using GitLab.com, your first port of call should be the Community Forum. Your issue may have already been reported there by another user. Please check:
|
6
|
+
|
7
|
+
* https://forum.gitlab.com/
|
8
|
+
|
9
|
+
If you feel that your issue can be categorized as a reproducible bug or a feature proposal, please use one of the issue templates provided and include as much information as possible.
|
10
|
+
|
11
|
+
Thank you for helping to make GitLab a better product.
|
@@ -0,0 +1,9 @@
|
|
1
|
+
## What does this MR do and why?
|
2
|
+
|
3
|
+
_Describe in detail what your merge request does and why._
|
4
|
+
|
5
|
+
<!--
|
6
|
+
Please keep this description updated with any discussion that takes place so
|
7
|
+
that reviewers can understand your intent. Keeping the description updated is
|
8
|
+
especially important if they didn't participate in the discussion.
|
9
|
+
-->
|
data/Gemfile
CHANGED
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/gitlab-triage.gemspec
CHANGED
@@ -28,7 +28,7 @@ Gem::Specification.new do |spec|
|
|
28
28
|
spec.executables = spec.files.grep(%r{^bin/}) { |f| File.basename(f) }
|
29
29
|
spec.require_paths = ['lib']
|
30
30
|
|
31
|
-
spec.add_dependency 'activesupport', '
|
31
|
+
spec.add_dependency 'activesupport', '>= 5.1'
|
32
32
|
spec.add_dependency 'globalid', '~> 0.4'
|
33
33
|
spec.add_dependency 'graphql-client', '~> 0.16'
|
34
34
|
spec.add_dependency 'httparty', '~> 0.17'
|
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)
|
@@ -428,7 +429,7 @@ module Gitlab
|
|
428
429
|
# Issues API should use the `milestone_id` param for timebox values, and `milestone` for milestone title
|
429
430
|
args =
|
430
431
|
if resource_type.to_sym == :issues && MILESTONE_TIMEBOX_VALUES.include?(milestone_value.downcase)
|
431
|
-
['milestone_id', milestone_value.
|
432
|
+
['milestone_id', milestone_value.titleize] # The API only accepts titleized values.
|
432
433
|
else
|
433
434
|
['milestone', milestone_value]
|
434
435
|
end
|
@@ -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
|
@@ -47,6 +47,10 @@ module Gitlab
|
|
47
47
|
@labels_chronologically ||= labels_with_details.sort_by(&:added_at)
|
48
48
|
end
|
49
49
|
|
50
|
+
def state
|
51
|
+
@state ||= resource.dig(:state)
|
52
|
+
end
|
53
|
+
|
50
54
|
def author
|
51
55
|
@author ||= resource.dig(:author, :username)
|
52
56
|
end
|
@@ -65,7 +69,9 @@ module Gitlab
|
|
65
69
|
max_levels: MAX_PARENT_LOOKUP)
|
66
70
|
raise SourceTooDeep if max_levels <= 0
|
67
71
|
|
68
|
-
|
72
|
+
# In projects, the reference to the namespace's parent ID is `namespace.parent_id`
|
73
|
+
# but in groups, the reference is directly in `parent_id`
|
74
|
+
parent_id = resource.dig(:namespace, :parent_id) || resource.dig(:parent_id)
|
69
75
|
|
70
76
|
if parent_id
|
71
77
|
root_id(
|
metadata
CHANGED
@@ -1,27 +1,27 @@
|
|
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.1
|
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-04-27 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: activesupport
|
15
15
|
requirement: !ruby/object:Gem::Requirement
|
16
16
|
requirements:
|
17
|
-
- - "
|
17
|
+
- - ">="
|
18
18
|
- !ruby/object:Gem::Version
|
19
19
|
version: '5.1'
|
20
20
|
type: :runtime
|
21
21
|
prerelease: false
|
22
22
|
version_requirements: !ruby/object:Gem::Requirement
|
23
23
|
requirements:
|
24
|
-
- - "
|
24
|
+
- - ">="
|
25
25
|
- !ruby/object:Gem::Version
|
26
26
|
version: '5.1'
|
27
27
|
- !ruby/object:Gem::Dependency
|
@@ -149,6 +149,8 @@ files:
|
|
149
149
|
- ".gitlab-ci.yml"
|
150
150
|
- ".gitlab/CODEOWNERS"
|
151
151
|
- ".gitlab/changelog_config.yml"
|
152
|
+
- ".gitlab/issue_templates/Default.md"
|
153
|
+
- ".gitlab/merge_request_templates/Default.md"
|
152
154
|
- ".gitlab/merge_request_templates/Release.md"
|
153
155
|
- ".rubocop.yml"
|
154
156
|
- ".ruby-version"
|