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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 51a92e16690b0c2f5453cc6a63f69afc72664c457e66be02a4c0ea976ceedddd
4
- data.tar.gz: 36f7c9d84716e73d5f329a98ab06a8e09093b05e77e77dcb9ef8aa0a7cf62a93
3
+ metadata.gz: 8a6d5407a6cccbf8711ab5d9e6cfd060165831e32880681257a6d12ed2290df3
4
+ data.tar.gz: 30aca49b70d3c65f56fcb5cd34275d6aad83aea62f54b683d1196af54c8c312a
5
5
  SHA512:
6
- metadata.gz: e3c94b3fc92a0e66df471d4912f6c97527f1bce6de7b872ee01818fa7eae0bb54defb9ec2c64dcb295997a6d755bd6f9932b4fe2436349c6a6c275ab9e6b9462
7
- data.tar.gz: 119e10a479dbfbcd9f0e51ffc17e65582ffa058129c0077175f843a2e450dcfb03e49c8b8a963f15b3e08c3ecfc40fe77c3dc22c23fb5ef540d3c04925610957
6
+ metadata.gz: ba6a0e711a7c06f6c99f1af0471d68cd7c335dbfd53d5456f571414e79ce6c9454f6e9df0379ff89fdb57f155f8947cde33ce164ee19766f75c75f89cc8df345
7
+ data.tar.gz: da23490510ce31cf2abb2ece62189c9d464421ef15be0b07a44245fce4619afb0df52216674759a9dd07c2d07a7284b00fde9ef66e252c5e1a9e43fb81635c81
data/.gitlab/CODEOWNERS CHANGED
@@ -1,2 +1 @@
1
- # The official maintainers
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.56.2)
4
+ gitlab-triage (1.58.0)
5
5
  activesupport (>= 5.1)
6
6
  globalid (~> 1.0, >= 1.0.1)
7
- graphql (< 2.1.0)
8
- graphql-client (~> 0.16)
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.3.4)
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.8.6)
25
- public_suffix (>= 2.0.2, < 6.0)
27
+ addressable (2.9.0)
28
+ public_suffix (>= 2.0.2, < 8.0)
26
29
  ast (2.4.2)
27
- base64 (0.2.0)
28
- bigdecimal (3.1.8)
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.3)
37
- connection_pool (2.4.1)
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.9.1)
63
- faraday-net_http (>= 2.0, < 3.2)
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.1.0)
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.0.31)
95
+ graphql (2.6.11)
89
96
  base64
90
- graphql-client (0.22.0)
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.5)
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.2.0)
139
+ mutex_m (0.3.0)
130
140
  nap (1.1.0)
131
141
  nenv (0.3.0)
132
- net-http (0.4.1)
133
- uri
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 (5.0.5)
162
+ public_suffix (6.0.2)
150
163
  racc (1.8.0)
151
- rack (3.1.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.3.0)
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 (0.13.0)
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
- - `state` - `opened` or `closed`.
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` - **not yet supported.** The Work Items REST API does not yet
210
- provide a note-create endpoint (tracked in
211
- [gitlab-org/gitlab#604028](https://gitlab.com/gitlab-org/gitlab/-/work_items/604028)).
212
- A `comment` action on a `work_items` policy is rejected at load time, before
213
- any resource is fetched or acted on, with a clear error - so an unsupported
214
- policy never runs partway through. Use the `issues` policy type if you need
215
- to comment.
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 `remove_labels`, `mention`, `move`, or `status`) is
219
- rejected at load time with an error listing the supported actions. On the
220
- older policy types these keys are applied through comment quick actions, which
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/ee/api/issues.html) for their meaning.
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/ee/api/issues.html) for their meaning.
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/ee/api/issues.html), there
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/ee/api/issues.html#list-issues).
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/ee/api/issues.html#list-issues).
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/ee/api/issues.html#list-issues). This condition can only filter by one issue type.
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/ee/user/discussions/#only-allow-merge-requests-to-be-merged-if-all-threads-are-resolved), therefore this comment can prevent it from merging.
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/ce/user/project/quick_actions.html) is available in Core.
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/ce/user/project/issues/confidential_issues.html)
1299
- - [Locking issue discussion](https://docs.gitlab.com/ce/user/discussions/#lock-discussions)
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).
@@ -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.16'
37
- # Workaround - pin graphql version
38
- # see: https://github.com/github/graphql-client/issues/310
39
- # see: https://github.com/rmosolgo/graphql-ruby/pull/4577
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
- if network.options.debug
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 resource with type: #{resource[:type]} and id: #{resource_id(resource)}"
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
- source_id: network.options.source_id,
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/ee/api/issues.html#new-issue
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/ee/api/issues.html#new-issue
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,