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

Support for monorepo / cross-team repositories #85

Open
seanbecker15 opened this issue Feb 1, 2023 · 4 comments
Open

Support for monorepo / cross-team repositories #85

seanbecker15 opened this issue Feb 1, 2023 · 4 comments

Comments

@seanbecker15
Copy link

seanbecker15 commented Feb 1, 2023

I'm hoping to inquire whether the following use-case is supported:

Team 1 - Maintainers
Team 1 - Contributors
Team 2 - Maintainers
Team 2 - Contributors

For a given glob, ask for review from 1 member of each maintainer group and the rest of the contributor group of the member who created the pull request.

This is an important use-case for repositories used across multiple teams (i.e., monorepos). Happy to elaborate and work toward a solution if this is not possible. Thanks!

@necojackarc
Copy link
Owner

Unfortunately, it doesn't support that use case. The biggest blocker is the option for the maximum number of reviewers applied to the whole reviewer selection.

Let's say five reviewers are chosen based on files changed and teams, and you have options.number_of_reviewers = 3. The random three will be picked out of these five. This is because the randomise logic comes at the very end.

core.info('Randomly picking reviewers if the number of reviewers is set');
reviewers = randomly_pick_reviewers({ reviewers, config });
core.info(`Requesting review to ${reviewers.join(', ')}`);
await github.assign_reviewers(reviewers);

Off the top of my head, I can think of something like options.groups.[group_name].number_of_reviewers.

I'm not sure if this is a good idea, but I think your case could be covered with this option:

reviewers:
  groups:
    team_1_maintainers:
      - member_a
    team_1_contributors:
      - member_b
    team_2_maintainers:
      - member_c
    team_2_contributors:
      - member_d

  per_author:
    team_1_contributors:
      - team_1_maintainers
      - team_1_contributors

    team_2_contributors:
      - team_2_maintainers
      - team_2_contributors

options:
  groups:
    team_1_maintainers:
      number_of_reviewers: 1
    team_2_maintainers:
      number_of_reviewers: 1

@seanbecker15
Copy link
Author

I think adding that option would work well for this use-case. Teams / groups would be coupled with a number of reviewers and could set the number of reviewers they want added to each PR.

One question I would have is how this option would interact with the global number of reviewers option. It seems like this global option might serve best as a default value if there aren't enough reviewers in the groups.

@necojackarc
Copy link
Owner

Good question. I think it's important to make it backwards compatible. The global option should limit the total number of reviewers. If there are other ways to use the global options without breaking the current behaviour, that'd be great, but they can be similar but separate options.

@necojackarc
Copy link
Owner

Oops, I completely forgot that @seanbecker15 reached out to me on Twitter...
Here's his suggestion - https://github.com/seanbecker15/auto-request-review/tree/per-group-number-of-reviewers

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