gitgithubgithub-enterprisegithub-codeowners

Git Codeowners logic for multi team approvals


I am trying to figure out how to achieve the following behaviour using the CODEOWNERS file

Setup:

Outcome:

When PR is done for files inside dev1 or dev2 folders, member of '@myorg/devops' approves it. Github however requests another approval from '@myorg/dev' group.

What am I doing wrong here?


Solution

  • Can you share a screenshot or error message?

    According to the document "or" statement works

    # In this example, any change inside the /scripts directory

    # will require approval from @doctocat or @octocat.

    /scripts/ @doctocat @octocat

    By the way, it shouldn't matter if the owner is a user or a team.

    # Teams can be specified as code owners as well. Teams should

    # be identified in the format @org/team-name. Teams must have

    # explicit write access to the repository. In this example,

    # the octocats team in the octo-org organization owns all .txt files.

    *.txt @octo-org/octocats

    My guess is that branch protection rule in your repository is saying that 2 approvals are needed for a PR. See "Require approvals" section in this page