Skip to content

Commit 39d69cc

Browse files
committed
Document relabel aliases
1 parent 9ed7709 commit 39d69cc

File tree

3 files changed

+60
-1
lines changed

3 files changed

+60
-1
lines changed

src/compiler/backports.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ a [`T-compiler`] label as well.
1818
In any case, you should **add a comment when you nominate the pull request for backport** providing
1919
context for the compiler team backport reviewers about why it should be backported.
2020

21-
**Backport nominations are not guaranteed be accepted**. Please refer to the [*Should the backport
21+
**Backport nominations are not guaranteed to be accepted**. Please refer to the [*Should the backport
2222
be approved*](#should-the-backport-be-approved) section below for the criteria on which backport
2323
nominations may be accepted or rejected.
2424

src/release/issue-triaging.md

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -190,6 +190,10 @@ Triagebot needs to support `@rustbot label: xxx` usages terminated with a period
190190
- Check existing labels to make sure you're not duplicating them.
191191
- Discuss in <https://rust-lang.zulipchat.com/#narrow/channel/242269-t-release.2Ftriage/topic/New.20labels> if the new label may be non-conventional or controversial. Leave a comment about the new label as an FYI for others.
192192

193+
### Label aliases
194+
195+
Multiple labels can be added or removed in a single blow using *aliases*. Please visit the [relevant documentation][label-aliases] to learn more about aliases.
196+
193197
### Relnotes issues
194198

195199
Release note issues will currently come with `needs-triage` by default. The triage for relnotes is usually best done if you have sufficient context. Leave them as-is if you don't.
@@ -255,6 +259,7 @@ Another useful thing to do is to go through `E-needs-mcve` and `E-needs-bisectio
255259
[`relnotes`]: https://github.com/rust-lang/rust/labels/relnotes
256260
[`metabug`]: https://github.com/rust-lang/rust/labels/metabug
257261
[relnotes issue example]: https://github.com/rust-lang/rust/issues/137132
262+
[label-aliases]: ../triagebot/labeling.html
258263

259264
[^1]: The `O` in `O-*` labels originally stood for *operating system (OS)*.
260265
[^2]: The `I` in `I-*` labels originally stood for *importance*. This makes the most sense for the `I-*-nominated` labels. For most `I-*` labels however it makes sense to interpret the `I` as *issue (kind)*.

src/triagebot/labeling.md

Lines changed: 54 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,24 @@ Some examples:
1515
* `@rustbot label A-diagnostics A-macros`
1616
* `@rustbot label +T-lang -T-compiler` --- Removes `T-compiler` and adds `T-lang`.
1717

18+
Labels are parsed from left to right and then applied by grouping *adding* labels and *removing* labels. Example:
19+
```
20+
# this command ...
21+
@rustbot label +Alpaca -Bench -Carlo +Esteban +Dwight
22+
23+
# ... will be executed as:
24+
@rustbot label +Alpaca +Esteban +Dwight -Bench -Carlo
25+
```
26+
27+
Labels are parsed and applied from left to right (canceling conflicting labels). Example:
28+
```
29+
# this command ...
30+
@rustbot label +Alpaca -Bench -Carlo +Esteban +Dwight +Bench
31+
32+
# ... will be executed as:
33+
@rustbot label +Alpaca +Esteban +Dwight -Carlo
34+
```
35+
1836
The syntax for the command is somewhat flexible, supporting a few different forms to suit your pleasure.
1937
Some examples of variants you can use:
2038

@@ -81,6 +99,42 @@ allow-unauthenticated = [
8199
]
82100
```
83101

102+
### Aliases
103+
104+
The configuration also supports aliases, a single *word* that is expanded in a set of labels allowing setting multiple labels with a single command, useful when adding or removing the same set of labels over and over. To configure an alias, add to the triagebot the following item:
105+
```toml
106+
[relabel.alias-name]
107+
add-labels = ["Foo", "Bar"]
108+
rem-labels = ["Baz"]
109+
```
110+
111+
`add-labels` and `rem-labels` and arrays of labels that the alias will expand to. For example, given the above configuration:
112+
```
113+
# the command
114+
@rustbot label alias-name
115+
116+
# translates to
117+
@rustbot label +Foo +Bar -Baz
118+
```
119+
120+
Aliases can also be *negative*, inverting the effect:
121+
```
122+
# this command
123+
@rustbot label -cmd-alias
124+
125+
# translates to
126+
@rustbot label +Baz -Foo -Bar
127+
```
128+
129+
You can also mix labels and aliases. Self-canceling labels will be omitted:
130+
```
131+
# this command
132+
@rustbot label cmd-alias +Baz
133+
134+
# translates to:
135+
@rustbot label +Foo +Bar
136+
```
137+
84138
## Implementation
85139

86140
See [`src/handlers/relabel.rs`](https://github.com/rust-lang/triagebot/blob/HEAD/src/handlers/relabel.rs).

0 commit comments

Comments
 (0)