Documentation
¶
Overview ¶
Package codeowners implements the CODEOWNERS policy.
Index ¶
- func NewCodeowners() policydef.Policy
- type Codeowners
- func (s Codeowners) Check(ctx context.Context, c *github.Client, owner, repo string) (*policydef.Result, error)
- func (s Codeowners) Fix(ctx context.Context, c *github.Client, owner, repo string) error
- func (s Codeowners) GetAction(ctx context.Context, c *github.Client, owner, repo string) string
- func (s Codeowners) IsEnabled(ctx context.Context, c *github.Client, owner, repo string) (bool, error)
- func (s Codeowners) Name() string
- type OrgConfig
- type RepoConfig
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func NewCodeowners ¶
NewCodeowners returns a new CODEOWNERS policy.
Types ¶
type Codeowners ¶
type Codeowners bool
Codeowners is the CODEOWNERS policy object, implements policydef.Policy.
func (Codeowners) Check ¶
func (s Codeowners) Check(ctx context.Context, c *github.Client, owner, repo string, ) (*policydef.Result, error)
Check performs the policy check for CODEOWNERS policy based on the configuration stored in the org/repo, implementing policydef.Policy.Check().
func (Codeowners) Fix ¶
Fix implementing policydef.Policy.Fix(). Currently not supported. Plan to support this TODO.
func (Codeowners) GetAction ¶
GetAction returns the configured action from CODEOWNERS policy's configuration stored in the org-level repo, default log. Implementing policydef.Policy.GetAction().
func (Codeowners) IsEnabled ¶
func (s Codeowners) IsEnabled(ctx context.Context, c *github.Client, owner, repo string) (bool, error)
Check whether this policy is enabled or not.
func (Codeowners) Name ¶
func (s Codeowners) Name() string
Name returns the name of this policy, implementing policydef.Policy.Name().
type OrgConfig ¶
type OrgConfig struct {
// OptConfig is the standard org-level opt in/out config, RepoOverride applies to all
// BP config.
OptConfig config.OrgOptConfig `json:"optConfig"`
// Action defines which action to take, default log, other: issue...
Action string `json:"action"`
// RequireCODEOWNERS : set to true to require presence of a CODEOWNERS on the repositories (creates an issue if not present)
// default false (only checks if existing CODEOWNERS is valid, creates issues if not valid).
RequireCODEOWNERS bool `json:"requireCODEOWNERS"`
}
OrgConfig is the org-level config definition for CODEOWNERS.
type RepoConfig ¶
type RepoConfig struct {
// OptConfig is the standard repo-level opt in/out config.
OptConfig config.RepoOptConfig `json:"optConfig"`
// Action overrides the same setting in org-level, only if present.
Action *string `json:"action"`
// RequireCODEOWNERS : set to true to require presence of a CODEOWNERS on the repositories (creates an issue if not present)
// default false (only checks if existing CODEOWNERS is valid, creates issues if not valid).
RequireCODEOWNERS *bool `json:"requireCODEOWNERS"`
}
RepoConfig is the repo-level config for CODEOWNERS.