gitlab-triage 1.40.0 → 1.41.0

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: cfdea1ee1028eae3c0856a944bf0b1c4c6888868256f0b7cd9db1e8a76be5834
4
- data.tar.gz: e62f0fba823a7cbcee083a8e95041c1adb20f014f82dcd111648f5d5560922cc
3
+ metadata.gz: 3eb3292f79448004c49e7196b24da06e6609f5a0215a985472c95de9aeac4150
4
+ data.tar.gz: f6f94b45be9c7fe6cc43732e3d953455dad93e7246d69ea81162a91f6557a862
5
5
  SHA512:
6
- metadata.gz: a418d3df3aa5db3b89521404bcd77b7a5e4ab40b8b0063e56e11f78e8297ba7e2637ec9ef62ccbce08cf3cde4bfd1e562b043727e7a8442bf2c8e9d45a50c6f3
7
- data.tar.gz: 44fad5107f9ad6ad62519da34fb56ae9518a1f652cbe6ccf6e6fd3d0d07b83e98106bc1235482fff05151deb06507d75d74aa82d9f117b0af72ce3f0763f967e
6
+ metadata.gz: 2b9866966f5f200c25500af8679d2206e413fdd212dba09bbf48ae63d4cb55bf1415b0afded9f308864657f5246fe55cb859769fb2564aa49b4bb0adc946145a
7
+ data.tar.gz: d662bcbe691135305db76078e76d67be3073273ba4c3dd4f39d5a98a649be5ed0ed06c280869549a3bb3e7bceb74942a34aa8312e3a514ebfec835b1f343f5bd
@@ -2,7 +2,7 @@
2
2
  commit from this merge request, and `<NEW_VERSION>` with the upcoming version number. -->
3
3
  ## Diff
4
4
 
5
- https://gitlab.com/gitlab-org/ruby/gems/gitlab-triage/compare/v<PREVIOUS_VERSION>...<COMMIT_UPDATING_VERSION>
5
+ https://gitlab.com/gitlab-org/ruby/gems/gitlab-triage/-/compare/v<PREVIOUS_VERSION>...<COMMIT_UPDATING_VERSION>
6
6
 
7
7
  ## Checklist
8
8
 
data/README.md CHANGED
@@ -631,7 +631,7 @@ conditions:
631
631
 
632
632
  ##### Protected condition
633
633
 
634
- ** This condition is only applicable for branches**
634
+ **This condition is only applicable for branches**
635
635
 
636
636
  Accept a boolean.
637
637
  If not specified, default to `false` to filter out protected branches.
@@ -692,7 +692,7 @@ resources. For example, if the conditions are satisfied by thousands of issues a
692
692
  limit can be configured to process only fifty of them to avoid making an
693
693
  overwhelming number of changes at once.
694
694
 
695
- Accepts a key and value pair where the key is `most_recent` or `oldest`and the
695
+ Accepts a key and value pair where the key is `most_recent` or `oldest` and the
696
696
  value is the number of resources to act on. The following table outlines how
697
697
  each key affects the sorting and order of resources that it limits.
698
698
 
@@ -840,7 +840,8 @@ The following placeholders are supported:
840
840
  - `author`: the username of the resource's author as `@user1`
841
841
  - `assignee`: the username of the resource's assignee as `@user1`
842
842
  - `assignees`: the usernames of the resource's assignees as `@user1, @user2`
843
- - `closed_by`: the user that closed the resource as `@user1` (if applicable)
843
+ - `reviewers`: the usernames ot the resource's reviewers as `@user1, @user2` (if applicable)
844
+ - `closed_by`: the user that closed the resource as `@user1` (if applicable)
844
845
  - `merged_by`: the user that merged the resource as `@user1` (if applicable)
845
846
  - `milestone`: the resource's current milestone
846
847
  - `labels`: the resource's labels as `~label1, ~label2`
@@ -906,6 +907,22 @@ actions:
906
907
  {{author}} Are you still interested in finishing this merge request?
907
908
  ```
908
909
 
910
+ ###### Comment internal action option
911
+
912
+ Determines whether the note is added as an internal comment to the resource.
913
+
914
+ If the option is set to `false` or not set, the comment will not be internal. \
915
+ When it is set to `true`, the comment will be internal.
916
+
917
+ Example:
918
+
919
+ ```yml
920
+ actions:
921
+ comment_internal: true
922
+ comment: |
923
+ This issue has breached SLA, please take a look @team!
924
+ ```
925
+
909
926
  ###### Harnessing Quick Actions
910
927
 
911
928
  [GitLab's quick actions feature](https://docs.gitlab.com/ce/user/project/quick_actions.html) is available in Core.
@@ -1019,21 +1036,24 @@ resource_rules:
1019
1036
 
1020
1037
  Which could generate an issue like:
1021
1038
 
1022
- * Title:
1023
- ```
1024
- Issues require labels
1025
- ```
1026
- * Description:
1027
- ``` markdown
1028
- The following issues require labels:
1039
+ Title:
1040
+
1041
+ ```
1042
+ Issues require labels
1043
+ ```
1044
+
1045
+ Description:
1029
1046
 
