Documentation ¶
Index ¶
- Constants
- func GitHubEmptyCommitOnBranchWithDefaultClient(ctx context.Context, req githubv4.CreateCommitOnBranchInput, opts ...GHOption) (string, error)
- type AWS
- type Client
- type CommitOnBranchRequest
- type CommitStatus
- type Credentials
- type EventInstallationId
- type GHOption
- type GitHub
- func (g *GitHub) CreatePromotionTargetRef(pCtx *promotion.Context) (*github.Reference, error)
- func (g *GitHub) CreatePullRequest(pCtx *promotion.Context) (*github.PullRequest, error)
- func (g *GitHub) EmptyCommitOnBranch(clients *Client, ctx context.Context, ...) (string, error)
- func (g *GitHub) FastForwardRefToSha(pCtx *promotion.Context) error
- func (g *GitHub) FindPullRequest(pCtx *promotion.Context) (*github.PullRequest, error)
- func (g *GitHub) GetGitHubClients(body []byte) (*Client, error)
- func (g *GitHub) GetPromotionSourceRootRef(pCtx *promotion.Context) (*string, error)
- func (g *GitHub) PromotionTargetRefExists(ctx *promotion.Context) bool
- func (g *GitHub) RateLimits(clt *github.Client) (*github.RateLimits, error)
- func (g *GitHub) RequestTitle(pCtx promotion.Context) *string
- func (g *GitHub) RetrieveCredentials() error
- func (g *GitHub) SendPromotionFeedbackCommitStatus(context string, promotionResult *promotion.Result, promotionError error, ...) error
- func (g *GitHub) ValidateWebhookSecret(secret []byte, headers map[string]string) error
- type Option
Constants ¶
const ( CommitStatusSuccess CommitStatus = "success" CommitStatusFailure = "failure" CommitStatusError = "error" CommitStatusPending = "pending" )
Variables ¶
This section is empty.
Functions ¶
func GitHubEmptyCommitOnBranchWithDefaultClient ¶
func GitHubEmptyCommitOnBranchWithDefaultClient(ctx context.Context, req githubv4.CreateCommitOnBranchInput, opts ...GHOption) (string, error)
GitHubEmptyCommitOnBranchWithDefaultClient creates an empty commit on a branch using the default client
Types ¶
type Client ¶
type Client struct { V3 *github.Client V4 *githubv4.Client // contains filtered or unexported fields }
Client - cache struct holding an entry for each installation ID
type CommitOnBranchRequest ¶
type CommitOnBranchRequest struct {
Owner, Repository, Branch, Message string
}
type CommitStatus ¶
type CommitStatus = string
type Credentials ¶
type Credentials struct { AppId int64 `json:"app_id,omitempty"` PrivateKey string `json:"private_key,omitempty"` WebhookSecret *validation.WebhookSecret `json:"webhook_secret"` Token string `json:"token,omitempty"` }
Credentials is a helper struct to hold the GitHub credentials
type EventInstallationId ¶
type EventInstallationId struct { Installation struct { ID *int64 `json:"id"` } `json:"installation"` }
type GHOption ¶
type GHOption func(*GitHub)
func WithAWSController ¶
func WithAuthMode ¶
func WithLogger ¶
func WithSSMKey ¶
func WithWebhookSecret ¶
func WithWebhookSecret(secret *validation.WebhookSecret) GHOption
type GitHub ¶
type GitHub struct { Credentials // contains filtered or unexported fields }
func NewGitHubController ¶
func (*GitHub) CreatePromotionTargetRef ¶
CreatePromotionTargetRef creates a new ref in the repository
func (*GitHub) CreatePullRequest ¶
CreatePullRequest creates a new pull request in the repository
func (*GitHub) EmptyCommitOnBranch ¶
func (g *GitHub) EmptyCommitOnBranch(clients *Client, ctx context.Context, createCommitOnBranchInput githubv4.CreateCommitOnBranchInput) (string, error)
EmptyCommitOnBranch creates an empty commit on a branch
func (*GitHub) FastForwardRefToSha ¶
FastForwardRefToSha pushes a commit to a ref, used to merge an open pull request via fast-forward
func (*GitHub) FindPullRequest ¶
FindPullRequest searches for an open pull request that matches the promotion request
func (*GitHub) GetGitHubClients ¶
GetGitHubClients returns a GitHub client for the given installation ID or token
func (*GitHub) GetPromotionSourceRootRef ¶
GetPromotionSourceRootRef fetches the root commit present on the head ref
func (*GitHub) PromotionTargetRefExists ¶
PromotionTargetRefExists checks if a ref exists in the repository
func (*GitHub) RateLimits ¶
RateLimits fetches the rate limits for the currently authenticated identity
func (*GitHub) RequestTitle ¶
RequestTitle generates a title for a promotion request
func (*GitHub) RetrieveCredentials ¶
RetrieveCredentials fetches the GitHub credentials from the environment or SSM
func (*GitHub) SendPromotionFeedbackCommitStatus ¶
func (g *GitHub) SendPromotionFeedbackCommitStatus(context string, promotionResult *promotion.Result, promotionError error, commitStatus CommitStatus) error
SendPromotionFeedbackCommitStatus sends a commit status to the head commit of the promotion request