Skip to main content

Module ownership

Module ownership 

Source
Expand description

Resolve which rule in a CODEOWNERS file owns a given path, and locate the CODEOWNERS file itself within a repository.

GitHub’s CODEOWNERS semantics are “last match wins”: later rules override earlier ones. The functions here encode that rule.

Structs§

OwnershipResult
The rule that owns a file: which line matched, with what pattern, and which owners were assigned.

Functions§

check_file_ownership
Find which CODEOWNERS rule owns file_path, parsing content each call.
check_file_ownership_parsed
Find which CODEOWNERS rule owns file_path against pre-parsed lines.
find_codeowners
Locate a CODEOWNERS file by walking up from start, checking .github/CODEOWNERS, CODEOWNERS, and docs/CODEOWNERS at each level.
get_repo_root
Get the repository root from a CODEOWNERS file path.