github

package
v1.1.1 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Mar 11, 2025 License: AGPL-3.0 Imports: 15 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type AppInfo

type AppInfo struct {
	Name string
}

type AuthInfo

type AuthInfo struct {
	InstallationID int64
	AppID          int64
	PrivateKey     []byte

	GithubToken string
}

type CICheckStatus

type CICheckStatus interface {
	fmt.Stringer
	Outcome() CIStatus
	Type() string
}

type CIStatus

type CIStatus uint
const (
	CIStatusPassed CIStatus = iota
	CIStatusFailed
	CIStatusPending
	CIStatusUnknown
	CIStatusSkipped
)

func (CIStatus) String

func (c CIStatus) String() string

type CheckCIStatus

type CheckCIStatus interface {
	CheckOverallCIStatus
	CheckCIStatusForChecks
}

type CheckCIStatusForChecks

type CheckCIStatusForChecks interface {
	GetCIStatusForChecks(ctx context.Context, owner, repo string, commitHash string, checkNames []string) (CIStatus, []string, error)
}

type CheckOverallCIStatus

type CheckOverallCIStatus interface {
	GetCIStatus(ctx context.Context, owner, repo string, commitHash string, excludes []string) (CIStatus, error)
}

type CheckPRMerged

type CheckPRMerged interface {
	IsPRMergedOrClosed(ctx context.Context, owner, repo string, pr int) (string, bool, int64, error)
}

type CheckRun

type CheckRun struct {
	Name       string
	Status     string
	Conclusion string
	CheckSuite CheckSuiteInfo
}

func (CheckRun) Outcome

func (c CheckRun) Outcome() CIStatus

func (CheckRun) String

func (c CheckRun) String() string

func (CheckRun) Type

func (c CheckRun) Type() string

type CheckSuiteInfo

type CheckSuiteInfo struct {
	App         AppInfo
	WorkflowRun struct {
		Workflow WorkflowInfo
	}
}

type GHClient

type GHClient struct {
	// contains filtered or unexported fields
}

func AuthenticateWithApp

func AuthenticateWithApp(ctx context.Context, logger *slog.Logger, privateKey []byte, appID, installationID int64, pendingRecheckTime time.Duration) (GHClient, error)

AuthenticateWithApp authenticates with a GitHub App

func AuthenticateWithToken

func AuthenticateWithToken(ctx context.Context, logger *slog.Logger, token string, pendingRecheckTime time.Duration) GHClient

AuthenticateWithToken authenticates with a GitHub token.

func NewGithubClient

func NewGithubClient(ctx context.Context, logger *slog.Logger, authInfo AuthInfo, pendingRecheckTime time.Duration) (GHClient, error)

func (GHClient) GetCIStatus

func (c GHClient) GetCIStatus(ctx context.Context, owner, repoName, ref string, excludes []string) (CIStatus, error)

func (GHClient) GetCIStatusForChecks

func (c GHClient) GetCIStatusForChecks(ctx context.Context, owner, repoName string, ref string, checkNames []string) (CIStatus, []string, error)

GetCIStatusForCheck returns the CI status for a specific commit. It looks at both 'checks' and 'statuses'.

func (GHClient) GetDetailedCIStatus

func (c GHClient) GetDetailedCIStatus(ctx context.Context, owner, repoName, ref string) ([]CICheckStatus, error)

func (GHClient) GetPRHeadSHA

func (c GHClient) GetPRHeadSHA(ctx context.Context, owner, repo string, prNumber int) (string, error)

func (GHClient) IsPRMergedOrClosed

func (c GHClient) IsPRMergedOrClosed(ctx context.Context, owner, repo string, prNumber int) (string, bool, int64, error)

type GetDetailedCIStatus

type GetDetailedCIStatus interface {
	GetDetailedCIStatus(ctx context.Context, owner, repo string, commitHash string) ([]CICheckStatus, error)
}

type GetPRHeadSHA

type GetPRHeadSHA interface {
	GetPRHeadSHA(ctx context.Context, owner, repo string, pr int) (string, error)
}

type PageInfo

type PageInfo struct {
	EndCursor   *string
	HasNextPage bool
}

type RollupContextNode

type RollupContextNode struct {
	Typename      string        `graphql:"__typename"`
	CheckRun      CheckRun      `graphql:"... on CheckRun"`
	StatusContext StatusContext `graphql:"... on StatusContext"`
}

type RollupContexts

type RollupContexts struct {
	CheckRunCount      int
	StatusContextCount int
	Nodes              []RollupContextNode
	PageInfo           PageInfo
}

type StatusCheckRollup

type StatusCheckRollup struct {
	State    string
	Contexts RollupContexts `graphql:"contexts(first: 100, after: $cursor)"`
}

type StatusContext

type StatusContext struct {
	Context string
	State   string
}

func (StatusContext) Outcome

func (s StatusContext) Outcome() CIStatus

func (StatusContext) String

func (s StatusContext) String() string

func (StatusContext) Type

func (s StatusContext) Type() string

type WorkflowInfo

type WorkflowInfo struct {
	Name string
}

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL