Documentation
¶
Index ¶
- Constants
- func FromURL(repoURL string, options ...ProviderOption) (Provider, Repository, error)
- type Change
- type Comment
- type GitHubAppConfig
- type GitHubProvider
- func (p *GitHubProvider) AddCommentToPullRequest(ctx context.Context, pr PullRequest, body []byte) (*Comment, error)
- func (p *GitHubProvider) GetLastComments(ctx context.Context, pr PullRequest, since time.Time) ([]*Comment, error)
- func (p *GitHubProvider) ListPullRequestChanges(ctx context.Context, pr PullRequest) ([]Change, error)
- func (p *GitHubProvider) ListPullRequests(ctx context.Context, repo Repository) ([]PullRequest, error)
- func (p *GitHubProvider) SetHostname(hostname string) error
- func (p *GitHubProvider) SetLogger(log logr.Logger) error
- func (p *GitHubProvider) SetToken(tokenType, token string) error
- func (p *GitHubProvider) Setup() error
- func (p *GitHubProvider) UpdateCommentOfPullRequest(ctx context.Context, pr PullRequest, commentID int, body []byte) error
- type GitLabOAuthConfig
- type GitLabProvider
- func (p *GitLabProvider) AddCommentToPullRequest(ctx context.Context, pr PullRequest, body []byte) (*Comment, error)
- func (p *GitLabProvider) GetLastComments(ctx context.Context, pr PullRequest, since time.Time) ([]*Comment, error)
- func (p *GitLabProvider) ListPullRequestChanges(ctx context.Context, pr PullRequest) ([]Change, error)
- func (p *GitLabProvider) ListPullRequests(ctx context.Context, repo Repository) ([]PullRequest, error)
- func (p *GitLabProvider) SetHostname(hostname string) error
- func (p *GitLabProvider) SetLogger(log logr.Logger) error
- func (p *GitLabProvider) SetToken(tokenType, token string) error
- func (p *GitLabProvider) Setup() error
- func (p *GitLabProvider) UpdateCommentOfPullRequest(ctx context.Context, pr PullRequest, commentID int, body []byte) error
- type Provider
- type ProviderOption
- func OptsFromSecret(data map[string][]byte) ([]ProviderOption, error)
- func WithDomain(domain string) ProviderOption
- func WithGitHubApp(cfg GitHubAppConfig) ProviderOption
- func WithGitLabOAuth(cfg GitLabOAuthConfig) ProviderOption
- func WithLogger(log logr.Logger) ProviderOption
- func WithSCMOAuth(cfg SCMOAuthConfig) ProviderOption
- func WithToken(tokenType, token string) ProviderOption
- type ProviderType
- type PullRequest
- type Repository
- type SCMOAuthConfig
- type URLParserFn
Constants ¶
View Source
const ( ProviderGitHub = ProviderType(giturlapis.ProviderGitHub) ProviderGitlab = ProviderType(giturlapis.ProviderGitLab) ProviderBitbucket = ProviderType(giturlapis.ProviderBitBucket) ProviderAzure = ProviderType(giturlapis.ProviderAzure) ProviderBitbucketServer = ProviderType("bitbucketserver") ProviderGitea = ProviderType("gitea") )
View Source
const (
APITokenType = "api-token"
)
Variables ¶
This section is empty.
Functions ¶
func FromURL ¶
func FromURL(repoURL string, options ...ProviderOption) (Provider, Repository, error)
Types ¶
type GitHubAppConfig ¶ added in v0.16.4
GitHubAppConfig holds the configuration for GitHub App authentication.
type GitHubProvider ¶
type GitHubProvider struct {
// contains filtered or unexported fields
}
func (*GitHubProvider) AddCommentToPullRequest ¶
func (p *GitHubProvider) AddCommentToPullRequest(ctx context.Context, pr PullRequest, body []byte) (*Comment, error)
func (*GitHubProvider) GetLastComments ¶
func (p *GitHubProvider) GetLastComments(ctx context.Context, pr PullRequest, since time.Time) ([]*Comment, error)
func (*GitHubProvider) ListPullRequestChanges ¶
func (p *GitHubProvider) ListPullRequestChanges(ctx context.Context, pr PullRequest) ([]Change, error)
func (*GitHubProvider) ListPullRequests ¶
func (p *GitHubProvider) ListPullRequests(ctx context.Context, repo Repository) ([]PullRequest, error)
func (*GitHubProvider) SetHostname ¶
func (p *GitHubProvider) SetHostname(hostname string) error
func (*GitHubProvider) SetToken ¶
func (p *GitHubProvider) SetToken(tokenType, token string) error
func (*GitHubProvider) Setup ¶
func (p *GitHubProvider) Setup() error
func (*GitHubProvider) UpdateCommentOfPullRequest ¶
func (p *GitHubProvider) UpdateCommentOfPullRequest(ctx context.Context, pr PullRequest, commentID int, body []byte) error
type GitLabOAuthConfig ¶ added in v0.16.4
type GitLabOAuthConfig struct {
ClientID string
ClientSecret string
Token string
RefreshToken string
}
GitLabOAuthConfig holds the configuration for GitLab OAuth2 authentication with automatic token refresh.
type GitLabProvider ¶ added in v0.16.4
type GitLabProvider struct {
// contains filtered or unexported fields
}
func (*GitLabProvider) AddCommentToPullRequest ¶ added in v0.16.4
func (p *GitLabProvider) AddCommentToPullRequest(ctx context.Context, pr PullRequest, body []byte) (*Comment, error)
func (*GitLabProvider) GetLastComments ¶ added in v0.16.4
func (p *GitLabProvider) GetLastComments(ctx context.Context, pr PullRequest, since time.Time) ([]*Comment, error)
func (*GitLabProvider) ListPullRequestChanges ¶ added in v0.16.4
func (p *GitLabProvider) ListPullRequestChanges(ctx context.Context, pr PullRequest) ([]Change, error)
func (*GitLabProvider) ListPullRequests ¶ added in v0.16.4
func (p *GitLabProvider) ListPullRequests(ctx context.Context, repo Repository) ([]PullRequest, error)
func (*GitLabProvider) SetHostname ¶ added in v0.16.4
func (p *GitLabProvider) SetHostname(hostname string) error
func (*GitLabProvider) SetLogger ¶ added in v0.16.4
func (p *GitLabProvider) SetLogger(log logr.Logger) error
func (*GitLabProvider) SetToken ¶ added in v0.16.4
func (p *GitLabProvider) SetToken(tokenType, token string) error
func (*GitLabProvider) Setup ¶ added in v0.16.4
func (p *GitLabProvider) Setup() error
func (*GitLabProvider) UpdateCommentOfPullRequest ¶ added in v0.16.4
func (p *GitLabProvider) UpdateCommentOfPullRequest(ctx context.Context, pr PullRequest, commentID int, body []byte) error
type Provider ¶
type Provider interface {
ListPullRequests(ctx context.Context, repo Repository) ([]PullRequest, error)
AddCommentToPullRequest(ctx context.Context, repo PullRequest, body []byte) (*Comment, error)
GetLastComments(ctx context.Context, pr PullRequest, since time.Time) ([]*Comment, error)
UpdateCommentOfPullRequest(ctx context.Context, pr PullRequest, commentID int, body []byte) error
ListPullRequestChanges(ctx context.Context, pr PullRequest) ([]Change, error)
SetLogger(logr.Logger) error
SetToken(tokenType, token string) error
SetHostname(hostname string) error
Setup() error
}
func New ¶
func New(provider ProviderType, options ...ProviderOption) (Provider, error)
type ProviderOption ¶
func OptsFromSecret ¶ added in v0.16.4
func OptsFromSecret(data map[string][]byte) ([]ProviderOption, error)
OptsFromSecret builds provider options from a Kubernetes Secret's data map. It detects the auth type based on which keys are present:
- "githubAppID" + "githubAppInstallationID" + "githubAppPrivateKey": GitHub App auth
- "gitlabOAuthClientID" + "gitlabOAuthClientSecret" + "gitlabOAuthRefreshToken": GitLab OAuth2 with auto-refresh
- "token": API token auth (PAT, Project/Group Access Token, etc.)
func WithDomain ¶
func WithDomain(domain string) ProviderOption
func WithGitHubApp ¶ added in v0.16.4
func WithGitHubApp(cfg GitHubAppConfig) ProviderOption
func WithGitLabOAuth ¶ added in v0.16.4
func WithGitLabOAuth(cfg GitLabOAuthConfig) ProviderOption
func WithLogger ¶
func WithLogger(log logr.Logger) ProviderOption
func WithSCMOAuth ¶ added in v0.16.4
func WithSCMOAuth(cfg SCMOAuthConfig) ProviderOption
func WithToken ¶
func WithToken(tokenType, token string) ProviderOption
type ProviderType ¶
type ProviderType string
type PullRequest ¶
type Repository ¶
func RepoFromURL ¶ added in v0.16.4
func RepoFromURL(repoURL string) (Repository, error)
RepoFromURL parses a repository URL and returns the Repository without creating a provider. This is useful when the provider is already cached.
func (Repository) String ¶
func (r Repository) String() string
type SCMOAuthConfig ¶ added in v0.16.4
SCMOAuthConfig holds OAuth2 credentials for generic SCM providers (Bitbucket Cloud, Gitea) that support the refresh token grant.
type URLParserFn ¶
type URLParserFn = func(repoURL string, options ...ProviderOption) (Provider, Repository, error)
Source Files
¶
Click to show internal directories.
Click to hide internal directories.