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

Enable filtering code reviewers based on team #25

Closed
atomfinger opened this issue Mar 1, 2023 · 7 comments
Closed

Enable filtering code reviewers based on team #25

atomfinger opened this issue Mar 1, 2023 · 7 comments
Labels
enhancement New feature or request

Comments

@atomfinger
Copy link

Is your feature request related to a problem? Please describe.
As an organization, we have multiple GitHub teams that are responsible for various repositories. These teams are not necessarily fixed, so members split out into new teams and so forth. We handle this in technical terms by placing them on new GH teams.

The issue is that they are still contributors to the codebase, and they're still a part of the organization, which means that they'll likely to be assigned as code reviewers for teams they're no longer part of. Today's solution needs us to manually map their GH users to "null", but that means we have to go through our repositories and maintain that list. This can quickly become tedious when one works with a solution that has a ton of repositories while allowing teams to be a little dynamic.

Describe the solution you'd like
I would like to be able to filter reviewers based on their team.

Describe alternatives you've considered
Right now, the only other option I can think of is either to maintain the team member list for every repo, or have a script that updates every repo as time changes.

@atomfinger atomfinger added the enhancement New feature or request label Mar 1, 2023
@vim-zz
Copy link
Collaborator

vim-zz commented Mar 1, 2023

@atomfinger can you share you current automation rule?

@atomfinger
Copy link
Author

atomfinger commented Mar 1, 2023

@vim-zz It's basically what you have in your tutorial:

  the_right_reviewer:
    if:
      - true
    run:
      - action: add-comment@v1
        args:
          comment: |
            {{ repo | explainRankByGitBlame(gt=25) }}
      - action: add-reviewers@v1
        args:
          reviewers: {{ repo | rankByGitBlame(gt=25) }}

To then filter out people we need to do something like this:

config:
  user_mapping:
    - 'user that is part of team': 'atomfinger'
    - 'user that is no longer in team': null

@vim-zz
Copy link
Collaborator

vim-zz commented Mar 1, 2023

And you would like to make sure that the assigned reviewer is a memebr of the PR author team? or do you have different desired logic?

@atomfinger
Copy link
Author

atomfinger commented Mar 1, 2023

@vim-zz

And you would like to make sure that the assigned reviewer is a memebr of the PR author team?

Well, not necessarily the PR author team. Just that the assigned reviewer is part of a specific team. The team might be the PR author team, but it isn't necessarily a given.

Something like this would be cool:

          reviewers: {{ repo | rankByGitBlame(gt=25, team="Team A") }}

But I'll happily accept having to use a filter or something else that might be more appropriate. I get that it might be undesirable to keep adding parameters to rankByGitBlame.

@vim-zz
Copy link
Collaborator

vim-zz commented Mar 1, 2023

Got it. I am thinking of something like below, that will keep only users from 'Team A' in the resulting list.

 reviewers: {{ repo | rankByGitBlame(gt=25) | filterUsersOf(['Team A']) }}

Does it solve your problem?

[Edit] to clarify filterUsersOf is not yet implemented.

@atomfinger
Copy link
Author

atomfinger commented Mar 1, 2023

@vim-zz , that would be perfect, yeah!

@BenLloydPearson
Copy link
Collaborator

BenLloydPearson commented Jan 10, 2024

@atomfinger I'm happy to share that gitStream now supports JavaScript plugins to build custom filter functions. Here are the docs.

This enables you to extend gitStream capabilities substantially and should allow you to build a plugin that accomplishes what you're looking for. I created a post in our discussion forum for this plugin suggestion.

#416

We'd love to hear about any other ideas you have for plugin. We'd also love it if you share anything you create to solve this challenge, we can publish it in our plugin library if that interests you.

Thanks again! Let me know if you have questions.

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

No branches or pull requests

3 participants