Documentation ¶
Overview ¶
Package config defines and grabs overall bot config.
Index ¶
- func ClearInstLoc(owner string)
- func FetchConfig(ctx context.Context, c *github.Client, owner, repo, name string, ...) error
- func GetAppConfigs(ctx context.Context, c *github.Client, owner, repo string) (*OrgConfig, *RepoConfig, *RepoConfig)
- func IsBotEnabled(ctx context.Context, c *github.Client, owner, repo string) bool
- func IsEnabled(ctx context.Context, o OrgOptConfig, orc, r RepoOptConfig, c *github.Client, ...) (bool, error)
- type ConfigLevel
- type OrgConfig
- type OrgOptConfig
- type RepoConfig
- type RepoOptConfig
- type ScheduleConfig
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func ClearInstLoc ¶
func ClearInstLoc(owner string)
Function ClearInstLoc clears any saved config locations for an org/installation
func FetchConfig ¶
func FetchConfig(ctx context.Context, c *github.Client, owner, repo, name string, cl ConfigLevel, 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, *RepoConfig)
GetAppConfigs gets the Allstar configurations for both Org and Repo level.
func IsBotEnabled ¶
IsBotEnabled determines if allstar is enabled overall on the provided repo.
Types ¶
type ConfigLevel ¶
type ConfigLevel int8
ConfigLevel is an enum to indicate which level config to retrieve for the particular policy.
const ( // OrgLevel is the organization level config that is defined in the .allstar // or .github config repo. OrgLevel ConfigLevel = iota // OrgRepoLevel is the repo level config that is defined in the .allstar or // .github config repo. OrgRepoLevel // RepoLevel is the repo level config that is defined in the .allstar folder // of the repo being checked. RepoLevel )
type OrgConfig ¶
type OrgConfig struct { // OptConfig contains the opt in/out configuration. OptConfig OrgOptConfig `json:"optConfig"` // IssueLabel is the label used to tag, search, and identify GitHub Issues // created by the bot. The default is specified by the operator of Allstar, // currently: "allstar" IssueLabel string `json:"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 `json:"issueRepo"` // issues in the GitHub organization. It does not supercede the bot-level // footer (found in pkg/config/operator) but is added in addition to that // one. This setting is useful to direct users to the organization-level // config repository or documentation describing your Allstar settings and // policies. IssueFooter string `json:"issueFooter"` // Schedule specifies whether to perform certain actions on specific days. Schedule *ScheduleConfig `json:"schedule"` }
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 `json:"optOutStrategy"` // OptInRepos is the list of repos to opt-in when in opt-in strategy. OptInRepos []string `json:"optInRepos"` // OptOutRepos is the list of repos to opt-out when in opt-out strategy. OptOutRepos []string `json:"optOutRepos"` // OptOutPrivateRepos : set to true to not access private repos. OptOutPrivateRepos bool `json:"optOutPrivateRepos"` // OptOutPublicRepos : set to true to not access public repos. OptOutPublicRepos bool `json:"optOutPublicRepos"` // OptOutArchivedRepos : set to true to opt-out archived repositories. OptOutArchivedRepos bool `json:"optOutArchivedRepos"` // OptOutForkedRepos : set to true to opt-out forked repositories. OptOutForkedRepos bool `json:"optOutForkedRepos"` // DisableRepoOverride : set to true to disallow repos from opt-in/out in // their config. DisableRepoOverride bool `json:"disableRepoOverride"` }
OrgOptConfig is used in Allstar and policy-specific org-level config to define the opt in/out configuration.
type RepoConfig ¶
type RepoConfig struct { // OptConfig contains the opt in/out configuration. OptConfig RepoOptConfig `json:"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 `json:"issueLabel"` // Schedule specifies days during which to not send notifications, Schedule *ScheduleConfig `json:"schedule"` }
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 `json:"optIn"` // OptOut: set to true to opt-out this repo when in opt-out strategy OptOut bool `json:"optOut"` }
RepoOptConfig is used in Allstar and policy-specific repo-level config to opt in/out of enforcement.
type ScheduleConfig ¶
type ScheduleConfig struct { // Timezone specifies a timezone, eg. "America/Los_Angeles" // See https://en.wikipedia.org/wiki/List_of_tz_database_time_zones#List Timezone string `json:"timezone"` // Days specifies up to three weekdays during which to disable pings. // eg. "saturday" or "sunday" Days []string `json:"days"` }
ScheduleConfig is used to disable notifications during specific days, such as weekends.
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 |
Package schedule provides the ShouldPerform function for use with config.ScheduleConfig.
|
Package schedule provides the ShouldPerform function for use with config.ScheduleConfig. |