gitlab-triage 1.56.2 → 1.58.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/.gitlab/CODEOWNERS +1 -2
- data/.gitlab/merge_request_templates/Default.md +4 -0
- data/.gitlab-ci.yml +0 -13
- data/.rubocop.yml +5 -0
- data/.rubocop_todo.yml +0 -21
- data/CONTRIBUTING.md +22 -0
- data/Gemfile.lock +39 -26
- data/README.md +86 -26
- data/gitlab-triage.gemspec +4 -7
- data/lib/gitlab/triage/action/comment.rb +13 -9
- data/lib/gitlab/triage/action/delete.rb +3 -2
- data/lib/gitlab/triage/action/issue.rb +1 -1
- data/lib/gitlab/triage/action/summarize.rb +1 -1
- data/lib/gitlab/triage/action/work_item.rb +55 -16
- data/lib/gitlab/triage/action/work_item_comment.rb +39 -0
- data/lib/gitlab/triage/action.rb +10 -6
- data/lib/gitlab/triage/engine.rb +10 -17
- data/lib/gitlab/triage/milestone_wildcards.rb +22 -0
- data/lib/gitlab/triage/network_adapters/base_adapter.rb +17 -0
- data/lib/gitlab/triage/network_adapters/graphql_adapter.rb +1 -19
- data/lib/gitlab/triage/network_adapters/httparty_adapter.rb +11 -10
- data/lib/gitlab/triage/normalizers/work_item_normalizer.rb +12 -0
- data/lib/gitlab/triage/option_parser.rb +4 -4
- data/lib/gitlab/triage/policies/base_policy.rb +1 -1
- data/lib/gitlab/triage/rest_api_network.rb +21 -2
- data/lib/gitlab/triage/sources/work_items_rest_source.rb +64 -20
- data/lib/gitlab/triage/validators/policy_validator.rb +155 -16
- data/lib/gitlab/triage/version.rb +1 -1
- metadata +14 -7
- data/.codeclimate.yml +0 -19
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA256:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: 8a6d5407a6cccbf8711ab5d9e6cfd060165831e32880681257a6d12ed2290df3
|
|
4
|
+
data.tar.gz: 30aca49b70d3c65f56fcb5cd34275d6aad83aea62f54b683d1196af54c8c312a
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: ba6a0e711a7c06f6c99f1af0471d68cd7c335dbfd53d5456f571414e79ce6c9454f6e9df0379ff89fdb57f155f8947cde33ce164ee19766f75c75f89cc8df345
|
|
7
|
+
data.tar.gz: da23490510ce31cf2abb2ece62189c9d464421ef15be0b07a44245fce4619afb0df52216674759a9dd07c2d07a7284b00fde9ef66e252c5e1a9e43fb81635c81
|
data/.gitlab/CODEOWNERS
CHANGED
|
@@ -1,2 +1 @@
|
|
|
1
|
-
|
|
2
|
-
* @gl-quality/eng-prod
|
|
1
|
+
* @gl-dx
|
|
@@ -8,4 +8,8 @@ that reviewers can understand your intent. Keeping the description updated is
|
|
|
8
8
|
especially important if they didn't participate in the discussion.
|
|
9
9
|
-->
|
|
10
10
|
|
|
11
|
+
## Checklist
|
|
12
|
+
|
|
13
|
+
- [ ] User-visible commits have a `Changelog:` trailer (see [CONTRIBUTING.md](https://gitlab.com/gitlab-org/ruby/gems/gitlab-triage/-/blob/master/CONTRIBUTING.md#changelog)).
|
|
14
|
+
|
|
11
15
|
<!-- template sourced from https://gitlab.com/gitlab-org/ruby/gems/gitlab-triage/-/blob/master/.gitlab/merge_request_templates/Default.md -->
|
data/.gitlab-ci.yml
CHANGED
|
@@ -107,7 +107,6 @@ dry-run:custom:
|
|
|
107
107
|
allow_failure: true
|
|
108
108
|
|
|
109
109
|
include:
|
|
110
|
-
- component: gitlab.com/components/code-quality/code-quality@~latest
|
|
111
110
|
- component: gitlab.com/components/sast/sast@~latest
|
|
112
111
|
- component: gitlab.com/components/secret-detection/secret-detection@~latest
|
|
113
112
|
- component: gitlab.com/gitlab-org/components/danger-review/danger-review@~latest
|
|
@@ -119,18 +118,6 @@ include:
|
|
|
119
118
|
- if: '$CI_MERGE_REQUEST_IID'
|
|
120
119
|
- if: '$CI_COMMIT_BRANCH == $CI_DEFAULT_BRANCH'
|
|
121
120
|
|
|
122
|
-
code_quality:
|
|
123
|
-
# We explicitly set dependencies here as the component sets them to []
|
|
124
|
-
# This allows us to get the cache from the setup job that includes the Gemfile.lock
|
|
125
|
-
dependencies: ["setup-test-env"]
|
|
126
|
-
tags:
|
|
127
|
-
- gitlab-org-docker
|
|
128
|
-
# We explicitly override allow_failure here as the component sets it to true
|
|
129
|
-
# Can be moved to a component input after: https://gitlab.com/components/code-quality/-/merge_requests/8
|
|
130
|
-
allow_failure: false
|
|
131
|
-
<<: *ruby-cache
|
|
132
|
-
<<: *component-general-rules
|
|
133
|
-
|
|
134
121
|
semgrep-sast:
|
|
135
122
|
<<: *component-general-rules
|
|
136
123
|
|
data/.rubocop.yml
CHANGED
|
@@ -51,3 +51,8 @@ RSpec/IndexedLet:
|
|
|
51
51
|
# rationale: Maybe we should? For now, let's keep it disabled and revisit at a later point.
|
|
52
52
|
Rails/Output:
|
|
53
53
|
Enabled: false
|
|
54
|
+
|
|
55
|
+
# rationale: gitlab-triage has no database / ActiveRecord models
|
|
56
|
+
# context: https://gitlab.com/gitlab-org/ruby/gems/gitlab-triage/-/work_items/399
|
|
57
|
+
CodeReuse/ActiveRecord:
|
|
58
|
+
Enabled: false
|
data/.rubocop_todo.yml
CHANGED
|
@@ -6,27 +6,6 @@
|
|
|
6
6
|
# Note that changes in the inspected code, or installation of new
|
|
7
7
|
# versions of RuboCop, may require this file to be generated again.
|
|
8
8
|
|
|
9
|
-
# Offense count: 81
|
|
10
|
-
CodeReuse/ActiveRecord:
|
|
11
|
-
Exclude:
|
|
12
|
-
- 'lib/gitlab/triage/action/work_item.rb'
|
|
13
|
-
- 'lib/gitlab/triage/engine.rb'
|
|
14
|
-
- 'lib/gitlab/triage/filters/base_conditions_filter.rb'
|
|
15
|
-
- 'lib/gitlab/triage/filters/member_conditions_filter.rb'
|
|
16
|
-
- 'lib/gitlab/triage/graphql_network.rb'
|
|
17
|
-
- 'lib/gitlab/triage/normalizers/work_item_normalizer.rb'
|
|
18
|
-
- 'lib/gitlab/triage/validators/limiter_validator.rb'
|
|
19
|
-
- 'spec/gitlab/triage/action_spec.rb'
|
|
20
|
-
- 'spec/gitlab/triage/engine_spec.rb'
|
|
21
|
-
- 'spec/gitlab/triage/graphql_network_spec.rb'
|
|
22
|
-
- 'spec/gitlab/triage/network_adapters/graphql_adapter_spec.rb'
|
|
23
|
-
- 'spec/gitlab/triage/policies/rule_policy_spec.rb'
|
|
24
|
-
- 'spec/gitlab/triage/resource/label_spec.rb'
|
|
25
|
-
- 'spec/gitlab/triage/rest_api_network_spec.rb'
|
|
26
|
-
- 'spec/support/shared_examples/issuable_shared_examples.rb'
|
|
27
|
-
- 'spec/support/shared_examples/label_command_shared_examples.rb'
|
|
28
|
-
- 'spec/support/stub_api.rb'
|
|
29
|
-
|
|
30
9
|
# Offense count: 1
|
|
31
10
|
Lint/ToEnumArguments:
|
|
32
11
|
Exclude:
|
data/CONTRIBUTING.md
CHANGED
|
@@ -29,3 +29,25 @@ git checkout my_branch
|
|
|
29
29
|
bundle install --path vendor/bundle
|
|
30
30
|
bundle exec rake spec
|
|
31
31
|
```
|
|
32
|
+
|
|
33
|
+
## Changelog
|
|
34
|
+
|
|
35
|
+
Release notes are generated from `Changelog:` commit trailers using the
|
|
36
|
+
[GitLab changelog API](https://docs.gitlab.com/ee/api/repositories.html#generate-changelog-data).
|
|
37
|
+
The available categories are listed in `.gitlab/changelog_config.yml`:
|
|
38
|
+
`added`, `fixed`, `changed`, `deprecated`, `removed`, `security`,
|
|
39
|
+
`performance`, and `other`.
|
|
40
|
+
|
|
41
|
+
- Add a trailer to every commit with a user-visible change
|
|
42
|
+
- Dependency updates, documentation-only changes, and internal refactors
|
|
43
|
+
don't need one
|
|
44
|
+
- Use `changed` when a change makes previously-loading policies fail
|
|
45
|
+
|
|
46
|
+
```
|
|
47
|
+
Add remove_labels action to the work_items policy type
|
|
48
|
+
|
|
49
|
+
The work_items type only supported labels and assignees, so
|
|
50
|
+
remove_labels was rejected at load time.
|
|
51
|
+
|
|
52
|
+
Changelog: added
|
|
53
|
+
```
|
data/Gemfile.lock
CHANGED
|
@@ -1,31 +1,35 @@
|
|
|
1
1
|
PATH
|
|
2
2
|
remote: .
|
|
3
3
|
specs:
|
|
4
|
-
gitlab-triage (1.
|
|
4
|
+
gitlab-triage (1.58.0)
|
|
5
5
|
activesupport (>= 5.1)
|
|
6
6
|
globalid (~> 1.0, >= 1.0.1)
|
|
7
|
-
graphql (< 2.
|
|
8
|
-
graphql-client (~> 0.
|
|
7
|
+
graphql (>= 2.4.13, < 2.7.0)
|
|
8
|
+
graphql-client (~> 0.23)
|
|
9
9
|
httparty (>= 0.21.0, < 1.0)
|
|
10
10
|
|
|
11
11
|
GEM
|
|
12
12
|
remote: https://rubygems.org/
|
|
13
13
|
specs:
|
|
14
|
-
activesupport (7.1.
|
|
14
|
+
activesupport (7.1.6)
|
|
15
15
|
base64
|
|
16
|
+
benchmark (>= 0.3)
|
|
16
17
|
bigdecimal
|
|
17
18
|
concurrent-ruby (~> 1.0, >= 1.0.2)
|
|
18
19
|
connection_pool (>= 2.2.5)
|
|
19
20
|
drb
|
|
20
21
|
i18n (>= 1.6, < 2)
|
|
22
|
+
logger (>= 1.4.2)
|
|
21
23
|
minitest (>= 5.1)
|
|
22
24
|
mutex_m
|
|
25
|
+
securerandom (>= 0.3)
|
|
23
26
|
tzinfo (~> 2.0)
|
|
24
|
-
addressable (2.
|
|
25
|
-
public_suffix (>= 2.0.2, <
|
|
27
|
+
addressable (2.9.0)
|
|
28
|
+
public_suffix (>= 2.0.2, < 8.0)
|
|
26
29
|
ast (2.4.2)
|
|
27
|
-
base64 (0.
|
|
28
|
-
|
|
30
|
+
base64 (0.3.0)
|
|
31
|
+
benchmark (0.5.0)
|
|
32
|
+
bigdecimal (4.1.3)
|
|
29
33
|
claide (1.1.0)
|
|
30
34
|
claide-plugins (0.9.2)
|
|
31
35
|
cork
|
|
@@ -33,8 +37,8 @@ GEM
|
|
|
33
37
|
open4 (~> 1.3)
|
|
34
38
|
coderay (1.1.3)
|
|
35
39
|
colored2 (3.1.2)
|
|
36
|
-
concurrent-ruby (1.3.
|
|
37
|
-
connection_pool (2.
|
|
40
|
+
concurrent-ruby (1.3.8)
|
|
41
|
+
connection_pool (2.5.5)
|
|
38
42
|
cork (0.3.0)
|
|
39
43
|
colored2 (~> 3.1)
|
|
40
44
|
crack (1.0.0)
|
|
@@ -59,13 +63,16 @@ GEM
|
|
|
59
63
|
gitlab (~> 4.2, >= 4.2.0)
|
|
60
64
|
diff-lcs (1.5.1)
|
|
61
65
|
drb (2.2.3)
|
|
62
|
-
faraday (2.
|
|
63
|
-
faraday-net_http (>= 2.0, < 3.
|
|
66
|
+
faraday (2.14.4)
|
|
67
|
+
faraday-net_http (>= 2.0, < 3.5)
|
|
68
|
+
json
|
|
69
|
+
logger
|
|
64
70
|
faraday-http-cache (2.5.1)
|
|
65
71
|
faraday (>= 0.8)
|
|
66
|
-
faraday-net_http (3.
|
|
67
|
-
net-http
|
|
72
|
+
faraday-net_http (3.4.4)
|
|
73
|
+
net-http (~> 0.5)
|
|
68
74
|
ffi (1.17.0)
|
|
75
|
+
fiber-storage (1.0.0)
|
|
69
76
|
formatador (1.1.0)
|
|
70
77
|
git (1.19.1)
|
|
71
78
|
addressable (~> 2.8)
|
|
@@ -85,9 +92,11 @@ GEM
|
|
|
85
92
|
rubocop-rspec (~> 2.27.1)
|
|
86
93
|
globalid (1.2.1)
|
|
87
94
|
activesupport (>= 6.1)
|
|
88
|
-
graphql (2.
|
|
95
|
+
graphql (2.6.11)
|
|
89
96
|
base64
|
|
90
|
-
|
|
97
|
+
fiber-storage
|
|
98
|
+
logger
|
|
99
|
+
graphql-client (0.26.0)
|
|
91
100
|
activesupport (>= 3.0)
|
|
92
101
|
graphql (>= 1.13.0)
|
|
93
102
|
guard (2.18.1)
|
|
@@ -109,7 +118,7 @@ GEM
|
|
|
109
118
|
csv
|
|
110
119
|
mini_mime (>= 1.0.0)
|
|
111
120
|
multi_xml (>= 0.5.2)
|
|
112
|
-
i18n (1.14.
|
|
121
|
+
i18n (1.14.8)
|
|
113
122
|
concurrent-ruby (~> 1.0)
|
|
114
123
|
json (2.7.2)
|
|
115
124
|
kramdown (2.4.0)
|
|
@@ -121,16 +130,20 @@ GEM
|
|
|
121
130
|
listen (3.9.0)
|
|
122
131
|
rb-fsevent (~> 0.10, >= 0.10.3)
|
|
123
132
|
rb-inotify (~> 0.9, >= 0.9.10)
|
|
133
|
+
logger (1.7.0)
|
|
124
134
|
lumberjack (1.2.10)
|
|
125
135
|
method_source (1.1.0)
|
|
126
136
|
mini_mime (1.1.5)
|
|
127
137
|
minitest (5.26.1)
|
|
128
138
|
multi_xml (0.6.0)
|
|
129
|
-
mutex_m (0.
|
|
139
|
+
mutex_m (0.3.0)
|
|
130
140
|
nap (1.1.0)
|
|
131
141
|
nenv (0.3.0)
|
|
132
|
-
net-http (0.
|
|
133
|
-
|
|
142
|
+
net-http (0.10.0)
|
|
143
|
+
net-protocol (>= 0.3.0)
|
|
144
|
+
uri (>= 0.11.1)
|
|
145
|
+
net-protocol (0.4.0)
|
|
146
|
+
timeout
|
|
134
147
|
no_proxy_fix (0.1.2)
|
|
135
148
|
notiffany (0.1.3)
|
|
136
149
|
nenv (~> 0.1)
|
|
@@ -146,9 +159,9 @@ GEM
|
|
|
146
159
|
pry (0.14.2)
|
|
147
160
|
coderay (~> 1.1)
|
|
148
161
|
method_source (~> 1.0)
|
|
149
|
-
public_suffix (
|
|
162
|
+
public_suffix (6.0.2)
|
|
150
163
|
racc (1.8.0)
|
|
151
|
-
rack (3.
|
|
164
|
+
rack (3.2.7)
|
|
152
165
|
rainbow (3.1.1)
|
|
153
166
|
rake (13.2.1)
|
|
154
167
|
rb-fsevent (0.11.2)
|
|
@@ -156,8 +169,7 @@ GEM
|
|
|
156
169
|
ffi (~> 1.0)
|
|
157
170
|
rchardet (1.8.0)
|
|
158
171
|
regexp_parser (2.9.2)
|
|
159
|
-
rexml (3.
|
|
160
|
-
strscan
|
|
172
|
+
rexml (3.4.4)
|
|
161
173
|
rspec (3.13.0)
|
|
162
174
|
rspec-core (~> 3.13.0)
|
|
163
175
|
rspec-expectations (~> 3.13.0)
|
|
@@ -206,15 +218,16 @@ GEM
|
|
|
206
218
|
sawyer (0.9.2)
|
|
207
219
|
addressable (>= 2.3.5)
|
|
208
220
|
faraday (>= 0.17.3, < 3)
|
|
221
|
+
securerandom (0.3.2)
|
|
209
222
|
shellany (0.0.1)
|
|
210
|
-
strscan (3.1.0)
|
|
211
223
|
terminal-table (3.0.2)
|
|
212
224
|
unicode-display_width (>= 1.1.1, < 3)
|
|
213
225
|
thor (1.3.1)
|
|
226
|
+
timeout (0.6.1)
|
|
214
227
|
tzinfo (2.0.6)
|
|
215
228
|
concurrent-ruby (~> 1.0)
|
|
216
229
|
unicode-display_width (2.5.0)
|
|
217
|
-
uri (
|
|
230
|
+
uri (1.1.2)
|
|
218
231
|
webmock (3.23.1)
|
|
219
232
|
addressable (>= 2.8.0)
|
|
220
233
|
crack (>= 0.3.2)
|
data/README.md
CHANGED
|
@@ -188,38 +188,84 @@ resource_rules:
|
|
|
188
188
|
|
|
189
189
|
#### Supported conditions
|
|
190
190
|
|
|
191
|
+
Sent to the Work Items REST API:
|
|
192
|
+
|
|
191
193
|
- `type` - match work item types by name, including custom types. Maps to the
|
|
192
|
-
`work_item_type_names` filter (case-insensitive, server-side).
|
|
193
|
-
|
|
194
|
+
`work_item_type_names` filter (case-insensitive, server-side). Any work item
|
|
195
|
+
type name is accepted.
|
|
196
|
+
- `state` - `opened` or `closed`, checked at load time.
|
|
194
197
|
- `status` - custom work item status name (for example `In progress`).
|
|
195
198
|
Enterprise Edition only.
|
|
196
199
|
- `labels` / `forbidden_labels` - label names to require or exclude.
|
|
197
200
|
- `assignees` - assignee usernames.
|
|
201
|
+
- `milestone` - one milestone title, or one of `none`, `any`, `upcoming`,
|
|
202
|
+
`started` (case-insensitive). Maps to the `milestone_title` or
|
|
203
|
+
`milestone_wildcard_id` filter. Same shape as the
|
|
204
|
+
[milestone condition](#milestone-condition). A list of more than one
|
|
205
|
+
milestone, or a blank one, is rejected at load time. Quote titles that look
|
|
206
|
+
like numbers (`milestone: '19.10'`): YAML reads an unquoted `19.10` as
|
|
207
|
+
`19.1`, so it is rejected too.
|
|
208
|
+
|
|
209
|
+
`upcoming` and `started` follow GitLab's current milestone logic, so they
|
|
210
|
+
can match different work items than the same values on `issues`. The
|
|
211
|
+
Issues REST API keeps the logic deprecated in GitLab 17.7 to avoid a
|
|
212
|
+
breaking change
|
|
213
|
+
([gitlab-org/gitlab#501294](https://gitlab.com/gitlab-org/gitlab/-/issues/501294)),
|
|
214
|
+
and the Work Items REST API does not:
|
|
215
|
+
|
|
216
|
+
- `upcoming`: on `issues`, the one milestone per project or group with the
|
|
217
|
+
nearest future due date, often the milestone in progress. On
|
|
218
|
+
`work_items`, every milestone that has not started yet.
|
|
219
|
+
- `started`: on `issues`, active milestones that have started, including
|
|
220
|
+
overdue ones. On `work_items`, only those whose due date has not passed.
|
|
221
|
+
|
|
222
|
+
Dry-run a rule that uses `upcoming` or `started` before moving it from
|
|
223
|
+
`issues` to `work_items`.
|
|
198
224
|
- `date` - `created_at` / `updated_at` staleness (same shape as the
|
|
199
|
-
[date condition](#date-condition)).
|
|
225
|
+
[date condition](#date-condition)). `attribute`, `condition`,
|
|
226
|
+
`interval_type`, and `interval` are all required and checked at load time,
|
|
227
|
+
with or without `filter_in_ruby`, and `interval` must be a positive number.
|
|
228
|
+
A missing or unsupported value would otherwise send no date filter, so the
|
|
229
|
+
rule would match every work item, and a misspelled `condition` would select
|
|
230
|
+
the opposite work items.
|
|
231
|
+
|
|
232
|
+
Run in Ruby on the fetched work items:
|
|
233
|
+
|
|
234
|
+
- `author_member` - see [author member condition](#author-member-condition).
|
|
235
|
+
- `assignee_member` - see [assignee member condition](#assignee-member-condition).
|
|
236
|
+
- `ruby` - see [ruby condition](#ruby-condition).
|
|
237
|
+
- `no_additional_labels` - see [no additional labels condition](#no-additional-labels-condition).
|
|
238
|
+
- `work_item_status` - see [work item status condition](#work-item-status-condition).
|
|
239
|
+
|
|
240
|
+
Any other condition key (for example `issue_type`, `weight`, or a misspelled
|
|
241
|
+
key) is rejected at load time, before any resource is fetched, with an error
|
|
242
|
+
listing the supported conditions. Ignoring it instead would make the rule match
|
|
243
|
+
more work items than intended. `votes`, `upvotes`, and `discussions` are not
|
|
244
|
+
supported yet (tracked in
|
|
245
|
+
[gitlab-org/gitlab#630293](https://gitlab.com/gitlab-org/gitlab/-/work_items/630293)).
|
|
200
246
|
|
|
201
247
|
#### Supported actions
|
|
202
248
|
|
|
203
249
|
- `labels` - add labels by name. If any requested label does not exist, the
|
|
204
250
|
automation stops immediately (matching the `labels` action on the `issues`
|
|
205
251
|
type) rather than applying nothing.
|
|
252
|
+
- `remove_labels` - remove labels by name. Like `labels`, a requested label that
|
|
253
|
+
does not exist stops the automation rather than applying a partial change.
|
|
206
254
|
- `assignees` - set assignees by username. If any requested username does not
|
|
207
255
|
exist, the automation stops immediately rather than sending an empty
|
|
208
256
|
assignee set (which would unassign everyone).
|
|
209
|
-
- `comment` -
|
|
210
|
-
|
|
211
|
-
|
|
212
|
-
|
|
213
|
-
|
|
214
|
-
|
|
215
|
-
|
|
257
|
+
- `comment` - post a comment (note) on the work item through the Work Items REST
|
|
258
|
+
API. Supports the same body templating as the `issues` type, along with
|
|
259
|
+
`mention`, `comment_type: thread`, `comment_internal`, and
|
|
260
|
+
`redact_confidential_resources`. The `{{closed_by}}` placeholder needs
|
|
261
|
+
GitLab 19.6 or later. Quick actions in the body are run by the API, but the
|
|
262
|
+
available command set follows the work item type's enabled widgets, so some
|
|
263
|
+
issue-only commands are no-ops on work items.
|
|
216
264
|
|
|
217
265
|
Summaries are also supported (`summarize` and `comment_on_summary`). Any other
|
|
218
|
-
action key (for example `
|
|
219
|
-
|
|
220
|
-
|
|
221
|
-
work items do not support yet - rejecting them up front beats silently doing
|
|
222
|
-
nothing.
|
|
266
|
+
action key (for example `move` or `status`) is rejected at load time with an
|
|
267
|
+
error listing the supported actions, since those actions are not wired for the
|
|
268
|
+
`work_items` type yet - rejecting them up front beats silently doing nothing.
|
|
223
269
|
|
|
224
270
|
Actions require a token with sufficient permissions (Planner or Reporter role
|
|
225
271
|
and above). The update endpoint can return success without persisting a change
|
|
@@ -233,7 +279,15 @@ against; updates and label lookups target each work item's own namespace,
|
|
|
233
279
|
because a group run can return work items living in different sub-projects and
|
|
234
280
|
an iid is only unique within its namespace. Project-scoped resource helpers
|
|
235
281
|
(for example `project_path` in templates) likewise resolve the underlying
|
|
236
|
-
project from the work item's namespace.
|
|
282
|
+
project from the work item's namespace. `full_resource_reference` and the
|
|
283
|
+
`{{full_reference}}` placeholder render the work item's full reference (for
|
|
284
|
+
example `gitlab-org/gitlab#42`), the same as on `issues`. `resource[:health_status]`
|
|
285
|
+
is a string such as `on_track`, `needs_attention`, or `at_risk`, the same as on
|
|
286
|
+
`issues`. It is `nil` when no health status is set, and always `nil` on GitLab
|
|
287
|
+
Community Edition or a namespace without the license for health status. After a
|
|
288
|
+
license downgrade, work items can keep a stored health status that the API no
|
|
289
|
+
longer returns, so a rule such as `resource[:health_status] != 'at_risk'` can
|
|
290
|
+
match work items that are at risk.
|
|
237
291
|
|
|
238
292
|
The `api:` field is not applicable to the `work_items` type, since the type
|
|
239
293
|
already fixes the transport to the Work Items REST API.
|
|
@@ -345,7 +399,7 @@ Accepts the name of a milestone to filter upon. Also accepts the following timeb
|
|
|
345
399
|
- `upcoming`
|
|
346
400
|
- `started`
|
|
347
401
|
|
|
348
|
-
See the [`milestone_id` API field documentation](https://docs.gitlab.com/
|
|
402
|
+
See the [`milestone_id` API field documentation](https://docs.gitlab.com/api/issues/) for their meaning.
|
|
349
403
|
|
|
350
404
|
Example:
|
|
351
405
|
|
|
@@ -362,7 +416,7 @@ timebox values:
|
|
|
362
416
|
- `none`
|
|
363
417
|
- `any`
|
|
364
418
|
|
|
365
|
-
See the [`iteration_id` API field documentation](https://docs.gitlab.com/
|
|
419
|
+
See the [`iteration_id` API field documentation](https://docs.gitlab.com/api/issues/) for their meaning.
|
|
366
420
|
|
|
367
421
|
Example:
|
|
368
422
|
|
|
@@ -427,7 +481,7 @@ conditions:
|
|
|
427
481
|
|
|
428
482
|
###### Predefined special label names
|
|
429
483
|
|
|
430
|
-
Basing on the [issues API](https://docs.gitlab.com/
|
|
484
|
+
Basing on the [issues API](https://docs.gitlab.com/api/issues/), there
|
|
431
485
|
are two special predefined label names we can use here:
|
|
432
486
|
|
|
433
487
|
* `None`: This indicates that no labels were present
|
|
@@ -694,7 +748,7 @@ conditions:
|
|
|
694
748
|
|
|
695
749
|
**This condition is only applicable for issues.**
|
|
696
750
|
|
|
697
|
-
Accepts a string per the [API documentation](https://docs.gitlab.com/
|
|
751
|
+
Accepts a string per the [API documentation](https://docs.gitlab.com/api/issues/#list-all-issues).
|
|
698
752
|
|
|
699
753
|
| State | Type | Value |
|
|
700
754
|
| --------- | ---- | ------ |
|
|
@@ -715,7 +769,7 @@ conditions:
|
|
|
715
769
|
|
|
716
770
|
**This condition is only applicable for issues.**
|
|
717
771
|
|
|
718
|
-
Accepts a string per the [API documentation](https://docs.gitlab.com/
|
|
772
|
+
Accepts a string per the [API documentation](https://docs.gitlab.com/api/issues/#list-all-issues).
|
|
719
773
|
|
|
720
774
|
| State | Type | Value |
|
|
721
775
|
| --------- | ---- | ------ |
|
|
@@ -734,7 +788,7 @@ conditions:
|
|
|
734
788
|
|
|
735
789
|
**This condition is only applicable for issues.**
|
|
736
790
|
|
|
737
|
-
Accepts a string per the [API documentation](https://docs.gitlab.com/
|
|
791
|
+
Accepts a string per the [API documentation](https://docs.gitlab.com/api/issues/#list-all-issues). This condition can only filter by one issue type.
|
|
738
792
|
|
|
739
793
|
| Issue type | Type | Value |
|
|
740
794
|
| --------- | ---- | ------ |
|
|
@@ -1260,7 +1314,7 @@ The following comment types are supported:
|
|
|
1260
1314
|
- `comment` (default): creates a regular comment on the resource
|
|
1261
1315
|
- `thread`: starts a resolvable thread (discussion) on the resource
|
|
1262
1316
|
|
|
1263
|
-
For merge requests, if `comment_type` is set to `thread`, we can also configure that [all threads should be resolved before merging](https://docs.gitlab.com/
|
|
1317
|
+
For merge requests, if `comment_type` is set to `thread`, we can also configure that [all threads should be resolved before merging](https://docs.gitlab.com/user/project/merge_requests/#prevent-merge-unless-all-threads-are-resolved), therefore this comment can prevent it from merging.
|
|
1264
1318
|
|
|
1265
1319
|
Example:
|
|
1266
1320
|
|
|
@@ -1289,14 +1343,14 @@ actions:
|
|
|
1289
1343
|
|
|
1290
1344
|
###### Harnessing Quick Actions
|
|
1291
1345
|
|
|
1292
|
-
[GitLab's quick actions feature](https://docs.gitlab.com/
|
|
1346
|
+
[GitLab's quick actions feature](https://docs.gitlab.com/user/project/quick_actions/) is available in Core.
|
|
1293
1347
|
All of the operations supported by executing a quick action can be carried out via the comment action.
|
|
1294
1348
|
|
|
1295
1349
|
If GitLab triage does not support an operation natively, it may be possible via a quick action in a comment.
|
|
1296
1350
|
|
|
1297
1351
|
For example:
|
|
1298
|
-
- Flagging an issue as [confidential](https://docs.gitlab.com/
|
|
1299
|
-
- [Locking issue discussion](https://docs.gitlab.com/
|
|
1352
|
+
- Flagging an issue as [confidential](https://docs.gitlab.com/user/project/issues/confidential_issues/)
|
|
1353
|
+
- [Locking issue discussion](https://docs.gitlab.com/user/discussions/#prevent-comments-by-locking-the-discussion)
|
|
1300
1354
|
|
|
1301
1355
|
```yml
|
|
1302
1356
|
resource_rules:
|
|
@@ -1524,6 +1578,10 @@ resource_rules:
|
|
|
1524
1578
|
|
|
1525
1579
|
Delete the resource.
|
|
1526
1580
|
|
|
1581
|
+
When GitLab refuses a deletion, for example with 403 because the token may not
|
|
1582
|
+
delete the resource, a warning with the URL, the status and GitLab's message is
|
|
1583
|
+
printed, and the rule goes on with the next resource.
|
|
1584
|
+
|
|
1527
1585
|
Accept a boolean. Set to `true` to enable.
|
|
1528
1586
|
|
|
1529
1587
|
Example :
|
|
@@ -1801,6 +1859,8 @@ Usage: gitlab-triage [options]
|
|
|
1801
1859
|
-H, --host-url [string] A valid host url
|
|
1802
1860
|
-r, --require [string] Require a file before performing
|
|
1803
1861
|
-d, --debug Print debug information
|
|
1862
|
+
--summary Print API call summary at end of execution
|
|
1863
|
+
--quiet Suppress pagination dots and section headers
|
|
1804
1864
|
--cache-dir [string] Directory containing pre-fetched API responses.
|
|
1805
1865
|
Files must follow the naming convention: <source>_<id>_<resource>.json
|
|
1806
1866
|
(e.g. groups_9970_members.json).
|
data/gitlab-triage.gemspec
CHANGED
|
@@ -33,13 +33,10 @@ Gem::Specification.new do |spec|
|
|
|
33
33
|
|
|
34
34
|
spec.add_dependency 'activesupport', '>= 5.1'
|
|
35
35
|
spec.add_dependency 'globalid', '~> 1.0', '>= 1.0.1'
|
|
36
|
-
spec.add_dependency 'graphql-client', '~> 0.
|
|
37
|
-
#
|
|
38
|
-
#
|
|
39
|
-
|
|
40
|
-
# see: https://github.com/github/graphql-client/pull/314
|
|
41
|
-
# We can remove this check once PR 314 is merged and released
|
|
42
|
-
spec.add_dependency 'graphql', '< 2.1.0'
|
|
36
|
+
spec.add_dependency 'graphql-client', '~> 0.23'
|
|
37
|
+
# graphql >= 2.3.5 needs graphql-client >= 0.23 (possible_types keys changed).
|
|
38
|
+
# 2.4.13 is the patched version on the highest affected minor line.
|
|
39
|
+
spec.add_dependency 'graphql', '>= 2.4.13', '< 2.7.0'
|
|
43
40
|
spec.add_dependency 'httparty', '>= 0.21.0', '< 1.0'
|
|
44
41
|
|
|
45
42
|
spec.add_development_dependency 'gitlab-dangerfiles', '~> 2.11.0'
|
|
@@ -61,21 +61,25 @@ module Gitlab
|
|
|
61
61
|
end
|
|
62
62
|
|
|
63
63
|
def perform(resource, comment)
|
|
64
|
-
|
|
65
|
-
if policy.actions.fetch(:redact_confidential_resources, true) && resource[:confidential]
|
|
66
|
-
puts Gitlab::Triage::UI.debug "Comment action resource: (confidential)"
|
|
67
|
-
else
|
|
68
|
-
puts Gitlab::Triage::UI.debug "Comment action resource: #{resource.inspect}"
|
|
69
|
-
end
|
|
70
|
-
|
|
71
|
-
puts Gitlab::Triage::UI.debug "Comment action content: #{comment}"
|
|
72
|
-
end
|
|
64
|
+
print_debug(resource, comment)
|
|
73
65
|
|
|
74
66
|
network.post_api(
|
|
75
67
|
build_post_url(resource),
|
|
76
68
|
post_body(comment))
|
|
77
69
|
end
|
|
78
70
|
|
|
71
|
+
def print_debug(resource, comment)
|
|
72
|
+
return unless network.options.debug
|
|
73
|
+
|
|
74
|
+
if policy.actions.fetch(:redact_confidential_resources, true) && resource[:confidential]
|
|
75
|
+
puts Gitlab::Triage::UI.debug "Comment action resource: (confidential)"
|
|
76
|
+
else
|
|
77
|
+
puts Gitlab::Triage::UI.debug "Comment action resource: #{resource.inspect}"
|
|
78
|
+
end
|
|
79
|
+
|
|
80
|
+
puts Gitlab::Triage::UI.debug "Comment action content: #{comment}"
|
|
81
|
+
end
|
|
82
|
+
|
|
79
83
|
def build_post_url(resource)
|
|
80
84
|
url_builder_opts = {
|
|
81
85
|
network_options: network.options,
|
|
@@ -15,7 +15,7 @@ module Gitlab
|
|
|
15
15
|
private
|
|
16
16
|
|
|
17
17
|
def perform(resource)
|
|
18
|
-
puts "DELETE
|
|
18
|
+
puts "DELETE #{build_delete_url(resource)}"
|
|
19
19
|
end
|
|
20
20
|
end
|
|
21
21
|
|
|
@@ -36,7 +36,8 @@ module Gitlab
|
|
|
36
36
|
def build_delete_url(resource)
|
|
37
37
|
delete_url = UrlBuilders::UrlBuilder.new(
|
|
38
38
|
source: policy.source,
|
|
39
|
-
|
|
39
|
+
# Branches carry no project_id, so they fall back to --source-id.
|
|
40
|
+
source_id: resource[policy.source_id_sym] || network.options.source_id,
|
|
40
41
|
resource_type: policy.type,
|
|
41
42
|
resource_id: resource_id(resource),
|
|
42
43
|
network_options: network.options
|
|
@@ -63,7 +63,7 @@ module Gitlab
|
|
|
63
63
|
|
|
64
64
|
def build_post_url(resource, issue)
|
|
65
65
|
# POST /projects/:id/issues
|
|
66
|
-
# https://docs.gitlab.com/
|
|
66
|
+
# https://docs.gitlab.com/api/issues/#create-an-issue
|
|
67
67
|
post_url = UrlBuilders::UrlBuilder.new(
|
|
68
68
|
network_options: network.options,
|
|
69
69
|
source_id: issue.destination || resource[policy.source_id_sym],
|
|
@@ -79,7 +79,7 @@ module Gitlab
|
|
|
79
79
|
|
|
80
80
|
def post_issue_url
|
|
81
81
|
# POST /projects/:id/issues
|
|
82
|
-
# https://docs.gitlab.com/
|
|
82
|
+
# https://docs.gitlab.com/api/issues/#create-an-issue
|
|
83
83
|
post_url = UrlBuilders::UrlBuilder.new(
|
|
84
84
|
network_options: network.options,
|
|
85
85
|
source_id: destination,
|