Documentation
¶
Index ¶
- func ApprovePr(approverClient *github.Client, ghPrClientDetails GhPrClientDetails, ...) error
- func BumpVersion(ghPrClientDetails GhPrClientDetails, defaultBranch string, filePath string, ...) error
- func CompareRepoDirectories(ghPrClientDetails GhPrClientDetails, sourcePath string, targetPath string, ...) (bool, string, error)
- func DetectDrift(ghPrClientDetails GhPrClientDetails) error
- func DoesPrHasLabel(labels []*github.Label, name string) bool
- func GeneratePromotionPlan(ghPrClientDetails GhPrClientDetails, config *cfg.Config, configBranch string) (map[string]PromotionInstance, error)
- func GenerateSyncTreeEntriesForCommit(treeEntries *[]*github.TreeEntry, ghPrClientDetails GhPrClientDetails, ...) error
- func GetBotGhIdentity(githubGraphQlClient *githubv4.Client, ctx context.Context) (string, error)
- func GetFileContent(ghPrClientDetails GhPrClientDetails, branch string, filePath string) (string, int, error)
- func GetInRepoConfig(ghPrClientDetails GhPrClientDetails, defaultBranch string) (*cfg.Config, error)
- func HandlePREvent(eventPayload *github.PullRequestEvent, ghPrClientDetails GhPrClientDetails, ...)
- func MainGhMetricsLoop(mainGhClientCache *lru.Cache[string, GhClientPair])
- func MergePr(details GhPrClientDetails, number int) error
- func MimizeStalePrComments(ghPrClientDetails GhPrClientDetails, githubGraphQlClient *githubv4.Client, ...) error
- func ReciveEventFile(eventType string, eventFilePath string, ...)
- func ReciveWebhook(r *http.Request, mainGhClientCache *lru.Cache[string, GhClientPair], ...) error
- func SetCommitStatus(ghPrClientDetails GhPrClientDetails, state string)
- type DiffCommentData
- type GhClientPair
- type GhPrClientDetails
- type PromotionInstance
- type PromotionInstanceMetaData
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func ApprovePr ¶
func ApprovePr(approverClient *github.Client, ghPrClientDetails GhPrClientDetails, prNumber *int) error
func BumpVersion ¶
func CompareRepoDirectories ¶
func DetectDrift ¶
func DetectDrift(ghPrClientDetails GhPrClientDetails) error
func GeneratePromotionPlan ¶
func GeneratePromotionPlan(ghPrClientDetails GhPrClientDetails, config *cfg.Config, configBranch string) (map[string]PromotionInstance, error)
func GetBotGhIdentity ¶
go-github is my peffered way to interact with GitHub because of the better developer expirience(pre made types, easy API mocking). But some functionality is not availalble in GH V3 rest API, like PR comment minimization, so here we are:
func GetFileContent ¶
func GetInRepoConfig ¶
func GetInRepoConfig(ghPrClientDetails GhPrClientDetails, defaultBranch string) (*cfg.Config, error)
func HandlePREvent ¶
func HandlePREvent(eventPayload *github.PullRequestEvent, ghPrClientDetails GhPrClientDetails, mainGithubClientPair GhClientPair, approverGithubClientPair GhClientPair, ctx context.Context)
func MainGhMetricsLoop ¶
func MainGhMetricsLoop(mainGhClientCache *lru.Cache[string, GhClientPair])
func MergePr ¶
func MergePr(details GhPrClientDetails, number int) error
func MimizeStalePrComments ¶
func MimizeStalePrComments(ghPrClientDetails GhPrClientDetails, githubGraphQlClient *githubv4.Client, botIdentity string) error
func ReciveEventFile ¶
func ReciveEventFile(eventType string, eventFilePath string, mainGhClientCache *lru.Cache[string, GhClientPair], prApproverGhClientCache *lru.Cache[string, GhClientPair])
ReciveEventFile this one is similar to ReciveWebhook but it's used for CLI triggering, i simulates a webhook event to use the same code path as the webhook handler.
func ReciveWebhook ¶
func ReciveWebhook(r *http.Request, mainGhClientCache *lru.Cache[string, GhClientPair], prApproverGhClientCache *lru.Cache[string, GhClientPair], githubWebhookSecret []byte) error
ReciveWebhook is the main entry point for the webhook handling it starts parases the webhook payload and start a thread to handle the event success/failure are dependant on the payload parsing only
func SetCommitStatus ¶
func SetCommitStatus(ghPrClientDetails GhPrClientDetails, state string)
Types ¶
type DiffCommentData ¶
type DiffCommentData struct {
DiffOfChangedComponents []argocd.DiffResult
DisplaySyncBranchCheckBox bool
BranchName string
}
type GhClientPair ¶
type GhClientPair struct {
// contains filtered or unexported fields
}
func (*GhClientPair) GetAndCache ¶
type GhPrClientDetails ¶
type GhPrClientDetails struct {
GhClientPair *GhClientPair
// This whole struct describe the metadata of the PR, so it makes sense to share the context with everything to generate HTTP calls related to that PR, right?
Ctx context.Context //nolint:containedctx
DefaultBranch string
Owner string
Repo string
PrAuthor string
PrNumber int
PrSHA string
Ref string
RepoURL string
PrLogger *log.Entry
Labels []*github.Label
PrMetadata prMetadata
}
func (GhPrClientDetails) CommentOnPr ¶
func (p GhPrClientDetails) CommentOnPr(commentBody string) error
func (*GhPrClientDetails) GetDefaultBranch ¶
func (p *GhPrClientDetails) GetDefaultBranch() (string, error)
func (*GhPrClientDetails) ToggleCommitStatus ¶
func (p *GhPrClientDetails) ToggleCommitStatus(context string, user string) error
type PromotionInstance ¶
type PromotionInstance struct {
Metadata PromotionInstanceMetaData `deep:"-"` // Unit tests ignore Metadata currently
ComputedSyncPaths map[string]string // key is target, value is source
}
Click to show internal directories.
Click to hide internal directories.