Shift3 / standards-and-practices

Standards and Practices for Bitwise Industries
https://shift3.github.io/standards-and-practices/
63 stars 41 forks source link

[Feat]: Explore auto-assigning PR-Team to reviews #387

Open coreyshuman opened 1 year ago

coreyshuman commented 1 year ago

Is your feature request related to a problem? Please describe.

Our current process is to manually attach the PR-Team to a PR review. It would be nice to automate this process. Furthermore, it is an error-prone process in that you must assign PR-Team before any other individuals who are in the team, otherwise the built-in GH auto assignment doesn't fire as expected.

Describe the solution you'd like.

A GH action may be useful here. A good example can be found here: https://github.com/rowi1de/auto-assign-review-teams It will be interesting to test how quickly and efficiently this kind of option would work.

Describe alternatives you've considered

DevOps has investigated various options here: https://github.com/Shift3/terraform-modules/issues/208

Additional context

No response

Karvel commented 1 year ago

We've been using https://docs.gitstream.cm/ at my job, and it seems mostly useful. It can auto-assign PRs based on a yaml config. It is case sensitive, which we found out the hard way. :upside_down_face: Github also supports subteams now and gitstream understands those also.

It can do other things like automatically apply labels and try to parse PR complexity to provide review estimate times. I find the time estimates less useful simply because they are more subjective.

We haven't tried automating reviews with it.

michaelachrisco commented 1 year ago

We discussed this earlier but just letting anyone else that comes into this know.

For specific/smaller teams, the CODEOWNER file works well. You can assign a team like so: https://github.com/Shift3/terraform-modules/blob/develop/.github/CODEOWNERS * @mwallert @Shift3/bwtc-devops

and GH will auto-assign the team on the CODEOWNERs file. This works for small teams like DevOps or our Pods. This does NOT work for our PR-Team as this gives people elevated permissions on a repo above simply auto-assigning the team to a PR.

Trying out all the combos now. Gitstream looks promising @Karvel

michaelachrisco commented 1 year ago

Got limited functionality within the CODEOWNER file by limiting both the branches it applies to as well as made specific files/patterns attached to each team. Examples were made here: https://docs.github.com/en/repositories/managing-your-repositorys-settings-and-features/customizing-your-repository/about-code-owners

There are some caravits to using such a method, each team must have write capability, you mush have different CODEOWNERS file per branch you wish to have it apply to, and you must dial in settings on each teams "Code review" settings.

Examples can be seen here: https://github.com/Shift3/Test-Auto-Assign-PR-Team/blob/main/.github/CODEOWNERS In this example, one can see that our terraform files will auto-assign the DevOps Team. I will be added to all reviews (except my own) as the top most account. And PR-Team is always assigned if no one else is asigned or there is spots left over.

https://github.com/Shift3/Test-Auto-Assign-PR-Team/pull/23 (auto assigned PR Team as default).

michaelachrisco commented 1 year ago

https://docs.gitstream.cm/examples/ looks promising. Thanks @Karvel !

@mwallert Id like us to try this out sometime.