From 39d69cc85948881fb96bda18acc74979b5528ab0 Mon Sep 17 00:00:00 2001 From: apiraino Date: Tue, 21 Oct 2025 16:18:38 +0200 Subject: [PATCH 1/4] Document relabel aliases --- src/compiler/backports.md | 2 +- src/release/issue-triaging.md | 5 ++++ src/triagebot/labeling.md | 54 +++++++++++++++++++++++++++++++++++ 3 files changed, 60 insertions(+), 1 deletion(-) diff --git a/src/compiler/backports.md b/src/compiler/backports.md index b591fe62..fb1ba189 100644 --- a/src/compiler/backports.md +++ b/src/compiler/backports.md @@ -18,7 +18,7 @@ a [`T-compiler`] label as well. In any case, you should **add a comment when you nominate the pull request for backport** providing context for the compiler team backport reviewers about why it should be backported. -**Backport nominations are not guaranteed be accepted**. Please refer to the [*Should the backport +**Backport nominations are not guaranteed to be accepted**. Please refer to the [*Should the backport be approved*](#should-the-backport-be-approved) section below for the criteria on which backport nominations may be accepted or rejected. diff --git a/src/release/issue-triaging.md b/src/release/issue-triaging.md index 3af2e4a4..8c117b66 100644 --- a/src/release/issue-triaging.md +++ b/src/release/issue-triaging.md @@ -190,6 +190,10 @@ Triagebot needs to support `@rustbot label: xxx` usages terminated with a period - Check existing labels to make sure you're not duplicating them. - Discuss in if the new label may be non-conventional or controversial. Leave a comment about the new label as an FYI for others. +### Label aliases + +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. + ### Relnotes issues 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 [`relnotes`]: https://github.com/rust-lang/rust/labels/relnotes [`metabug`]: https://github.com/rust-lang/rust/labels/metabug [relnotes issue example]: https://github.com/rust-lang/rust/issues/137132 +[label-aliases]: ../triagebot/labeling.html [^1]: The `O` in `O-*` labels originally stood for *operating system (OS)*. [^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)*. diff --git a/src/triagebot/labeling.md b/src/triagebot/labeling.md index e29639e6..ee05fa5c 100644 --- a/src/triagebot/labeling.md +++ b/src/triagebot/labeling.md @@ -15,6 +15,24 @@ Some examples: * `@rustbot label A-diagnostics A-macros` * `@rustbot label +T-lang -T-compiler` --- Removes `T-compiler` and adds `T-lang`. +Labels are parsed from left to right and then applied by grouping *adding* labels and *removing* labels. Example: +``` +# this command ... +@rustbot label +Alpaca -Bench -Carlo +Esteban +Dwight + +# ... will be executed as: +@rustbot label +Alpaca +Esteban +Dwight -Bench -Carlo +``` + +Labels are parsed and applied from left to right (canceling conflicting labels). Example: +``` +# this command ... +@rustbot label +Alpaca -Bench -Carlo +Esteban +Dwight +Bench + +# ... will be executed as: +@rustbot label +Alpaca +Esteban +Dwight -Carlo +``` + The syntax for the command is somewhat flexible, supporting a few different forms to suit your pleasure. Some examples of variants you can use: @@ -81,6 +99,42 @@ allow-unauthenticated = [ ] ``` +### Aliases + +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: +```toml +[relabel.alias-name] +add-labels = ["Foo", "Bar"] +rem-labels = ["Baz"] +``` + +`add-labels` and `rem-labels` and arrays of labels that the alias will expand to. For example, given the above configuration: +``` +# the command +@rustbot label alias-name + +# translates to +@rustbot label +Foo +Bar -Baz +``` + +Aliases can also be *negative*, inverting the effect: +``` +# this command +@rustbot label -cmd-alias + +# translates to +@rustbot label +Baz -Foo -Bar +``` + +You can also mix labels and aliases. Self-canceling labels will be omitted: +``` +# this command +@rustbot label cmd-alias +Baz + +# translates to: +@rustbot label +Foo +Bar +``` + ## Implementation See [`src/handlers/relabel.rs`](https://github.com/rust-lang/triagebot/blob/HEAD/src/handlers/relabel.rs). From e1bbb1cb96ded5cdd04d6060b0551bc3d852cd61 Mon Sep 17 00:00:00 2001 From: apiraino Date: Thu, 23 Oct 2025 19:18:01 +0200 Subject: [PATCH 2/4] Update src/triagebot/labeling.md Co-authored-by: Urgau <3616612+Urgau@users.noreply.github.com> --- src/triagebot/labeling.md | 8 -------- 1 file changed, 8 deletions(-) diff --git a/src/triagebot/labeling.md b/src/triagebot/labeling.md index ee05fa5c..8ca8b5b9 100644 --- a/src/triagebot/labeling.md +++ b/src/triagebot/labeling.md @@ -15,14 +15,6 @@ Some examples: * `@rustbot label A-diagnostics A-macros` * `@rustbot label +T-lang -T-compiler` --- Removes `T-compiler` and adds `T-lang`. -Labels are parsed from left to right and then applied by grouping *adding* labels and *removing* labels. Example: -``` -# this command ... -@rustbot label +Alpaca -Bench -Carlo +Esteban +Dwight - -# ... will be executed as: -@rustbot label +Alpaca +Esteban +Dwight -Bench -Carlo -``` Labels are parsed and applied from left to right (canceling conflicting labels). Example: ``` From db5653f10519587378f60cf5b2c22a8081a3c9a4 Mon Sep 17 00:00:00 2001 From: apiraino Date: Thu, 23 Oct 2025 19:18:08 +0200 Subject: [PATCH 3/4] Update src/triagebot/labeling.md Co-authored-by: Urgau <3616612+Urgau@users.noreply.github.com> --- src/triagebot/labeling.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/triagebot/labeling.md b/src/triagebot/labeling.md index 8ca8b5b9..781c56a6 100644 --- a/src/triagebot/labeling.md +++ b/src/triagebot/labeling.md @@ -112,7 +112,7 @@ rem-labels = ["Baz"] Aliases can also be *negative*, inverting the effect: ``` # this command -@rustbot label -cmd-alias +@rustbot label -alias-name # translates to @rustbot label +Baz -Foo -Bar From 27428500dfde34f6af9da639ab6ade972348b86e Mon Sep 17 00:00:00 2001 From: apiraino Date: Thu, 23 Oct 2025 19:18:14 +0200 Subject: [PATCH 4/4] Update src/triagebot/labeling.md Co-authored-by: Urgau <3616612+Urgau@users.noreply.github.com> --- src/triagebot/labeling.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/triagebot/labeling.md b/src/triagebot/labeling.md index 781c56a6..177abb2a 100644 --- a/src/triagebot/labeling.md +++ b/src/triagebot/labeling.md @@ -121,7 +121,7 @@ Aliases can also be *negative*, inverting the effect: You can also mix labels and aliases. Self-canceling labels will be omitted: ``` # this command -@rustbot label cmd-alias +Baz +@rustbot label alias-name +Baz # translates to: @rustbot label +Foo +Bar