@pvm/cowners
A library for working with CODEOWNERS file.
Usage
const { readCodeOwners } = require('@pvm/cowners')
async function main() {
const codeOwners = await readCodeOwners()
}
Interfaces
OwnersEntry
Structure which holds each valid line with pattern and owners in CODEWNERS file.
Here is typescript definition:
interface OwnersGroup {
attrs: Record<string, string | number | boolean | null>,
pattern: string,
owners: string[],
match(path: string): boolean,
}
Where attrs
are being parsed from shebang comments.
Example shebang comment with all available cases:
#! int=4 str='cat\'s ball' new=false old=true greet="hello world!" vs=null
* @owners
Api
getGroups(): OwnersGroup[]
Returns all OwnersGroups which has been parsed.
affectedGroups(paths: string[]): IterableIterator<OwnersGroup>
Returns OwnersGroups which related to given paths.
getOwners(paths: string[]): string[]
Get all owners for given paths.
getMajority(paths: string[], opts: GetMajorityOpts = {}): string[]
Get majority of owners required for review merge request.
For each mask majority is Math.ceil(owners_for_mask / 2)
.
GetMajorityOpts.initial
List if initial reviewers.
GetMajorityOpts.exclude
List of reviewers which should be excluded from result.
groupOwnersByMask(paths: string[]): Record<string, string[]>
Get all owners for given paths and group by filename patterns.
v0.56.18
2023.06.02
📝 Documentation
Other
- Use builtin.list-with-packages default for changelogs (#6ed9e28)
List of updated packages:
- @pvm/add-tag@0.56.18
- @pvm/artifacts@0.56.18
- @pvm/changelog@0.56.18
- @pvm/core@0.56.18
- @pvm/cowners@0.56.18
- @pvm/files@0.56.18
- @pvm/gitlab@0.56.18
- @pvm/mattermost@0.56.18
- @pvm/notifications@0.56.18
- @pvm/pkgset@0.56.18
- @pvm/plugin-conventional-changelog@0.56.18
- @pvm/plugin-conventional-semantic-release@0.56.18
- @pvm/plugin-http-proxy@0.56.18
- @pvm/releases@0.56.18
- @pvm/repository@0.56.18
- @pvm/slack@0.56.18
- @pvm/suffixes@0.56.18
- @pvm/template@0.56.18
- @pvm/types@0.56.18
- @pvm/update@0.56.18
- @pvm/vcs-fs@0.56.18
- @pvm/vcs-git@0.56.18
- @pvm/vcs@0.56.18
- @pvm/viz@0.56.18
- @pvm/pvm@0.56.18
- @pvm/tokens-core@0.56.18
- @pvm/plugin-common-plugins@0.56.18
- @pvm/plugin-core@0.56.18
- @pvm/plugin-github@0.56.18
- @pvm/di@0.56.18