client

package
v1.12.5 Latest Latest
Warning

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

Go to latest
Published: Oct 24, 2022 License: MIT Imports: 22 Imported by: 0

Documentation

Overview

Package client contains the client implementations for several providers.

Index

Constants

View Source
const DefaultGitHubDownloadURL = "https://github.com"
View Source
const DefaultGitLabDownloadURL = "https://gitlab.com"

Variables

View Source
var ErrNotImplemented = fmt.Errorf("not implemented")

ErrNotImplemented is returned when a client does not implement certain feature.

Functions

This section is empty.

Types

type Client

type Client interface {
	CloseMilestone(ctx *context.Context, repo Repo, title string) (err error)
	CreateRelease(ctx *context.Context, body string) (releaseID string, err error)
	ReleaseURLTemplate(ctx *context.Context) (string, error)
	CreateFile(ctx *context.Context, commitAuthor config.CommitAuthor, repo Repo, content []byte, path, message string) (err error)
	Upload(ctx *context.Context, releaseID string, artifact *artifact.Artifact, file *os.File) (err error)
	GetDefaultBranch(ctx *context.Context, repo Repo) (string, error)
	Changelog(ctx *context.Context, repo Repo, prev, current string) (string, error)
}

Client interface.

func New

func New(ctx *context.Context) (Client, error)

New creates a new client depending on the token type.

func NewGitLab

func NewGitLab(ctx *context.Context, token string) (Client, error)

NewGitLab returns a gitlab client implementation.

func NewGitea

func NewGitea(ctx *context.Context, token string) (Client, error)

NewGitea returns a gitea client implementation.

func NewIfToken

func NewIfToken(ctx *context.Context, cli Client, token string) (Client, error)

type ErrNoMilestoneFound

type ErrNoMilestoneFound struct {
	Title string
}

ErrNoMilestoneFound is an error when no milestone is found.

func (ErrNoMilestoneFound) Error

func (e ErrNoMilestoneFound) Error() string

type GitHubClient

type GitHubClient interface {
	Client
	GenerateReleaseNotes(ctx *context.Context, repo Repo, prev, current string) (string, error)
}

GitHubClient is the client with GitHub-only features.

func NewGitHub

func NewGitHub(ctx *context.Context, token string) (GitHubClient, error)

NewGitHub returns a github client implementation.

type Info

type Info struct {
	Description string
	Homepage    string
	URL         string
}

Info of the repository.

type Mock

type Mock struct {
	CreatedFile          bool
	Content              string
	Path                 string
	FailToCreateRelease  bool
	FailToUpload         bool
	CreatedRelease       bool
	UploadedFile         bool
	UploadedFileNames    []string
	UploadedFilePaths    map[string]string
	FailFirstUpload      bool
	Lock                 sync.Mutex
	ClosedMilestone      string
	FailToCloseMilestone bool
	Changes              string
	ReleaseNotes         string
}

func NewMock

func NewMock() *Mock

func (*Mock) Changelog

func (c *Mock) Changelog(ctx *context.Context, repo Repo, prev, current string) (string, error)

func (*Mock) CloseMilestone

func (c *Mock) CloseMilestone(ctx *context.Context, repo Repo, title string) error

func (*Mock) CreateFile

func (c *Mock) CreateFile(ctx *context.Context, commitAuthor config.CommitAuthor, repo Repo, content []byte, path, msg string) error

func (*Mock) CreateRelease

func (c *Mock) CreateRelease(ctx *context.Context, body string) (string, error)

func (*Mock) GenerateReleaseNotes

func (c *Mock) GenerateReleaseNotes(ctx *context.Context, repo Repo, prev, current string) (string, error)

func (*Mock) GetDefaultBranch

func (c *Mock) GetDefaultBranch(ctx *context.Context, repo Repo) (string, error)

func (*Mock) ReleaseURLTemplate

func (c *Mock) ReleaseURLTemplate(ctx *context.Context) (string, error)

func (*Mock) Upload

func (c *Mock) Upload(ctx *context.Context, releaseID string, artifact *artifact.Artifact, file *os.File) error

type Repo

type Repo struct {
	Owner  string
	Name   string
	Branch string
}

func RepoFromRef

func RepoFromRef(ref config.RepoRef) Repo

func (Repo) String

func (r Repo) String() string

type RetriableError

type RetriableError struct {
	Err error
}

RetriableError is an error that will cause the action to be retried.

func (RetriableError) Error

func (e RetriableError) Error() string

Jump to

Keyboard shortcuts

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