config

package
v0.2.8 Latest Latest
Warning

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

Go to latest
Published: Jun 7, 2026 License: Apache-2.0 Imports: 7 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func BootstrapTeamYAML

func BootstrapTeamYAML(path string, name string) error

func ValidateCodeOwner added in v0.2.5

func ValidateCodeOwner(co string) error

ValidateCodeOwner checks that a CODEOWNERS entry is well-formed. Accepts bare usernames (octocat), explicit user refs (@octocat), and team refs (@org/team-slug). Emails are not yet supported.

Types

type AppConfig

type AppConfig struct {
	AppID      int64  `yaml:"app_id,omitempty"`
	PrivateKey string `yaml:"private_key,omitempty"`
	Org        string `yaml:"org"`

	DryWarnings struct {
		WarnUnmanagedTeams        bool `yaml:"warn_unmanaged_teams"`
		WarnMembersWithoutAnyTeam bool `yaml:"warn_members_without_any_team"`
		WarnUnmanagedRepos        bool `yaml:"warn_unmanaged_repos"`
		WarnUnmanagedCustomRoles  bool `yaml:"warn_unmanaged_custom_roles"`
	} `yaml:"dry_warnings"`
	RemoveMembersWithoutTeam   bool `yaml:"remove_members_without_team"`
	DeleteUnconfiguredTeams    bool `yaml:"delete_unconfigured_teams"`
	DeleteUnmanagedRepos       bool `yaml:"delete_unmanaged_repos"`
	DeleteUnmanagedCustomRoles bool `yaml:"delete_unmanaged_custom_roles"`
	DeleteStaleCodeowners      bool `yaml:"delete_stale_codeowners"`
	CreateRepo                 bool `yaml:"create_repo"`

	// Files declares templated files that should exist in every managed
	// repository. Each entry's Content is rendered through text/template with
	// {Org, Repo} context. Only (optional) limits which repos an entry applies
	// to via path.Match-style globs.
	Files []FileSpec `yaml:"files,omitempty"`

	// Legacy convenience flags. These are still honored but are materialized
	// into Files entries at load time. Prefer Files for new configurations.
	AddRenovateConfig bool   `yaml:"add_renovate_config,omitempty"`
	RenovateConfig    string `yaml:"renovate_config,omitempty"`
	AddDefaultReadme  bool   `yaml:"add_default_readme,omitempty"`
}

type CustomRoleConfig added in v0.2.1

type CustomRoleConfig struct {
	Name        string   `yaml:"name"`
	Description string   `yaml:"description,omitempty"`
	BaseRole    string   `yaml:"base_role"` // read, triage, write, maintain, admin
	Permissions []string `yaml:"permissions,omitempty"`
}

CustomRoleConfig defines a custom repository role for the organization Requires GitHub Enterprise Cloud

type FileSpec added in v0.2.5

type FileSpec struct {
	Path      string   `yaml:"path"`
	Content   string   `yaml:"content"`
	Message   string   `yaml:"message,omitempty"`
	Branch    string   `yaml:"branch,omitempty"`
	Only      []string `yaml:"only,omitempty"`
	Reconcile bool     `yaml:"reconcile,omitempty"`
}

FileSpec declares a file that gomgr should ensure exists in managed repos. Content is a Go text/template; Path, Message and Branch are literal strings. Only restricts which repositories the file applies to (path.Match globs against the repo name). An empty Only matches every managed repo.

Reconcile controls drift handling for files that already exist. When false (the default) gomgr only writes the file when it is missing, leaving any hand-edited content alone. When true gomgr compares the rendered content to what is on the default branch and pushes an update commit if they differ — useful for config-derived files like CODEOWNERS that should track the YAML.

type OrgConfig

type OrgConfig struct {
	Owners      []string           `yaml:"owners"`
	CustomRoles []CustomRoleConfig `yaml:"custom_roles,omitempty"`
}

type RepoConfig added in v0.1.13

type RepoConfig struct {
	Permission string   `yaml:"permission,omitempty"` // pull|triage|push|maintain|admin
	Topics     []string `yaml:"topics,omitempty"`
	Pinned     bool     `yaml:"pinned,omitempty"`
}

type Root

type Root struct {
	App  AppConfig    `yaml:"app"`
	Org  OrgConfig    `yaml:"org"`
	Team []TeamConfig `yaml:"teams"`
}

func Load

func Load(dir string) (*Root, error)

func (*Root) Validate added in v0.2.3

func (r *Root) Validate() error

Validate checks that the loaded configuration is semantically correct.

type TeamConfig

type TeamConfig struct {
	Name        string   `yaml:"name"`
	Slug        string   `yaml:"slug,omitempty"`
	Description string   `yaml:"description,omitempty"`
	Privacy     string   `yaml:"privacy,omitempty"` // closed, secret
	Parents     []string `yaml:"parents,omitempty"`

	Maintainers []string `yaml:"maintainers,omitempty"`
	Members     []string `yaml:"members,omitempty"`

	// repo => permission (pull|triage|push|maintain|admin) or RepoConfig for advanced settings
	// For backward compatibility, supports both:
	//   repositories:
	//     infra: maintain               # simple string permission
	//     api:                          # or advanced RepoConfig
	//       permission: push
	//       topics: [backend, api]
	//       pinned: true
	Repositories map[string]any `yaml:"repositories,omitempty"`
}

func (TeamConfig) ResolvedSlug added in v0.2.3

func (t TeamConfig) ResolvedSlug() string

ResolvedSlug returns the team's slug, deriving it from the name if not explicitly set.

Jump to

Keyboard shortcuts

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