Documentation ¶
Overview ¶
Package client contains the client implementations for several providers.
Index ¶
- Constants
- Variables
- func TemplateRef(apply func(s string) (string, error), ref config.RepoRef) (config.RepoRef, error)
- type Client
- type ErrNoMilestoneFound
- type FileCreator
- type FilesCreator
- type Info
- type Mock
- func (c *Mock) Changelog(_ *context.Context, _ Repo, _, _ string) (string, error)
- func (c *Mock) CloseMilestone(_ *context.Context, _ Repo, title string) error
- func (c *Mock) CreateFile(_ *context.Context, _ config.CommitAuthor, _ Repo, content []byte, ...) error
- func (c *Mock) CreateRelease(_ *context.Context, _ string) (string, error)
- func (c *Mock) GenerateReleaseNotes(_ *context.Context, _ Repo, prev, current string) (string, error)
- func (c *Mock) OpenPullRequest(_ *context.Context, _, _ Repo, _ string, _ bool) error
- func (c *Mock) ReleaseURLTemplate(_ *context.Context) (string, error)
- func (c *Mock) Upload(_ *context.Context, _ string, artifact *artifact.Artifact, file *os.File) error
- type PullRequestOpener
- type ReleaseNotesGenerator
- type ReleaseURLTemplater
- type Repo
- type RepoFile
- type RetriableError
Constants ¶
const DefaulGitSSHCommand = `ssh -i "{{ .KeyPath }}" -o StrictHostKeyChecking=accept-new -F /dev/null`
DefaulGitSSHCommand used for git over SSH.
const DefaultGitHubDownloadURL = "https://github.com"
const DefaultGitLabDownloadURL = "https://gitlab.com"
Variables ¶
var ErrNotImplemented = fmt.Errorf("not implemented")
ErrNotImplemented is returned when a client does not implement certain feature.
var ErrReleaseDisabled = fmt.Errorf("release is disabled, cannot use default url_template")
ErrReleaseDisabled happens when a configuration tries to use the default url_template even though the release is disabled.
Functions ¶
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) ReleaseURLTemplater FileCreator }
Client interface.
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.
type FilesCreator ¶ added in v1.19.0
type FilesCreator interface { FileCreator CreateFiles(ctx *context.Context, commitAuthor config.CommitAuthor, repo Repo, message string, files []RepoFile) (err error) }
FilesCreator can create the multiple files in some repository and in a single commit.
func NewGitUploadClient ¶ added in v1.18.0
func NewGitUploadClient(branch string) FilesCreator
NewGitUploadClient
type Mock ¶ added in v0.181.0
type Mock struct { CreatedFile bool Content string Path string Messages []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 (*Mock) CloseMilestone ¶ added in v0.181.0
func (*Mock) CreateFile ¶ added in v0.181.0
func (*Mock) CreateRelease ¶ added in v0.181.0
func (*Mock) GenerateReleaseNotes ¶ added in v1.0.0
func (*Mock) OpenPullRequest ¶ added in v1.17.0
func (*Mock) ReleaseURLTemplate ¶ added in v0.181.0
type PullRequestOpener ¶ added in v1.17.0
type PullRequestOpener interface {
OpenPullRequest(ctx *context.Context, base, head Repo, title string, draft bool) 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 ReleaseURLTemplater ¶ added in v1.21.0
ReleaseURLTemplater provides the release URL as a template, containing the artifact name as well.
func NewReleaseClient ¶ added in v1.21.0
func NewReleaseClient(ctx *context.Context) (ReleaseURLTemplater, error)
NewReleaseClient returns a ReleaserURLTemplater, handling the possibility of the release being disabled.
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
RepoFromRef converts a config.RepoRef into a Repo.
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