config

package
v1.2.0 Latest Latest
Warning

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

Go to latest
Published: Aug 31, 2026 License: MIT Imports: 9 Imported by: 0

Documentation

Overview

Package config stores the user's rel profiles: which GitHub owner (org or user) to work with, an optional team, the branch names used by the release flow and the repository name filters.

Index

Constants

This section is empty.

Variables

View Source
var ErrNoProfiles = errors.New("no profiles configured")

ErrNoProfiles is returned when no profile has been configured yet.

Functions

func ParsePatterns

func ParsePatterns(s string) []string

ParsePatterns splits a comma separated glob list entered by the user.

func Path

func Path() (string, error)

Path returns the location of the configuration file.

Types

type Config

type Config struct {
	CurrentProfile string     `json:"current_profile"`
	Profiles       []*Profile `json:"profiles"`
}

Config is the on-disk configuration file.

func Load

func Load() (*Config, error)

Load reads the configuration file. A missing file yields an empty config.

func (*Config) Add

func (c *Config) Add(p *Profile)

Add stores a profile, replacing an existing one with the same name.

func (*Config) Current

func (c *Config) Current() (*Profile, error)

Current returns the active profile. It falls back to the only profile when current_profile is unset or dangling.

func (*Config) Delete

func (c *Config) Delete(name string) error

Delete removes a profile by name.

func (*Config) Get

func (c *Config) Get(name string) (*Profile, bool)

Get returns the profile with the given name.

func (*Config) Names

func (c *Config) Names() []string

Names returns the profile names in file order.

func (*Config) Save

func (c *Config) Save() error

Save writes the configuration file, creating the directory if needed.

func (*Config) SetCurrent

func (c *Config) SetCurrent(name string) error

SetCurrent marks a profile as active.

type OwnerType

type OwnerType string

OwnerType tells whether a profile targets a GitHub organization or a user.

const (
	OwnerOrg  OwnerType = "org"
	OwnerUser OwnerType = "user"
)

type Profile

type Profile struct {
	Name       string    `json:"name"`
	Owner      string    `json:"owner"`
	OwnerType  OwnerType `json:"owner_type"`
	Team       string    `json:"team,omitempty"`
	BaseBranch string    `json:"base_branch"`
	DevBranch  string    `json:"dev_branch"`
	Include    []string  `json:"include,omitempty"`
	Exclude    []string  `json:"exclude,omitempty"`
}

Profile describes one GitHub context rel can operate on.

func (*Profile) FilterRepos

func (p *Profile) FilterRepos(repos []string) []string

FilterRepos returns the repository names accepted by the profile filters.

func (*Profile) Fingerprint

func (p *Profile) Fingerprint() string

Fingerprint is a short hash of everything that changes which repositories a profile returns. It is used to invalidate caches.

func (*Profile) Matches

func (p *Profile) Matches(repo string) bool

Matches reports whether a repository name passes the profile filters. An empty Include list matches everything; Exclude always wins.

func (*Profile) SingleBranch

func (p *Profile) SingleBranch() bool

SingleBranch reports whether the profile uses one branch for both the dev and the release side, which makes the sync flow meaningless.

func (*Profile) Summary

func (p *Profile) Summary() string

Summary is a one line human readable description of the profile target.

func (*Profile) Validate

func (p *Profile) Validate() error

Validate reports whether the profile can be used for API calls.

Jump to

Keyboard shortcuts

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