client

package
v1.18.2 Latest Latest
Warning

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

Go to latest
Published: May 7, 2023 License: MIT Imports: 25 Imported by: 0

Documentation

Overview

Package client contains the client implementations for several providers.

Index

Constants

View Source
const DefaulGitSSHCommand = `ssh -i "{{ .KeyPath }}" -o StrictHostKeyChecking=accept-new -F /dev/null`

DefaulGitSSHCommand used for git over SSH.

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

func TemplateRef added in v1.13.0

func TemplateRef(apply func(s string) (string, error), ref config.RepoRef) (config.RepoRef, error)

TemplateRef templates a config.RepoFromRef

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)
	Upload(ctx *context.Context, releaseID string, artifact *artifact.Artifact, file *os.File) (err error)
	Changelog(ctx *context.Context, repo Repo, prev, current string) (string, error)
	ReleaserURLTemplater
	FileCreator
}

Client interface.

func New added in v0.112.0

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

New creates a new client depending on the token type.

func NewIfToken added in v0.180.0

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

type ErrNoMilestoneFound added in v0.140.0

type ErrNoMilestoneFound struct {
	Title string
}

ErrNoMilestoneFound is an error when no milestone is found.

func (ErrNoMilestoneFound) Error added in v0.140.0

func (e ErrNoMilestoneFound) Error() string

type FileCreator added in v1.18.0

type FileCreator interface {
	CreateFile(ctx *context.Context, commitAuthor config.CommitAuthor, repo Repo, content []byte, path, message string) (err error)
}

FileCreator can create the given file to some code repository.

func NewGitUploadClient added in v1.18.0

func NewGitUploadClient(branch string) FileCreator

NewGitUploadClient

type Info

type Info struct {
	Description string
	Homepage    string
	URL         string
}

Info of the repository.

type Mock added in v0.181.0

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
	ReleaseNotesParams   []string
	OpenedPullRequest    bool
}

func NewMock added in v0.181.0

func NewMock() *Mock

func (*Mock) Changelog added in v0.181.0

func (c *Mock) Changelog(_ *context.Context, _ Repo, _, _ string) (string, error)

func (*Mock) CloseMilestone added in v0.181.0

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

func (*Mock) CreateFile added in v0.181.0

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

func (*Mock) CreateRelease added in v0.181.0

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

func (*Mock) GenerateReleaseNotes added in v1.0.0

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

func (*Mock) OpenPullRequest added in v1.17.0

func (c *Mock) OpenPullRequest(_ *context.Context, _ Repo, _, _ string) error

func (*Mock) ReleaseURLTemplate added in v0.181.0

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

func (*Mock) Upload added in v0.181.0

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

type PullRequestOpener added in v1.17.0

type PullRequestOpener interface {
	OpenPullRequest(ctx *context.Context, repo Repo, head, title string) error
}

PullRequestOpener can open pull requests.

type ReleaseNotesGenerator added in v1.17.0

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

ReleaseNotesGenerator can generate release notes.

func NewGitHubReleaseNotesGenerator added in v1.17.0

func NewGitHubReleaseNotesGenerator(ctx *context.Context, token string) (ReleaseNotesGenerator, error)

NewGitHubReleaseNotesGenerator returns a GitHub client that can generate changelogs.

type ReleaserURLTemplater added in v1.18.0

type ReleaserURLTemplater interface {
	ReleaseURLTemplate(ctx *context.Context) (string, error)
}

ReleaserURLTemplater provides the release URL as a template, containing the artifact name as well.

type Repo added in v0.139.0

type Repo struct {
	Owner         string
	Name          string
	Branch        string
	GitURL        string
	GitSSHCommand string
	PrivateKey    string
}

func RepoFromRef added in v0.139.0

func RepoFromRef(ref config.RepoRef) Repo

RepoFromRef converts a config.RepoRef into a Repo.

func (Repo) String added in v0.139.0

func (r Repo) String() string

type RetriableError added in v0.130.0

type RetriableError struct {
	Err error
}

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

func (RetriableError) Error added in v0.130.0

func (e RetriableError) Error() string

Jump to

Keyboard shortcuts

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