mszostok / codeowners-validator

The GitHub CODEOWNERS file validator
Apache License 2.0
217 stars 47 forks source link

[Valid Owner Checker] Make the ignored owners configurable #54

Closed mszostok closed 3 years ago

mszostok commented 3 years ago

Description

As a part of https://github.com/mszostok/codeowners-validator/issues/52 issue, there was an interesting problem regarding the @ghost user which was solved by https://github.com/mszostok/codeowners-validator/pull/53. This issue is about making implemented logic a little more generic and instead of hard-coding the @ghost username, it would be better to export the option which takes a list of owners e.g. users, teams, etc. that should be ignored by Valid Owner Checker.

Reasons

It's always better to have customizable logic in the library which is used by the broader community, so we can handle more custom scenarios :)

TODO

  1. Add IgnoreOwners []string `envconfig:"default=@ghost"` property in line 15 in file internal/check/valid_owner.go. In this way, this property can be automatically set by environment variable OWNER_CHECKER_IGNORE_OWNERS which can be populated with a list of owners names that should be ignored and not validated e.g. "@user,@org/team1,@ghost"

  2. In constructor NewValidOwner handle new cfg property and provide a func shouldIgnoreGitHubOwner(name) which can be used in for _, ownerName := range entry.Owners loop in line 63:

            if v.shouldIgnoreGitHubOwner(ownerName) {
                continue
            }
  1. Update README.md and describe a new environment variable OWNER_CHECKER_IGNORE_OWNERS which can be used

  2. Update action.yml with new property

majakurcius commented 3 years ago

Let me take it! :)