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

Open
Centril opened this issue Jan 5, 2019 · 3 comments

Comments

@Centril
Copy link
Member

@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)

@Centril

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: https://github.com/rust-lang-nursery/highfive/blob/414fd076a3c67cfa8b0790733c0a734cd5231cb1/highfive/newpr.py#L42
  2. add a rewrite on the form @<org>/<team> in this if statement: https://github.com/rust-lang-nursery/highfive/blob/414fd076a3c67cfa8b0790733c0a734cd5231cb1/highfive/newpr.py#L416
    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: https://github.com/rust-lang-nursery/highfive/blob/414fd076a3c67cfa8b0790733c0a734cd5231cb1/highfive/tests/test_newpr.py#L1

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

@pietroalbini

This comment has been minimized.

Copy link
Member

@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

@davidalber

This comment has been minimized.

Copy link
Collaborator

@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
Projects
None yet
3 participants
You can’t perform that action at this time.