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 ChangelogItem
- type Client
- type ErrNoMilestoneFound
- type FileCreator
- type FilesCreator
- type ForkSyncer
- type Info
- type Mock
- func (c *Mock) Changelog(_ *context.Context, _ Repo, _, _ string) ([]ChangelogItem, 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) PublishRelease(_ *context.Context, _ string) (err error)
- func (c *Mock) ReleaseURLTemplate(_ *context.Context) (string, error)
- func (c *Mock) SyncFork(_ *context.Context, _ Repo, _ Repo) 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 DefaultGitHubDownloadURL = "https://github.com"
const DefaultGitLabDownloadURL = "https://gitlab.com"
const DefaultGitSSHCommand = `ssh -i "{{ .KeyPath }}" -o StrictHostKeyChecking=accept-new -F /dev/null`
DefaultGitSSHCommand used for git over SSH.
Variables ¶
var ErrNotImplemented = errors.New("not implemented")
ErrNotImplemented is returned when a client does not implement certain feature.
var ErrReleaseDisabled = errors.New("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 ChangelogItem ¶
type ChangelogItem struct {
SHA string
Message string
AuthorName string
AuthorEmail string
AuthorUsername string
}
ChangelogItem represents a changelog item, basically, a commit and its author.
type Client ¶
type Client interface {
CloseMilestone(ctx *context.Context, repo Repo, title string) (err error)
// Creates a release. It's marked as draft if possible (should call PublishRelease to finish publishing).
CreateRelease(ctx *context.Context, body string) (releaseID string, err error)
PublishRelease(ctx *context.Context, 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) ([]ChangelogItem, error)
ReleaseURLTemplater
FileCreator
}
Client interface.
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 FileCreator ¶
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 ¶
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 ¶
func NewGitUploadClient(branch string) FilesCreator
NewGitUploadClient creates a new git client.
type ForkSyncer ¶
ForkSyncer can sync forks.
type Mock ¶
type Mock struct {
CreatedFile bool
Content string
Path string
Messages []string
FailToCreateRelease bool
FailToUpload bool
CreatedRelease bool
UploadedFile bool
ReleasePublished bool
UploadedFileNames []string
UploadedFilePaths map[string]string
FailFirstUpload bool
Lock sync.Mutex
ClosedMilestone string
FailToCloseMilestone bool
Changes []ChangelogItem
ReleaseNotes string
ReleaseNotesParams []string
OpenedPullRequest bool
SyncedFork bool
}
func (*Mock) CloseMilestone ¶
func (*Mock) CreateFile ¶
func (*Mock) CreateRelease ¶
func (*Mock) GenerateReleaseNotes ¶
func (*Mock) OpenPullRequest ¶
func (*Mock) PublishRelease ¶
func (*Mock) ReleaseURLTemplate ¶
type PullRequestOpener ¶
type PullRequestOpener interface {
OpenPullRequest(ctx *context.Context, base, head Repo, title string, draft bool) error
}
PullRequestOpener can open pull requests.
type ReleaseNotesGenerator ¶
type ReleaseNotesGenerator interface {
GenerateReleaseNotes(ctx *context.Context, repo Repo, prev, current string) (string, error)
}
ReleaseNotesGenerator can generate release notes.
func NewGitHubReleaseNotesGenerator ¶
func NewGitHubReleaseNotesGenerator(ctx *context.Context, token string) (ReleaseNotesGenerator, error)
NewGitHubReleaseNotesGenerator returns a GitHub client that can generate changelogs.
type ReleaseURLTemplater ¶
ReleaseURLTemplater provides the release URL as a template, containing the artifact name as well.
func NewReleaseClient ¶
func NewReleaseClient(ctx *context.Context) (ReleaseURLTemplater, error)
NewReleaseClient returns a ReleaserURLTemplater, handling the possibility of the release being disabled.
type Repo ¶
type Repo struct {
Owner string
Name string
Branch string
GitURL string
GitSSHCommand string
PrivateKey string
}
func RepoFromRef ¶
RepoFromRef converts a config.RepoRef into a Repo.
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