Documentation
¶
Overview ¶
Package vcs handles version control system stuff.
Index ¶
- func NewTestModuleRepo(provider, name string) string
- func NewTestRepo() string
- type Action
- type Broker
- type Callback
- type Client
- type Commit
- type CommitAuthor
- type CreateWebhookOptions
- type DeleteWebhookOptions
- type ErrIgnoreEvent
- type Event
- type EventHeader
- type EventPayload
- type EventType
- type GetRepoTarballOptions
- type GetWebhookOptions
- type Kind
- type ListRepositoriesOptions
- type ListTagsOptions
- type NewTokenClientOptions
- type Publisher
- type Repository
- type SetStatusOptions
- type Status
- type Subscriber
- type UpdateWebhookOptions
- type Webhook
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func NewTestModuleRepo ¶
func NewTestRepo ¶
func NewTestRepo() string
Types ¶
type Broker ¶
type Broker struct {
// contains filtered or unexported fields
}
Broker is a brokerage for publishers and subscribers of VCS events.
type Client ¶
type Client interface {
// ListRepositories lists repositories accessible to the current user.
ListRepositories(ctx context.Context, opts ListRepositoriesOptions) ([]string, error)
GetRepository(ctx context.Context, identifier string) (Repository, error)
// GetRepoTarball retrieves a .tar.gz tarball of a git repository
GetRepoTarball(ctx context.Context, opts GetRepoTarballOptions) ([]byte, string, error)
// CreateWebhook creates a webhook on the cloud provider, returning the
// provider's unique ID for the webhook.
CreateWebhook(ctx context.Context, opts CreateWebhookOptions) (string, error)
UpdateWebhook(ctx context.Context, id string, opts UpdateWebhookOptions) error
GetWebhook(ctx context.Context, opts GetWebhookOptions) (Webhook, error)
DeleteWebhook(ctx context.Context, opts DeleteWebhookOptions) error
SetStatus(ctx context.Context, opts SetStatusOptions) error
// ListTags lists git tags on a repository. Each tag should be prefixed with
// 'tags/'.
ListTags(ctx context.Context, opts ListTagsOptions) ([]string, error)
// ListPullRequestFiles returns the paths of files that are modified in the pull request
ListPullRequestFiles(ctx context.Context, repo string, pull int) ([]string, error)
// GetCommit retrieves commit from the repo with the given git ref
GetCommit(ctx context.Context, repo, ref string) (Commit, error)
}
type Commit ¶
type Commit struct {
SHA string
URL string
Author CommitAuthor
}
type CommitAuthor ¶
type CreateWebhookOptions ¶
type DeleteWebhookOptions ¶
type DeleteWebhookOptions struct {
Repo string // Repository identifier, <owner>/<repo>
ID string // vcs' webhook ID
}
DeleteWebhookOptions are options for deleting a webhook.
type ErrIgnoreEvent ¶ added in v0.2.3
type ErrIgnoreEvent struct {
Reason string
}
ErrIgnoreEvent informs an upstream vcs provider why an event it sent is ignored.
func NewErrIgnoreEvent ¶ added in v0.2.3
func NewErrIgnoreEvent(msg string, args ...any) ErrIgnoreEvent
func (ErrIgnoreEvent) Error ¶ added in v0.2.3
func (e ErrIgnoreEvent) Error() string
type Event ¶
type Event struct {
EventHeader
EventPayload
}
Event is a VCS event received from a cloud, e.g. a commit event from github
type EventHeader ¶
type EventPayload ¶
type EventPayload struct {
RepoPath string
VCSKind Kind
Type EventType
Action Action
Tag string
CommitSHA string
CommitURL string
Branch string // head branch
DefaultBranch string
PullRequestNumber int
PullRequestURL string
PullRequestTitle string
SenderUsername string
SenderAvatarURL string
SenderHTMLURL string
// Paths of files that have been added/modified/removed. Only applicable
// to Push and Tag events types.
Paths []string
// Only set if event is from a github app
GithubAppInstallID *int64
}
func (EventPayload) Validate ¶
func (e EventPayload) Validate() error
type GetRepoTarballOptions ¶
type GetWebhookOptions ¶
type GetWebhookOptions struct {
Repo string // Repository identifier, <owner>/<repo>
ID string // vcs' webhook ID
}
GetWebhookOptions are options for retrieving a webhook.
type ListRepositoriesOptions ¶
type ListRepositoriesOptions struct {
PageSize int
}
type ListTagsOptions ¶
type ListTagsOptions struct {
Repo string // repo identifier, <owner>/<repo>
Prefix string // only list tags that start with this string
}
ListTagsOptions are options for listing tags on a vcs repository
type NewTokenClientOptions ¶
NewTokenClientOptions are options for creating a client using a personal access token (PAT).
type Repository ¶
type SetStatusOptions ¶
type SetStatusOptions struct {
Workspace string // workspace name
Repo string // <owner>/<repo>
Ref string // git ref
Status Status
TargetURL string
Description string
}
SetStatusOptions are options for setting a status on a VCS repo
type Subscriber ¶
type Subscriber interface {
Subscribe(cb Callback)
}
type UpdateWebhookOptions ¶
type UpdateWebhookOptions CreateWebhookOptions
Click to show internal directories.
Click to hide internal directories.