config

package
v0.0.0-...-74ea383 Latest Latest
Warning

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

Go to latest
Published: Jan 15, 2024 License: MIT Imports: 4 Imported by: 0

Documentation

Overview

this file implements configurations for repositories

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Category

type Category struct {
	Title  string   `yaml:"title"`
	Labels []string `yaml:"labels"`
}

type DrafterConfig

type DrafterConfig struct {
	// RepoOwner as provided by the github context
	RepoOwner string
	// RepoName as provided by the github context
	RepoName string
	// ApiUrl of gitea as provided by the "GITHUB_SERVER_URL" env var
	ApiUrl string
	// Token as provided by the "GITHUB_TOKEN" env var
	Token string
	// ConfigPath as provided by the "config-path" action input. defaults to ".gitea/release-drafter.yml"
	ConfigPath string
}

DrafterConfig holds all configurations we need for the drafter to run

func NewFromInputs

func NewFromInputs(action *githubactions.Action) (*DrafterConfig, error)

NewFromInputs creates a new drafter config by using the action inputs and the github context

type RepoConfig

type RepoConfig struct {
	// DefaultBranch where we look for the configuration file
	DefaultBranch string `mapstructure:"default-branch"`
	// NameTemplate template for the release name
	NameTemplate string `mapstructure:"name-template"`
	// TagTemplate template for the release tag
	TagTemplate     string     `mapstructure:"tag-template"`
	Categories      []Category `yaml:"categories"`
	VersionResolver struct {
		Major struct {
			Labels []string
		}
		Minor struct {
			Labels []string
		}
		Patch struct {
			Labels []string
		}
		Default string
	} `mapstructure:"version-resolver"`
}

RepoConfig holds all configurations for the repo we're running on

func ReadRepoConfig

func ReadRepoConfig(in io.Reader, defaultBranch string) (*RepoConfig, error)

ReadRepoConfig reads in the yaml config found in the default branch of the project and adds sensible defaults if values aren't set

Jump to

Keyboard shortcuts

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