1030
- - [ ] [An example issue](http://example.com/group/project/issues/1) ~"label A", ~"label B"
1031
- - [ ] [Another issue](http://example.com/group/project/issues/2) ~"label B", ~"label C"
1047
+ ```markdown
1048
+ The following issues require labels:
1032
1049
 
1033
- Please take care of them before the end of 2000-01-01
1050
+ - [ ] [An example issue](http://example.com/group/project/issues/1) ~"label A", ~"label B"
1051
+ - [ ] [Another issue](http://example.com/group/project/issues/2) ~"label B", ~"label C"
1034
1052
 
1035
- /label ~"needs attention"
1036
- ```
1053
+ Please take care of them before the end of 2000-01-01
1054
+
1055
+ /label ~"needs attention"
1056
+ ```
1037
1057
 
1038
1058
  ##### Comment on summary action
1039
1059
 
@@ -1208,28 +1228,31 @@ resource_rules:
1208
1228
 
1209
1229
  Which could generate an issue like:
1210
1230
 
1211
- * Title:
1212
- ```
1213
- Newest and oldest issues summary
1214
- ```
1215
- * Description:
1216
- ``` markdown
1217
- Please triage the following issues:
1231
+ Title:
1218
1232
 
1219
- Please triage the following new issues:
1233
+ ```
1234
+ Newest and oldest issues summary
1235
+ ```
1236
+
1237
+ Description:
1238
+
1239
+ ```markdown
1240
+ Please triage the following issues:
1220
1241
 
1221
- - [ ] [A new issue](http://example.com/group/project/issues/4)
1222
- - [ ] [Another new issue](http://example.com/group/project/issues/3) ~"label B", ~"label C"
1242
+ Please triage the following new issues:
1223
1243
 
1224
- Please triage the following old issues:
1244
+ - [ ] [A new issue](http://example.com/group/project/issues/4)
1245
+ - [ ] [Another new issue](http://example.com/group/project/issues/3) ~"label B", ~"label C"
1225
1246
 
1226
- - [ ] [An old issue](http://example.com/group/project/issues/1) ~"label A", ~"label B"
1227
- - [ ] [Another old issue](http://example.com/group/project/issues/2) ~"label C"
1247
+ Please triage the following old issues:
1228
1248
 
1229
- Please take care of them before the end of 2000-01-01
1249
+ - [ ] [An old issue](http://example.com/group/project/issues/1) ~"label A", ~"label B"
1250
+ - [ ] [Another old issue](http://example.com/group/project/issues/2) ~"label C"
1230
1251
 
1231
- /label ~"needs attention"
1232
- ```
1252
+ Please take care of them before the end of 2000-01-01
1253
+
1254
+ /label ~"needs attention"
1255
+ ```
1233
1256
 
1234
1257
  > **Note:** If a specific policy doesn't yield any resources, it will not
1235
1258
  > generate the corresponding description. If all policies yield no resources,
@@ -1276,6 +1299,7 @@ Here's a list of currently available Ruby expression API:
1276
1299
  | Method | Return type | Description |
1277
1300
  | ---- | ---- | ---- |
1278
1301
  | first_contribution? | Boolean | `true` if it's the author's first contribution to the project; `false` otherwise. This API requires an additional API request for the merge request, thus would be slower. |
1302
+ | closes_issues | [Issue] | The list of issues that would be closed by merging the provided merge request |
1279
1303
 
1280
1304
  ##### Methods for `Milestone`
1281
1305
 
@@ -63,7 +63,7 @@ module Gitlab
63
63
  def perform(resource, comment)
64
64
  network.post_api(
65
65
  build_post_url(resource),
66
- body: comment)
66
+ post_body(comment))
67
67
  end
68
68
 
69
69
  def build_post_url(resource)
@@ -103,6 +103,13 @@ module Gitlab
103
103
  resource['iid']
104
104
  end
105
105
  end
106
+
107
+ def post_body(comment)
108
+ body = { body: comment }
109
+ body[:internal] = true if policy.actions[:comment_internal]
110
+
111
+ body
112
+ end
106
113
  end
107
114
  end
108
115
  end
@@ -19,6 +19,7 @@ module Gitlab
19
19
  author: "@{{author.username}}",
20
20
  assignee: "@{{assignee.username}}",
21
21
  assignees: "@{{assignees.username}}",
22
+ reviewers: "@{{reviewers.username}}",
22
23
  source_branch: "{{source_branch}}",
23
24
  target_branch: "{{target_branch}}",
24
25
  closed_by: "@{{closed_by.username}}",
@@ -17,6 +17,12 @@ module Gitlab
17
17
  expanded[:first_contribution]
18
18
  end
19
19
  end
20
+
21
+ def closes_issues
22
+ @closes_issues ||= network.query_api_cached(
23
+ resource_url(sub_resource_type: 'closes_issues'))
24
+ .map { |issue| Issue.new(issue, parent: self) }
25
+ end
20
26
  end
21
27
  end
22
28
  end
@@ -46,7 +46,11 @@ module Gitlab
46
46
  when Array
47
47
  resources.concat(results)
48
48
  when Hash
49
- resources << results
49
+ if results['message']&.match?(/404 Group|Project Not Found/)
50
+ raise_unexpected_response(results)
51
+ else
52
+ resources << results
53
+ end
50
54
  else
51
55
  raise_unexpected_response(results)
52
56
  end
@@ -2,6 +2,6 @@
2
2
 
3
3
  module Gitlab
4
4
  module Triage
5
- VERSION = '1.40.0'
5
+ VERSION = '1.41.0'
6
6
  end
7
7
  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.40.0
4
+ version: 1.41.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - GitLab
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2023-03-30 00:00:00.000000000 Z
11
+ date: 2023-08-02 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: activesupport