Documentation ¶
Index ¶
- Variables
- func DebugLogTransport(base http.RoundTripper, logger *zap.Logger) http.RoundTripper
- type ExpireCache
- type GitHub
- type GithubGraphqlAPI
- func (g *GithubGraphqlAPI) AcceptPullRequest(ctx context.Context, approvalmessage string, owner string, name string, ...) error
- func (g *GithubGraphqlAPI) AddPRComment(ctx context.Context, owner string, name string, number int64, body string) error
- func (g *GithubGraphqlAPI) CreatePullRequest(ctx context.Context, remoteRepositoryId graphql.ID, baseRefName string, ...) (int64, error)
- func (g *GithubGraphqlAPI) EnablePullRequestAutoMerge(ctx context.Context, owner string, name string, number int64) error
- func (g *GithubGraphqlAPI) FindPRForBranch(ctx context.Context, owner string, name string, branch string) (int64, error)
- func (g *GithubGraphqlAPI) FindPullRequest(ctx context.Context, owner string, name string, number int64) (*PullRequest, error)
- func (g *GithubGraphqlAPI) FindPullRequestOid(ctx context.Context, owner string, name string, number int64) (githubv4.ID, error)
- func (g *GithubGraphqlAPI) GetAccessToken(ctx context.Context) (string, error)
- func (g *GithubGraphqlAPI) MergePullRequest(ctx context.Context, owner string, name string, number int64) error
- func (g *GithubGraphqlAPI) RepositoryInfo(ctx context.Context, owner string, name string) (*RepositoryInfo, error)
- func (g *GithubGraphqlAPI) Self(ctx context.Context) (string, error)
- func (g *GithubGraphqlAPI) TriggerWorkflow(ctx context.Context, owner string, repo string, workflow_id string, ref string, ...) error
- type GraphQLPRQueryNode
- type NewGQLClientConfig
- type PullRequest
- type PullRequestState
- type RepositoryInfo
- type Zaptransport
Constants ¶
This section is empty.
Variables ¶
View Source
var DefaultGQLClientConfig = NewGQLClientConfig{ Rt: http.DefaultTransport, AppID: intFromOsEnv("GITHUB_APP_ID"), InstallationID: intFromOsEnv("GITHUB_INSTALLATION_ID"), PEMKeyLoc: os.Getenv("GITHUB_PEM_KEY_LOC"), PEMKey: os.Getenv("GITHUB_PEM_KEY"), Token: os.Getenv("GITHUB_TOKEN"), }
Functions ¶
func DebugLogTransport ¶
func DebugLogTransport(base http.RoundTripper, logger *zap.Logger) http.RoundTripper
Types ¶
type ExpireCache ¶
type ExpireCache[K comparable, V any] struct { DefaultExpiry time.Duration // contains filtered or unexported fields }
func (*ExpireCache[K, V]) Clear ¶
func (e *ExpireCache[K, V]) Clear()
func (*ExpireCache[K, V]) Get ¶
func (e *ExpireCache[K, V]) Get(key K) (V, bool)
func (*ExpireCache[K, V]) Set ¶
func (e *ExpireCache[K, V]) Set(key K, value V)
type GitHub ¶
type GitHub interface { // CreatePullRequest creates a PR of your current branch. It assumes there is a remote branch with the // exact same name. It will fail if you're already on master or main. CreatePullRequest(ctx context.Context, remoteRepositoryId graphql.ID, baseRefName string, remoteRefName string, title string, body string) (int64, error) // RepositoryInfo returns special information about a remote repository RepositoryInfo(ctx context.Context, owner string, name string) (*RepositoryInfo, error) // FindPRForBranch returns the PR for this branch FindPRForBranch(ctx context.Context, owner string, name string, branch string) (int64, error) // Self returns the current user Self(ctx context.Context) (string, error) // AcceptPullRequest approves a PR AcceptPullRequest(ctx context.Context, approvalmessage string, owner string, name string, number int64) error // MergePullRequest merges in a PR and closes it, but only if it's approved MergePullRequest(ctx context.Context, owner string, name string, number int64) error // EnablePullRequestAutoMerge enables auto-merge for the specified pull request EnablePullRequestAutoMerge(ctx context.Context, owner string, name string, number int64) error // FindPullRequest returns basic information for the specified pull request FindPullRequest(ctx context.Context, owner string, name string, number int64) (*PullRequest, error) // AddPRComment adds a comment to the specified pull request AddPRComment(ctx context.Context, owner string, name string, number int64, body string) error // FindPullRequestOid returns the OID of the PR FindPullRequestOid(ctx context.Context, owner string, name string, number int64) (githubv4.ID, error) GetAccessToken(ctx context.Context) (string, error) TriggerWorkflow(ctx context.Context, owner string, repo string, workflow_id string, ref string, inputs map[string]string) error }
func NewGQLClient ¶
NewGQLClient generates a new GraphQL github client
type GithubGraphqlAPI ¶
type GithubGraphqlAPI struct { ClientV4 *githubv4.Client Logger *zap.Logger HttpClient *http.Client // contains filtered or unexported fields }
func (*GithubGraphqlAPI) AcceptPullRequest ¶
func (*GithubGraphqlAPI) AddPRComment ¶ added in v0.1.4
func (*GithubGraphqlAPI) CreatePullRequest ¶
func (*GithubGraphqlAPI) EnablePullRequestAutoMerge ¶ added in v0.1.4
func (*GithubGraphqlAPI) FindPRForBranch ¶
func (*GithubGraphqlAPI) FindPullRequest ¶ added in v0.1.4
func (g *GithubGraphqlAPI) FindPullRequest(ctx context.Context, owner string, name string, number int64) (*PullRequest, error)
func (*GithubGraphqlAPI) FindPullRequestOid ¶
func (*GithubGraphqlAPI) GetAccessToken ¶
func (g *GithubGraphqlAPI) GetAccessToken(ctx context.Context) (string, error)
func (*GithubGraphqlAPI) MergePullRequest ¶
func (*GithubGraphqlAPI) RepositoryInfo ¶
func (g *GithubGraphqlAPI) RepositoryInfo(ctx context.Context, owner string, name string) (*RepositoryInfo, error)
type GraphQLPRQueryNode ¶
type NewGQLClientConfig ¶
type PullRequest ¶ added in v0.1.4
type PullRequest struct { ID githubv4.ID // Number identifies the pull request number. Number int64 // BaseRefName identifies the name of the base Ref associated with the pull request, even if the ref has been deleted. BaseRefName string // BaseRefOid identifies the oid of the base ref associated with the pull request, even if the ref has been deleted. BaseRefOid githubv4.ID // HeadRefName identifies the name of the head Ref associated with the pull request, even if the ref has been deleted. HeadRefName string // HeadRefOid identifies the oid of the head ref associated with the pull request, even if the ref has been deleted. HeadRefOid githubv4.ID // Body as Markdown. Body string // Closed is true if the pull request is closed. State PullRequestState }
type PullRequestState ¶ added in v0.1.4
type PullRequestState string
const ( PullRequstClosed PullRequestState = "CLOSED" PullRequstMerged PullRequestState = "MERGED" PullRequstOpen PullRequestState = "OPEN" )
type RepositoryInfo ¶
type Zaptransport ¶
type Zaptransport struct { Base http.RoundTripper Logger *zap.Logger }
Click to show internal directories.
Click to hide internal directories.