THE GITHTML FIELD GUIDE

Why CODEOWNERS did not request the reviewer you expected

GitHub uses the CODEOWNERS file from the pull request’s base branch to determine relevant owners. Check its supported location, valid syntax, matching pattern order, and whether the named users or teams have required access. Draft status and repository settings also affect review behavior. A CODEOWNERS file alone does not automatically make owner approval mandatory.

Inspect the file that GitHub actually uses

A CODEOWNERS change on the head branch does not necessarily control review routing for that same request; the base branch’s file is the key reference. GitHub searches supported locations in order, so an earlier file can take precedence over another copy. Verify which file exists on the selected base rather than editing a different branch and expecting immediate routing changes.

Patterns are not identical to every .gitignore feature. Read the documented syntax and check invalid lines. Later matching patterns take precedence, and ownership is not accumulated in the way a casual reading of several overlapping lines might suggest. A broad rule near the end can therefore replace a more specific owner assignment above it.

Test one representative path

Choose an actual changed path and determine which rule matches it. Confirm that the named owner exists and has the required repository access. Team visibility and access requirements matter; membership in an organization alone is not enough. Inspect GitHub’s displayed ownership for the file and any syntax errors reported for CODEOWNERS.

  1. Verify the pull request’s base repository and branch, then open the CODEOWNERS file from that exact branch.
  2. Walk the matching rules in order for one affected path and identify the final owner assignment rather than assuming the nearest-looking pattern wins.
  3. Check whether the request is a draft and whether owner review is merely requested or explicitly required by the repository’s protection policy.

Fix routing without confusing it with enforcement

A valid ownership file helps request the right reviewers, while required owner approval is a separate repository policy. Correct the file or access setup through a reviewed change, then verify behavior on an appropriate proposal. Do not grant broad access merely to make a name appear as an owner when a narrower team arrangement is intended.

For example, a parser directory can route to a parser team while security-sensitive configuration routes to another owner. Keep ownership assignments current as teams change, and protect changes to the ownership policy itself through the project’s governance. The result should explain who is responsible for a path and whether their approval is required, rather than relying on a file whose rules no one has tested.

  1. If a broad final rule replaces a directory-specific assignment, test the proposed ordering with both a parser file and an unrelated file. Correct routing for one path should not unexpectedly redirect the rest of the repository. Read the resulting owner assignments rather than assuming specificity overrides later matches.
  2. When a maintenance branch routes reviews differently from main, inspect its own CODEOWNERS version before reporting a platform failure. Older branches can legitimately carry different ownership policy. Decide whether the policy should be updated there through a reviewed change or whether the branch-specific owner remains intentional.

Sources and further reading

AI-assisted writing with source-linked guidance and illustrative examples. Read our editorial approach or report a correction.

All github documentation workflows guides →

Read as MarkdownAll guides

Why CODEOWNERS did not request the reviewer you expected · gitHtml