src

package
v0.0.0-...-9141ea7 Latest Latest
Warning

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

Go to latest
Published: Apr 25, 2024 License: MIT Imports: 14 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	NwoRegExp        = regexp.MustCompile(`^[^/\s]+/[^/\s]+$`)
	ErrEmptyRepoList = errors.New("repo list cannot be empty")
	ErrEmptyCacheDir = errors.New("cache directory contains no actions to sync")
)

Functions

func GetImpersonationToken

func GetImpersonationToken(ctx context.Context, flags *PushFlags) (string, error)

func Pull

func Pull(ctx context.Context, flags *PullFlags) error

func PullManyWithGitImpl

func PullManyWithGitImpl(ctx context.Context, sourceURL, cacheDir string, repoNames []string, gitimpl GitImplementation) error

func PullWithGitImpl

func PullWithGitImpl(ctx context.Context, sourceURL, cacheDir string, repoName string, gitimpl GitImplementation) error

func Push

func Push(ctx context.Context, flags *PushFlags) error

func PushManyWithGitImpl

func PushManyWithGitImpl(ctx context.Context, flags *PushFlags, repoNames []string, ghClient *github.Client, gitimpl GitImplementation) error

func PushWithGitImpl

func PushWithGitImpl(ctx context.Context, flags *PushFlags, repoName string, ghClient *github.Client, gitimpl GitImplementation) error

func Sync

func Sync(ctx context.Context, flags *SyncFlags) error

Types

type CommonFlags

type CommonFlags struct {
	CacheDir, RepoName, RepoNameList, RepoNameListFile string
}

flags common to pull, push and sync operations

func (*CommonFlags) HasAtLeastOneRepoFlag

func (f *CommonFlags) HasAtLeastOneRepoFlag() bool

func (*CommonFlags) Init

func (f *CommonFlags) Init(cmd *cobra.Command)

func (*CommonFlags) Validate

func (f *CommonFlags) Validate(reposRequired bool) Validations

type GitImplementation

type GitImplementation interface {
	NewGitRepository(dir string) (GitRepository, error)
	CloneRepository(dir string, o *git.CloneOptions) (GitRepository, error)
	RepositoryExists(dir string) bool
}

type GitRemote

type GitRemote interface {
	PushContext(context.Context, *git.PushOptions) error
	Config() *config.RemoteConfig
}

type GitRepository

type GitRepository interface {
	DeleteRemote(string) error
	CreateRemote(*config.RemoteConfig) (GitRemote, error)
	FetchContext(context.Context, *git.FetchOptions) error
}

type PullFlags

type PullFlags struct {
	CommonFlags
	PullOnlyFlags
}

func (*PullFlags) Init

func (f *PullFlags) Init(cmd *cobra.Command)

func (*PullFlags) Validate

func (f *PullFlags) Validate() Validations

type PullOnlyFlags

type PullOnlyFlags struct {
	SourceURL string
}

func (*PullOnlyFlags) Init

func (f *PullOnlyFlags) Init(cmd *cobra.Command)

func (*PullOnlyFlags) Validate

func (f *PullOnlyFlags) Validate() Validations

type PushFlags

type PushFlags struct {
	CommonFlags
	PushOnlyFlags
}

func (*PushFlags) Init

func (f *PushFlags) Init(cmd *cobra.Command)

func (*PushFlags) Validate

func (f *PushFlags) Validate() Validations

type PushOnlyFlags

type PushOnlyFlags struct {
	BaseURL, Token, ActionsAdminUser string
	DisableGitAuth                   bool
}

func (*PushOnlyFlags) Init

func (f *PushOnlyFlags) Init(cmd *cobra.Command)

func (*PushOnlyFlags) Validate

func (f *PushOnlyFlags) Validate() Validations

type SyncFlags

type SyncFlags struct {
	CommonFlags
	PullOnlyFlags
	PushOnlyFlags
}

func (*SyncFlags) Init

func (f *SyncFlags) Init(cmd *cobra.Command)

func (*SyncFlags) Validate

func (f *SyncFlags) Validate() Validations

type Validations

type Validations []string

func (Validations) Error

func (v Validations) Error() error

func (Validations) Join

Jump to

Keyboard shortcuts

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