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§
- Ownership
Result - 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, parsingcontenteach call. - check_
file_ ownership_ parsed - Find which CODEOWNERS rule owns
file_pathagainst pre-parsed lines. - find_
codeowners - Locate a CODEOWNERS file by walking up from
start, checking.github/CODEOWNERS,CODEOWNERS, anddocs/CODEOWNERSat each level. - get_
repo_ root - Get the repository root from a CODEOWNERS file path.