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

Feature - Avoid duplications of the selected reviewers #37

Closed
monorilaci opened this issue May 23, 2023 · 3 comments
Closed

Feature - Avoid duplications of the selected reviewers #37

monorilaci opened this issue May 23, 2023 · 3 comments

Comments

@monorilaci
Copy link
Contributor

We started to use this tool in our private repositories and we found that the tool can select the same person from the different groups.

I think it's a useful feature to avoid duplications of the selected reviewers.

For example, this is the definition of the groups:

groups:
    - name: group_one
      reviewers: 1
      internal_reviewers: 1
      usernames:
        - person_one
        - person_two

    - name: group_two
      reviewers: 1
      internal_reviewers: 1
      usernames:
        - person_one
        - person_two
        - person_three
        - person_four
        - person_five

The tool can select the person_one user from the group_one and select the same user from the group_two and the consequence of it is that only 1 person is selected as a reviewer of the pull request instead of 2.

My suggested modifications in the lottery.ts file:

First of all, change the 93rd line to this and concat the selected users with the author of the pull request:

            this.pickRandom(usernames, reviewersToRequest, selected.concat(author))

Second of all, change the 105th line to this because the type of the ignore parameter changed in the previous step:

  pickRandom(items: string[], n: number, ignore: string[]): string[] {

Finally, change the 108th line to avoid duplications:

    const candidates = items.filter(item => !ignore.includes(item));
@uesteibar
Copy link
Owner

sounds good to me! It seems you have it figured out so if you wanna go ahead and add the change, be my guest :) I'm currently rather inactive here so that'd be the quickest way to make it happen.

@monorilaci
Copy link
Contributor Author

Cool 👍

I created a branch locally which contains my modifications but I cannot publish it because of this error:
image

Can you give me access to publish my branch and create a pull request?

@uesteibar
Copy link
Owner

you'll have to fork the repo, push your branch to your fork and create a pull request from there. That's the common way of contributing to repositories in which you don't have write access. Here's an explanation of the process: https://dev.to/codesphere/how-to-start-contributing-to-open-source-projects-on-github-534n

In your case you'd have to:

  • Fork the repo.
  • Set a new remote in your local repo. I usually set upstream for the original repo, origin for my own repo.
  • Push your branch to your fork.
  • Create the PR against my repo.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants