Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Assign a random team member with r+ priviliges on r? @rust-lang/<team> #187

Centril opened this issue Jan 5, 2019 · 3 comments


Copy link

@Centril Centril commented Jan 5, 2019

If someone writes:

r? @rust-lang/docs 

Then we could for example assign steveklabnik since they have r+ rights.

This mistake happens from time to time; what happens now when someone writes the above is to leave the PR without a reviewer...

cc rust-lang/rust#57357 (comment)


This comment has been minimized.

Copy link
Member Author

@Centril Centril commented Jan 5, 2019

I'm not familiar with the code-base but... To do this, it should be sufficient to:

  1. update the regex here:
  2. add a rewrite on the form @<org>/<team> in this if statement:
    1. when this form is encountered, fetch the available users in that team from GH.
    2. fetch the available users with r+ rights.
    3. intersect users in i. and ii. -- if the intersection is empty, bail and don't assign anyone (possibly comment on GH with a warning).
    4. pick a user in the intersection at random.
    5. set reviewer to whatever user selected in iv.
  3. update relevant tests somewhere in this file:

cc @pietroalbini to correct mistakes I might have made or clarifications if need be.


This comment has been minimized.

Copy link

@pietroalbini pietroalbini commented Jan 5, 2019

I'm not sure if it's that useful to intersect with the list of users with r+ rights though. The list seems correct to me, cc @davidalber


This comment has been minimized.

Copy link

@davidalber davidalber commented Jan 11, 2019

That should cover the case for new comments. You probably want to have this behavior for messages in new PRs, as well. You'll want to encapsulate all of the logic for converting the team alias to a user inside a function, possibly inside find_reviewer.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
None yet
3 participants
You can’t perform that action at this time.