README.md in gitlab-triage-0.12.0 vs README.md in gitlab-triage-0.13.0

- old
+ new

@@ -18,11 +18,12 @@ Each policy can declare a number of conditions that must all be satisfied before a number of actions are carried out. ### Defining a policy -Policies are defined in a policy file (by default [.triage-policies.yml](.triage-policies.yml)). The format of the file is [YAML](https://en.wikipedia.org/wiki/YAML). +Policies are defined in a policy file (by default `./.triage-policies.yml`). +The format of the file is [YAML](https://en.wikipedia.org/wiki/YAML). > Note: You can use the [`--init`](#usage) option to add an example [`.triage-policies.yml` file](support/.triage-policies.example.yml) to your project Select which resource to add the policy to: - `issues` @@ -187,10 +188,67 @@ conditions: labels: - feature proposal ``` -###### Labels over sequences +###### Labels brace expansion + +We could expand the labels by using brace expansion, which is a pattern +surrounded by using braces: `{}`. For now, we support 2 kinds of brace +expansion: + +1. List: `{ apple, orange }` +2. Sequence: `{1..4}` + +> Note: +> - Spaces around the items are ignored. +> - Do not rely on the expansion ordering. This is subject to change. + +###### List + +The name of a label can contain a list of items, written like +`{ apple, orange }`. For each item, the rule will be duplicated with the new +label name. + +Example: + +```yml +resource_rules: + issues: + rules: + - name: Add missing ~Quality label + conditions: + labels: + - Quality:test-{ gap, infra } + actions: + labels: + - Quality +``` + +Which will be expanded into: + +```yml +resource_rules: + issues: + rules: + - name: Add missing ~Quality label + conditions: + labels: + - Quality:test-gap + actions: + labels: + - Quality + + - name: Add missing ~Quality label + conditions: + labels: + - Quality:test-infra + actions: + labels: + - Quality +``` + +###### Sequence The name of a label can contain one or more sequence conditions, written like `{0..9}`, which means `0`, `1`, `2`, and so on up to `9`. For each number, the rule will be duplicated with the new label name.