config

package
v0.9.0 Latest Latest
Warning

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

Go to latest
Published: Apr 19, 2024 License: MIT Imports: 11 Imported by: 0

Documentation

Index

Constants

View Source
const (
	DefaultConfigFilepath = ".github/.gh-prx.yaml"
	DefaultTitle          = "{{.Type}}{{with .Issue}}({{.}}){{end}}: {{humanize .Description}}"
	DefaultBody           = `` /* 291-byte string literal not displayed */

	DefaultBranchTemplate = "{{.Type}}/{{with .Issue}}{{.}}-{{end}}{{.Description}}"
	DefaultBranchPattern  = `{{.Type}}\/({{.Issue}}-)?{{.Description}}`
)

Variables

View Source
var (
	DefaultIgnoreCommitsPattern = []string{`^wip`}
	DefaultIssueTypes           = []string{
		"fix", "feat", "chore", "docs", "refactor", "test", "style", "build", "ci", "perf", "revert",
	}
	DefaultVariablePatterns = map[string]string{
		"Type":        `fix|feat|chore|docs|refactor|test|style|build|ci|perf|revert`,
		"Issue":       `([a-zA-Z]+\-)*[0-9]+`,
		"Author":      `[a-zA-Z0-9]+`,
		"Description": `.*`,
	}
	DefaultTokenSeparators = []string{"-", "_"}
	Providers              = []string{"github", "jira", "linear"}
	DefaultProvider        = "github"
	ErrInvalidProvider     = errors.New("Invalid provider")
)

Functions

func GetOpenAIApiKey added in v0.1.0

func GetOpenAIApiKey() string

func SaveSetupConfig

func SaveSetupConfig(cfg *SetupConfig) error

Types

type BranchConfig

type BranchConfig struct {
	// The template structure of your branch names.
	// Example pattern:
	// {{.Type}}/{{.Author}}-{{.Issue}}-{{.Description}}
	//
	// Example branch names:
	// - feature/PROJ-1234-add-foo
	// - chore-PROJ-1234-update-deps
	// - name-fix-PROJ-1234-wrong-thing
	// - bug-name-PROJ-1234-fix-thing
	// - PROJ-1234-some-new-features
	Template string `yaml:"template"`

	// The pattern that should be used to validate the branch name and extract variables.
	//
	// Example: {{.Type}}\/({{.Issue}}-)?{{.Description}}
	// Where the variables are defined in the `variable_patterns` field.
	Pattern string `yaml:"pattern"`

	// The patterns that should be fetched from the branch name.
	//
	// Example:
	//   "Issue": "([A-Z]+\\-[0-9]+)"
	//   "Author": "([a-z0-9]+)"
	//   "Description": "(.*)"
	//   "Type": "(fix|feat|chore|docs|refactor|test|style|build|ci|perf|revert)"
	VariablePatterns map[string]string `yaml:"variable_patterns"`

	TokenSeparators []string `yaml:"token_separators"`

	MaxLength int `yaml:"max_length"`
}

func (*BranchConfig) SetDefaults

func (c *BranchConfig) SetDefaults()

func (*BranchConfig) Validate

func (c *BranchConfig) Validate() error

type CheckoutNewConfig added in v0.2.0

type CheckoutNewConfig struct {
	Jira   CheckoutNewJiraConfig   `yaml:"jira"`
	GitHub CheckoutNewGitHubConfig `yaml:"github"`
}

func (*CheckoutNewConfig) SetDefaults added in v0.2.0

func (c *CheckoutNewConfig) SetDefaults()

type CheckoutNewGitHubConfig added in v0.2.0

type CheckoutNewGitHubConfig struct {
	IssueListFlags []string `yaml:"issue_list_flags"`
}

func (*CheckoutNewGitHubConfig) SetDefaults added in v0.2.0

func (c *CheckoutNewGitHubConfig) SetDefaults()

type CheckoutNewJiraConfig added in v0.2.0

type CheckoutNewJiraConfig struct {
	IssueJQL string `yaml:"issue_jql"`
	Project  string `yaml:"project"`
}

func (*CheckoutNewJiraConfig) SetDefaults added in v0.2.0

func (c *CheckoutNewJiraConfig) SetDefaults()

type IssueConfig

type IssueConfig struct {
	Provider string   `yaml:"provider"`
	Types    []string `yaml:"types"`
}

func (*IssueConfig) SetDefaults

func (c *IssueConfig) SetDefaults()

func (*IssueConfig) Validate

func (c *IssueConfig) Validate() error

type JiraConfig

type JiraConfig struct {
	Endpoint string `yaml:"endpoint,omitempty"`
	User     string `yaml:"user,omitempty"`
	Token    string `yaml:"token,omitempty"`
}

func (*JiraConfig) SetDefaults added in v0.3.0

func (c *JiraConfig) SetDefaults()

func (*JiraConfig) Validate

func (c *JiraConfig) Validate() error

type LinearConfig added in v0.3.0

type LinearConfig struct {
	APIKey string `yaml:"api_key"`
}

func (*LinearConfig) SetDefaults added in v0.3.0

func (c *LinearConfig) SetDefaults()

func (*LinearConfig) Validate added in v0.3.0

func (c *LinearConfig) Validate() error

type PullRequestConfig

type PullRequestConfig struct {
	Title                 string   `yaml:"title"`
	IgnoreCommitsPatterns []string `yaml:"ignore_commits_patterns"`
	AnswerChecklist       *bool    `yaml:"answer_checklist"`
	PushToRemote          *bool    `yaml:"push_to_remote"`

	Body string `yaml:"-"`
}

func (*PullRequestConfig) SetDefaults

func (c *PullRequestConfig) SetDefaults()

type RepositoryConfig added in v0.0.5

type RepositoryConfig struct {
	Branch                  BranchConfig      `yaml:"branch"`
	PR                      PullRequestConfig `yaml:"pr"`
	Issue                   IssueConfig       `yaml:"issue"`
	CheckoutNew             CheckoutNewConfig `yaml:"checkout_new"`
	PullRequestTemplatePath string            `yaml:"pull_request_template_path"`
}

func LoadRepositoryConfig added in v0.0.5

func LoadRepositoryConfig(globalRepoConfig *RepositoryConfig) (*RepositoryConfig, error)

func (*RepositoryConfig) SetDefaults added in v0.0.5

func (c *RepositoryConfig) SetDefaults()

func (*RepositoryConfig) Validate added in v0.0.5

func (c *RepositoryConfig) Validate() error

type SetupConfig

type SetupConfig struct {
	JiraConfig   *JiraConfig   `yaml:"jira,omitempty"`
	LinearConfig *LinearConfig `yaml:"linear,omitempty"`

	// RepositoryConfig a global config for all repositories.
	// Per-repository config properties will override this one.
	RepositoryConfig *RepositoryConfig `yaml:"global,omitempty"`
}

func LoadSetupConfig

func LoadSetupConfig() (*SetupConfig, error)

func (*SetupConfig) SetDefaults added in v0.3.0

func (c *SetupConfig) SetDefaults()

Jump to

Keyboard shortcuts

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