gitlabels

package
v1.0.0 Latest Latest
Warning

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

Go to latest
Published: Dec 9, 2018 License: MIT Imports: 8 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	ErrEmptyUser = errors.New("at least one should be present: org or owner")
)

gitlabels errors

Functions

This section is empty.

Types

type Config

type Config struct {
	Owner        string                 `yaml:"owner"`
	ORG          string                 `yaml:"org"`
	Labels       map[string]LabelConfig `yaml:"labels"`
	ProjectRegex string                 `yaml:"project-regex"`
	RenameLabels map[string]string      `yaml:"rename"`
	RemoveLabels []string               `yaml:"remove"`
}

Config gitlabels config

func ParseConfig

func ParseConfig(content []byte) (Config, error)

ParseConfig parse config from []byte

type GitRepository

type GitRepository interface {
	ListOwnerRepos(ctx context.Context, owner string) ([]*github.Repository, error)
	ListORGRepos(ctx context.Context, org string) ([]*github.Repository, error)
	ListLabels(ctx context.Context, user, repo string) ([]string, error)

	CreateLabel(ctx context.Context, user, repo, name string, label LabelConfig) error
	EditLabel(ctx context.Context, user, repo, currentName, name string, label LabelConfig) error
	DeleteLabel(ctx context.Context, user, repo, name string) error
}

GitRepository repository for git api

type GithubRepositoryImpl

type GithubRepositoryImpl struct {
	// contains filtered or unexported fields
}

GithubRepositoryImpl repository for github api

func NewGithubRepository

func NewGithubRepository(token string) *GithubRepositoryImpl

NewGithubRepository GithubRepository constructor

func (GithubRepositoryImpl) CreateLabel

func (r GithubRepositoryImpl) CreateLabel(ctx context.Context, user, repo, name string, label LabelConfig) error

CreateLabel create label on 'user/repository'

func (GithubRepositoryImpl) DeleteLabel

func (r GithubRepositoryImpl) DeleteLabel(ctx context.Context, user, repo, name string) error

DeleteLabel delete label from 'user/repository'

func (GithubRepositoryImpl) EditLabel

func (r GithubRepositoryImpl) EditLabel(ctx context.Context, user, repo, currentName, name string, label LabelConfig) error

EditLabel edit label from 'user/repository'

func (GithubRepositoryImpl) ListLabels

func (r GithubRepositoryImpl) ListLabels(ctx context.Context, user, repo string) ([]string, error)

ListLabels list all labels from 'user/repository'

func (GithubRepositoryImpl) ListORGRepos

func (r GithubRepositoryImpl) ListORGRepos(ctx context.Context, org string) ([]*github.Repository, error)

ListORGRepos list all repositories from organization

func (GithubRepositoryImpl) ListOwnerRepos

func (r GithubRepositoryImpl) ListOwnerRepos(ctx context.Context, owner string) ([]*github.Repository, error)

ListOwnerRepos list all repositories from owner

type LabelConfig

type LabelConfig struct {
	Color       string `yaml:"color"`
	Description string `yaml:"description"`
}

LabelConfig config for label

type Service

type Service struct {
	// contains filtered or unexported fields
}

Service rules for gitlabel

func NewService

func NewService(git GitRepository, logger *log.Logger) *Service

NewService service constructor

func (Service) Exec

func (s Service) Exec(ctx context.Context, cfg Config) error

Exec execute gitlabel functions based on config

Jump to

Keyboard shortcuts

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