README.md in gitlab-triage-0.9.0 vs README.md in gitlab-triage-0.10.0

- old
+ new

@@ -53,10 +53,22 @@ - needs attention mention: - markglenfletcher comment: | {{author}} This issue is unlabelled after 5 days. It needs attention. Please take care of this before the end of #{2.days.from_now.strftime('%Y-%m-%d')} + summarize: + title: Issues require labels + item: | + - [ ] [{{title}}]({{web_url}}) {{labels}} + summary: | + The following issues require labels: + + {{items}} + + Please take care of them before the end of #{7.days.from_now.strftime('%Y-%m-%d')} + + /label ~"needs attention" merge_requests: rules: [] ``` @@ -393,10 +405,11 @@ - [`labels` action](#labels-action) - [`remove_labels` action](#remove-labels-action) - [`status` action](#status-action) - [`mention` action](#mention-action) - [`comment` action](#comment-action) +- [`summarize` action](#summarize-action) ##### Labels action Adds a number of labels to the resource. @@ -480,10 +493,12 @@ - `merged_by`: the user that merged the resource as `@user1` (if applicable) - `milestone`: the resource's current milestone - `labels`: the resource's labels as `~label1, ~label2` - `upvotes`: the resources's upvotes count - `downvotes`: the resources's downvotes count +- `title`: the resource's title +- `web_url`: the web URL pointing to the resource If the resource doesn't respond to the placeholder, or if the field is `nil`, the placeholder is not replaced. Example without placeholders: @@ -497,11 +512,11 @@ Example with placeholders: ```yml actions: comment: | - @{{author}} Are you still interested in finishing this merge request? + {{author}} Are you still interested in finishing this merge request? ``` ###### Ruby expression The comment can also contain Ruby expression, using Ruby's own string @@ -524,9 +539,71 @@ ```yml actions: comment: | If \} comes first and/or following \{, you'll need to escape them. If it's just { wrapping something } then you don't need to, but it's also fine to escape them like \{ this \} if you prefer. ``` + +##### Summarize action + +Generates an issue summarizing what was triaged. + +Accepts a hash of fields. + +| Field | Type | Description | Required | Placeholders | Ruby expression | +| ---- | ---- | ---- | ---- | ---- | ---- | +| `title` | string | The title of the generated issue | yes | no | no | +| `item` | string | Template representing each triaged resource | no | yes | yes | +| `summary` | string | The description of the generated issue | no | Only `{{items}}` and `{{title}}` | yes | + +**Note:**: Both `item` and `summary` fields act like a +[comment action](#comment-action), therefore +[Ruby expression](#ruby-expression) is supported. +Placeholders work regularly for `item`, but for `summary` only +`{{items}}` and `{{title}}` are supported because it's not tied to a +particular resource like the comment action. + +The following placeholders are supported for `summary`: + +- `items`: Concatenated markdown separated by a newline for each `item` +- `title`: The title of the generated issue + +Example: + +```yml +limits: + most_recent: 15 +actions: + summarize: + title: Issues require labels + item: | + - [ ] [{{title}}]({{web_url}}) {{labels}} + summary: | + The following issues require labels: + + {{items}} + + Please take care of them before the end of #{7.days.from_now.strftime('%Y-%m-%d')} + + /label ~"needs attention" +``` + +Which could generate an issue like: + +* Title: + ``` + Issues require labels + ``` +* Description: + ``` markdown + The following issues require labels: + + - [ ] [An example issue](http://example.com/group/project/issues/1) ~"label A", ~"label B" + - [ ] [Another issue](http://example.com/group/project/issues/2) ~"label B", ~"label C" + + Please take care of them before the end of 2000-01-01 + + /label ~"needs attention" + ``` ### Ruby expression API Here's a list of currently available Ruby expression API: