linear-b / gitstream

/:\ gitStream - Workflow automation for your git repo. Use YAML to auto-assign reviewers, auto-merge PRs, automatic PR labeler, and more.
https://gitstream.cm
Apache License 2.0
272 stars 33 forks source link

Require approvals of certain specific users #522

Closed IvanRibakov closed 6 months ago

IvanRibakov commented 6 months ago

Is your feature request related to a problem? Please describe. I want to enforce following PR review behaviour:

Describe the solution you'd like I'd like to be able to optionally specify a list of users who's approval is mandatory via set-required-approvals action.

Describe alternatives you've considered Github's Code Owners feature seems to give the closest result via "Branch protection" > "Require a pull request before merging" > "Require review from Code Owners". My problem with that is that we're actually trying to substitute Code Owners with gitStream as it is a lot more flexible and allows us to centralize the config at the Org level.

vim-zz commented 6 months ago

How about something like this:

manifest:
  version: 1.0

automations:
  pr_review:
    if:
      - true
    run:
      - action: add-reviewers@v1
        args:
          reviewers: [acme/team-a]

  pr_merge:
    if:
      - true
    run:
      - action: set-required-approvals@v1
        args:
          approvals: 2
      - action: require-reviewers@v1
        args:
          reviewers: [acme/team-a]
      - action: require-reviewers@v1
        args:
          reviewers: [luke-the-team-lead]

You will need to edit the acme/team-a and luke-the-team-lead to your user and team names

IvanRibakov commented 6 months ago

My bad, I missed that action. Thanks @vim-zz!