KEMBAR78
codeowners package - github.com/ossf/allstar/pkg/policies/codeowners - Go Packages

codeowners

package
v0.0.0-...-0bd92ac Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Oct 11, 2025 License: Apache-2.0 Imports: 7 Imported by: 0

Documentation

Overview

Package codeowners implements the CODEOWNERS policy.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func NewCodeowners

func NewCodeowners() policydef.Policy

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

func (s Codeowners) Fix(ctx context.Context, c *github.Client, owner, repo string) error

Fix implementing policydef.Policy.Fix(). Currently not supported. Plan to support this TODO.

func (Codeowners) GetAction

func (s Codeowners) GetAction(ctx context.Context, c *github.Client, owner, repo string) string

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.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL