github

package
v0.0.0-...-bb38180 Latest Latest
Warning

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

Go to latest
Published: Apr 14, 2025 License: MPL-2.0 Imports: 6 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func QueryDeploymentsWithCommits

func QueryDeploymentsWithCommits(
	ctx context.Context,
	repo *Repo,
	d DeploymentsService, c CommitsComparisonService,
	logger *slog.Logger,
	opts *DeploymentWithCommitsOptions,
) (map[string][]*DeploymentWithCommits, error)

QueryDeploymentsWithCommits fetches deployments across environments and determines the commits deployed between each deployment and its previous one. It uses DeploymentsService to fetch deployments and commit ranges, and CommitsComparisonService to fetch commits for the identified ranges.

Types

type Commit

type Commit struct {
	AbbreviatedSHA string
	SHA            string
	AuthoredDate   time.Time
	CommittedDate  time.Time
	Message        string
	Parents        []*CommitParent
}

Unified Git Commit Model (used for both REST & GraphQL API)

type CommitParent

type CommitParent struct {
	AbbreviatedSHA string
	SHA            string
}

Unified Git Commit parent model (used for both REST & GraphQL API)

type CommitsComparison

type CommitsComparison struct {
	TotalCommits int
	Commits      []*Commit
}

Represents a Git Commit Comparison

type CommitsComparisonService

type CommitsComparisonService interface {
	CompareCommits(ctx context.Context, repo *Repo, base string, head string, limit int) (*CommitsComparison, error)
}

CommitsComparisonService provides commit comparison functionality.

type CommitsOpts

type CommitsOpts struct {
	Limit int
}

Options for the CommitsComparisonService

type DeployedCommitsOptions

type DeployedCommitsOptions struct {
	Deployment *DeploymentOpts
	Commits    *CommitsOpts
}

Options for the QueryDeployedCommits function

type Deployment

type Deployment struct {
	Description         string
	CreatedAt           time.Time
	UpdatedAt           time.Time
	OriginalEnvironment string
	LatestEnvironment   string
	Task                string
	State               string
	Ref                 string
	Commit              *Commit
}

Unified GitHub Deployment Model (used for both REST & GraphQL API)

type DeploymentOpts

type DeploymentOpts struct {
	Env         string
	Sha         string
	SearchLimit int
}

Options for the DeploymentsService

type DeploymentService

type DeploymentService interface {
	QueryDeployment(ctx context.Context, repo *Repo, env string, sha string, searchLimit int) (*Deployment, *Deployment, error)
}

DeploymentService provides access to GitHub Deployment functionality.

type DeploymentWithCommits

type DeploymentWithCommits struct {
	*Deployment
	DeployedCommits []*Commit
}

DeploymentWithCommits represents a deployment along with its associated deployed commits.

func QueryDeployedCommits

func QueryDeployedCommits(
	ctx context.Context,
	repo *Repo,
	d DeploymentService, c CommitsComparisonService,
	logger *slog.Logger,
	opts *DeployedCommitsOptions,
) (*DeploymentWithCommits, error)

QueryDeployedCommits retrieves a deployment and finds the commits deployed between it and the previous deployment in the same environment. It uses DeploymentService and CommitsComparisonService to fetch and compare commits.

type DeploymentWithCommitsOptions

type DeploymentWithCommitsOptions struct {
	Deployments *DeploymentsOpts
	Commits     *CommitsOpts
}

Options for the QueryDeploymentsWithCommits function

type DeploymentsOpts

type DeploymentsOpts struct {
	Envs  *[]string
	Limit int
}

Options for the DeploymentsService

type DeploymentsService

type DeploymentsService interface {
	QueryDeployments(ctx context.Context, repo *Repo, envs *[]string, limit int) ([]Deployment, error)
}

DeploymentsService provides access to GitHub Deployment functionality.

type HistoryService

type HistoryService interface {
	QueryHistory(ctx context.Context, repo *Repo, head string, base string, limit int) ([]Commit, error)
}

HistoryService provides commit history functionality.

type PullRequest

type PullRequest struct {
	Number    int
	Title     string
	CreatedAt time.Time
	UpdatedAt time.Time
	ClosedAt  time.Time
	MergedAt  time.Time
}

Unified GitHub PullRequest Model (used for both REST & GraphQL API)

type PullRequestsService

type PullRequestsService interface {
	QueryPullRequests(ctx context.Context, repo *Repo, limit int) ([]PullRequest, error)
}

PullRequestsService provides access to GitHub Pull Request functionality.

type RefComparisonService

type RefComparisonService interface {
	QueryCompareRefs(ctx context.Context, repo *Repo, base string, head string, limit int) (*CommitsComparison, error)
}

RefComparisonService provides Git reference comparison functionality.

type Release

type Release struct {
	Name         string
	TagName      string
	IsDraft      bool
	IsLatest     bool
	IsPrerelease bool
	Description  string
	CreatedAt    time.Time
	PublishedAt  time.Time
}

Unified GitHub Release Model (used for both REST & GraphQL API)

type ReleaseWithPRs

type ReleaseWithPRs struct {
	*Release
	PRs []int
}

ReleaseWithPRs embeds a GitHub Release object with an added slice of PR numbers, which we have parsed from its auto-generated release notes.

func NewReleaseWithPRs

func NewReleaseWithPRs(r *Release) *ReleaseWithPRs

NewReleaseWithPrs creates a new ReleaseWithPRs by parsing PR numbers from auto-generated Release Descriptions.

type ReleasesService

type ReleasesService interface {
	QueryReleases(ctx context.Context, repo *Repo, limit int) ([]Release, error)
}

ReleasesService provides access to GitHub Release functionality.

type Repo

type Repo struct {
	Owner string
	Name  string
}

Represents a GitHub repo

Directories

Path Synopsis
internal

Jump to

Keyboard shortcuts

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