README.md in gitlab-triage-1.24.0 vs README.md in gitlab-triage-1.25.0

- old
+ new

@@ -19,10 +19,11 @@ Triage policies are defined on a resource level basis, resources being: - Epics - Issues - Merge Requests +- Branches Each policy can declare a number of conditions that must all be satisfied before a number of actions are carried out. Summary policies are special policies that join multiple policies together to @@ -40,10 +41,11 @@ Select which resource to add the policy to: - `epics` - `issues` - `merge_requests` +- `branches` And create an array of `rules` to define your policies: For example: @@ -118,10 +120,22 @@ labels: - needs attention comment_type: thread comment: | {{author}} This issue is unlabelled. Please add one or more labels. + branches: + rules: + - name: My branch policy + conditions: + date: + attribute: committed_date + condition: older_than + interval_type: 6 + interval: months + name: ^feature + actions: + delete: true ``` ### Real world example We're enforcing multiple polices with pipeline schedules at [triage-ops]( @@ -164,25 +178,27 @@ - [`draft` condition](#draft-condition) - [`source_branch` condition](#source-branch-condition) - [`target_branch` condition](#target-branch-condition) - [`weight` condition](#weight-condition) - [`discussions` condition](#discussions-condition) +- [`protected` condition](#protected-condition) - [`ruby` condition](#ruby-condition) ##### Date condition Accepts a hash of fields. -| Field | Type | Values | Required | -| --------- | ---- | ---- | -------- | -| `attribute` | string | `created_at`, `updated_at`, `merged_at` | yes | -| `condition` | string | `older_than`, `newer_than` | yes | -| `interval_type` | string | `days`, `weeks`, `months`, `years` | yes | -| `interval` | integer | integer | yes | +| Field | Type | Values | Required | +| --------- | ---- |--------------------------------------------------------------------------| -------- | +| `attribute` | string | `created_at`, `updated_at`, `merged_at`, `authored_date`, `committed_date` | yes | +| `condition` | string | `older_than`, `newer_than` | yes | +| `interval_type` | string | `days`, `weeks`, `months`, `years` | yes | +| `interval` | integer | integer | yes | > **Note:** > - `merged_at` only works on merge requests. > - `closed_at` is not supported in the GitLab API, but can be used in a [`ruby` condition](#ruby-condition). +> - `committed_date` and `authored_date` only works for branches. Example: ```yml conditions: @@ -573,10 +589,17 @@ attribute: threads condition: greater_than threshold: 15 ``` +##### Protected condition + +** This condition is only applicable for branches** + +Accept a boolean. +If not specified, default to `false` to filter out protected branches. + ##### Ruby condition This condition allows users to write a Ruby expression to be evaluated for each resource. If it evaluates to a truthy value, it satisfies the condition. If it evaluates to a falsey value, it does not satisfy the condition. @@ -659,10 +682,12 @@ - [`move` action](#move-action) - [`comment` action](#comment-action) - [`comment_type` action option](#comment-type-action-option) - [`summarize` action](#summarize-action) - [`comment_on_summary` action](#comment-on-summary-action) +- [`issue` action](#create-a-new-issue-from-each-resource) +- [`delete` action](#delete-action) ##### Labels action Adds a number of labels to the resource. @@ -1028,9 +1053,33 @@ The issue {{ full_reference }} needs testing. Please take care of them before the end of #{7.days.from_now.strftime('%Y-%m-%d')} /label ~"needs attention" +``` + +##### Delete action + +**This action is only applicable for branches.** + +Delete the resource. + +Accept a boolean. Set to `true` to enable. + +Example : +```yaml +resource_rules: + branches: + rules: + - name: My branch policy + conditions: + date: + attribute: committed_date + condition: older_than + interval_type: months + interval: 30 + actions: + delete: true ``` ### Summary policies Summary policies are special policies that join multiple rule policies together