Skip to content

reid-rigo/codeowners

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

37 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Codeowners

A pure Elixir parser for the GitHub CODEOWNERS specification.

Installation

The package can be installed by adding codeowners to your list of dependencies in mix.exs:

def deps do
  [
    {:codeowners, "~> 0.2.0"}
  ]
end

Basic usage

> codeowners = Codeowners.load(".github/CODEOWNERS")
%Codeowners{
  path: "/Users/me/project/.github/CODEOWNERS",
  root: "/Users/me/project",
  rules: [
    %Codeowners.Rule{
      pattern: "*",
      regex: ~r/[^\/]*/,
      owners: ["@global-owner1", "@global-owner2"]
    },
    %Codeowners.Rule{
      pattern: "*.js",
      regex: ~r/[^\/]*\.js/,
      owners: ["@js-owner"]
    },
    ...
  ]
}

> matching_rule = Codeowners.rule_for_path(codeowners, "docs/setup.md")
%Codeowners.Rule{
  pattern: "docs/*",
  regex: ~r/docs\/[^\/]*\z/,
  owners: ["docs@example.com"]
}

Mix task

~/my_project/:$ mix codeowners README.md
Using .github/CODEOWNERS
README.md    @my-team

License

MIT License - see the LICENSE file.

About

Elixir CODEOWNERS parser

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages