config

package
Version: v0.0.0-...-84b402d Latest Latest
Warning

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

Go to latest
Published: Nov 22, 2021 License: Apache-2.0 Imports: 7 Imported by: 0

Documentation

Overview

Package config defines and grabs overall bot config.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func FetchConfig

func FetchConfig(ctx context.Context, c *github.Client, owner, repo, name string, orgLevel bool, out interface{}) error

FetchConfig grabs a yaml config file from github and writes it to out.

func GetAppConfigs

func GetAppConfigs(ctx context.Context, c *github.Client, owner, repo string) (*OrgConfig, *RepoConfig)

GetAppConfigs gets the Allstar configurations for both Org and Repo level.

func IsBotEnabled

func IsBotEnabled(ctx context.Context, c *github.Client, owner, repo string) bool

IsBotEnabled determines if allstar is enabled overall on the provided repo.

func IsEnabled

func IsEnabled(ctx context.Context, o OrgOptConfig, r RepoOptConfig, c *github.Client, owner, repo string) (bool, error)

IsEnabled determines if a repo is enabled by interpreting the provided org-level and repo-level OptConfigs.

Types

type OrgConfig

type OrgConfig struct {
	// OptConfig contains the opt in/out configuration.
	OptConfig OrgOptConfig `yaml:"optConfig"`

	// IssueLabel is the label used to tag, search, and identify GitHub Issues
	// created by the bot. The defeault is specified by the operator of Allstar,
	// currently: "allstar"
	IssueLabel string `yaml:"issueLabel"`

	// IssueRepo is the name of a repository in the organization to create issues
	// in. If left unset, by default Allstar will create issues in the repository
	// that is out of compliance. Setting the IssueRepo will instruct Allstar to
	// only create issues in the specified repository for non-compliance found in
	// any repository in the organization.
	//
	// This can be useful for previewing the issues that Allstar would create in
	// all repositories. Also, it can be used to centrally audit non-compliance
	// issues.
	//
	// Note: When changing this setting, Allstar does not clean up previously
	// created issues from a previous setting.
	IssueRepo string `yaml:"issueRepo"`
}

OrgConfig is the org-level config definition for Allstar

type OrgOptConfig

type OrgOptConfig struct {
	// OptOutStrategy : set to true to change from opt-in to opt-out.
	OptOutStrategy bool `yaml:"optOutStrategy"`

	// OptInRepos is the list of repos to opt-in when in opt-in strategy.
	OptInRepos []string `yaml:"optInRepos"`

	// OptOutRepos is the list of repos to opt-out when in opt-out strategy.
	OptOutRepos []string `yaml:"optOutRepos"`

	// OptOutPrivateRepos : set to true to not access private repos.
	OptOutPrivateRepos bool `yaml:"optOutPrivateRepos"`

	// OptOutPublicRepos : set to true to not access public repos.
	OptOutPublicRepos bool `yaml:"optOutPublicRepos"`

	// DisableRepoOverride : set to true to disallow repos from opt-in/out in
	// their config.
	DisableRepoOverride bool `yaml:"disableRepoOverride"`
}

OrgOptConfig is used in Allstar and policy-secific org-level config to define the opt in/out configuration.

type RepoConfig

type RepoConfig struct {
	// OptConfig contains the opt in/out configuration.
	OptConfig RepoOptConfig `yaml:"optConfig"`

	// IssueLabel is the label used to tag, search, and identify GitHub Issues
	// created by the bot. Repo-level label my override Org-level setting
	// regardless of Optconfig.DisableRepoOverride.
	IssueLabel string `yaml:"issueLabel"`
}

RepoConfig is the repo-level config definition for Allstar

type RepoOptConfig

type RepoOptConfig struct {
	// OptIn : set to true to opt-in this repo when in opt-in strategy
	OptIn bool `yaml:"optIn"`

	// OptOut: set to true to opt-out this repo when in opt-out strategy
	OptOut bool `yaml:"optOut"`
}

RepoOptConfig is used in Allstar and policy-specific repo-level config to opt in/out of enforcement.

Source Files

Directories

Path Synopsis
Package operator contains config to be set by the GitHub App operator
Package operator contains config to be set by the GitHub App operator

Jump to

Keyboard shortcuts

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