Skip to content
Eric Huss edited this page Oct 26, 2022 · 5 revisions

To enable issue and PR assignment, add the following to triagebot.toml in the repository root:

[assign]

There are multiple commands that triagebot will respond to for handling assignment of issues and PRs:

  • @rustbot claim — This can be used to set the assignment of an issue to the commenter. GitHub has various restrictions on who can be assigned (such as users with write permissions or org members). If triagebot cannot assign the user, it will instead edit the top-level comment with a "claimed" message (and will assign rustbot).

  • @rustbot release-assignment — This will release the assignment of the issue. Only the current assignee or a team member can release assignment.

  • @rustbot assign @user — Assigns a specific user. Only team members can assign other users.

PR assignment

Triagebot can also handle auto-assignment of PRs. This can be done by configuring the owners map in triagebot.toml:

# These are ad-hoc groups that can be referenced in `r?` and the `owners` table below.
# The values may contain GitHub usernames, other groups, or rust-lang teams.
# The `@` is optional.
# Group names should be lowercase.
[assign.adhoc_groups]
libs = ["@joshtriplett", "@Mark-Simulacrum", "@kenntytm", "@m-ou-se", "@thomcc"]
# Can reference other groups.
compiler = ["compiler-team", "compiler-team-contributors"]
compiler-team = ["cjgillot", "estebank"]
compiler-team-contributors = ["compiler-errors", "jackh726"]
# Can reference rust-lang teams.
libs = ["rust-lang/libs-api"]
# This is a special group that will be used if none of the `owners` entries matches.
fallback = ["@Mark-Simulacrum"]

# This specifies users, groups, or teams to assign for different paths.
# Triagebot will pick one person to assign.
# Paths are gitignore-style matches.
[assign.owners]
# Examples of assigning individuals.
"Cargo.lock" = ["@Mark-Simulacrum"]
"/library/std/src/sys/windows" = ["@ChrisDenton"]
# Example of assigning to a group.
"/library/std" = ["libs"]
# Supports gitignore patterns.
"*.js" = ["@octocat"]
# If you want to match all files, `*` should be sufficient.
"*" = ["@octocat"]
# Can use teams from the rust-lang teams database.
"/src/tools/cargo" = ["@rust-lang/cargo"]

If the owners map is configured, then triagebot will automatically select a reviewer based on which files were modified in the PR. This also enables the ability for users to post a comment with r? name to set the assignment to a specific user. r? can support several forms:

  • r? @octocat — Assign a specific user.
  • r? octocat — The @ is optional.
  • r? libs — Choose a random person from the libs ad-hoc group defined in triagebot.toml.
  • r? rust-lang/libs — The org name prefix is optional.
  • r? rustdoc — Choose a random person from the rustdoc team. See the teams database for a list of team names.
  • r? rust-lang/rustdoc — The org name prefix is optional. It is strongly recommended that you do not use @, as that will subscribe and notify the entire team to the PR.

When choosing a user from a team, triagebot only looks at direct team members (it ignores subteams).

When looking up a name, triagebot will first look at ad-hoc groups, then rust-lang teams, and if it doesn't match either of those it assumes it is a GitHub user.

PRs can only be assigned to users with write permissions to the repo, any rust-lang org members with read permissions, or anyone who has commented on the PR.

Additional new PR trigger options

Triagebot will also post a welcome message to the user. Its behavior depends on a few factors:

  • PR authors who have not previously made any commits will get a more detailed welcome message.
  • PR authors who have made commits will get an abbreviated message.
  • If the initial PR comment has an r? command, then no welcome will be posted.

There are several options in triagebot.toml for controlling its behavior on new PRs:

[assign]
# If set, posts a warning message if the PR is opened against a non-default
# branch (usually main or master).
warn_non_default_branch = true
# If set, the welcome message to new contributors will include this link to
# a contributing guide.
contributing_url = "https://rustc-dev-guide.rust-lang.org/contributing.html"

Additionally, triagebot will post a comment with a warning if the PR modifies any submodules.

Ghost

Using r? ghost in the initial PR top-level comment when opening a PR will disable triagebot's auto-assignment. ghost is GitHub's placeholder account for deleted accounts. It is used here for convenience. This is typically used for rollups or experiments where you don't want any assignments or noise.

Clone this wiki locally