Documentation
¶
Index ¶
- func GetClient(ctx context.Context, scmProvider v1alpha1.GenericScmProvider, secret v1.Secret, ...) (*github.Client, *ghinstallation.Transport, error)
- type CommitStatus
- type GitAuthenticationProvider
- type PullRequest
- func (pr *PullRequest) Close(ctx context.Context, pullRequest v1alpha1.PullRequest) error
- func (pr *PullRequest) Create(ctx context.Context, title, head, base, description string, ...) (string, error)
- func (pr *PullRequest) FindOpen(ctx context.Context, pullRequest v1alpha1.PullRequest) (bool, string, time.Time, error)
- func (pr *PullRequest) GetUrl(ctx context.Context, pullRequest v1alpha1.PullRequest) (string, error)
- func (pr *PullRequest) Merge(ctx context.Context, pullRequest v1alpha1.PullRequest) error
- func (pr *PullRequest) Update(ctx context.Context, title, description string, ...) error
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func GetClient ¶
func GetClient(ctx context.Context, scmProvider v1alpha1.GenericScmProvider, secret v1.Secret, org string) (*github.Client, *ghinstallation.Transport, error)
GetClient retrieves a GitHub client for the specified organization using the provided SCM provider and secret. We return a client for API calls and a transport that gets used for git operations via GitAuthenticationProvider.
Types ¶
type CommitStatus ¶
type CommitStatus struct {
// contains filtered or unexported fields
}
CommitStatus implements the scms.CommitStatusProvider interface for GitHub. It uses GitHub's CheckRun API.
func NewGithubCommitStatusProvider ¶
func NewGithubCommitStatusProvider(ctx context.Context, k8sClient client.Client, scmProvider promoterv1alpha1.GenericScmProvider, secret v1.Secret, org string) (*CommitStatus, error)
NewGithubCommitStatusProvider creates a new instance of CommitStatus for GitHub. It initializes the GitHub client using the provided SCM provider configuration and secret.
func (*CommitStatus) Set ¶
func (cs *CommitStatus) Set(ctx context.Context, commitStatus *promoterv1alpha1.CommitStatus) (*promoterv1alpha1.CommitStatus, error)
Set sets the commit status for a given commit SHA in the specified repository using GitHub Checks API. If the SHA hasn't changed and we have an existing check run ID, it will update the existing check run. Otherwise, it creates a new check run.
type GitAuthenticationProvider ¶
type GitAuthenticationProvider struct {
// contains filtered or unexported fields
}
GitAuthenticationProvider provides methods to authenticate with GitHub using a GitHub App.
func NewGithubGitAuthenticationProvider ¶
func NewGithubGitAuthenticationProvider(ctx context.Context, k8sClient client.Client, scmProvider v1alpha1.GenericScmProvider, secret *v1.Secret, repoRef client.ObjectKey) (GitAuthenticationProvider, error)
NewGithubGitAuthenticationProvider creates a new instance of GitAuthenticationProvider for GitHub using the provided SCM provider and secret.
func (GitAuthenticationProvider) GetGitHttpsRepoUrl ¶
func (gh GitAuthenticationProvider) GetGitHttpsRepoUrl(gitRepository v1alpha1.GitRepository) string
GetGitHttpsRepoUrl constructs the HTTPS URL for a GitHub repository based on the provided GitRepository object.
type PullRequest ¶
type PullRequest struct {
// contains filtered or unexported fields
}
PullRequest implements the scms.PullRequestProvider interface for GitHub.
func NewGithubPullRequestProvider ¶
func NewGithubPullRequestProvider(ctx context.Context, k8sClient client.Client, scmProvider v1alpha1.GenericScmProvider, secret v1.Secret, org string) (*PullRequest, error)
NewGithubPullRequestProvider creates a new instance of PullRequest for GitHub.
func (*PullRequest) Close ¶
func (pr *PullRequest) Close(ctx context.Context, pullRequest v1alpha1.PullRequest) error
Close closes an existing pull request.
func (*PullRequest) Create ¶
func (pr *PullRequest) Create(ctx context.Context, title, head, base, description string, pullRequest v1alpha1.PullRequest) (string, error)
Create creates a new pull request with the specified title, head, base, and description.
func (*PullRequest) FindOpen ¶
func (pr *PullRequest) FindOpen(ctx context.Context, pullRequest v1alpha1.PullRequest) (bool, string, time.Time, error)
FindOpen checks if a pull request is open and returns its status.
func (*PullRequest) GetUrl ¶ added in v0.10.0
func (pr *PullRequest) GetUrl(ctx context.Context, pullRequest v1alpha1.PullRequest) (string, error)
GetUrl returns the URL of the pull request.
func (*PullRequest) Merge ¶
func (pr *PullRequest) Merge(ctx context.Context, pullRequest v1alpha1.PullRequest) error
Merge merges an existing pull request with the specified commit message.
func (*PullRequest) Update ¶
func (pr *PullRequest) Update(ctx context.Context, title, description string, pullRequest v1alpha1.PullRequest) error
Update updates an existing pull request with the specified title and description.