gh

package
v0.0.0-...-96036c8 Latest Latest
Warning

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

Go to latest
Published: Apr 1, 2024 License: MIT Imports: 17 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type BranchProtectionRule

type BranchProtectionRule struct {
	ID                           string `bson:"id" json:"id"`
	Pattern                      string `bson:"pattern" json:"pattern"`
	AllowsForcePushes            bool   `bson:"allows_force_pushes" json:"allows_force_pushes"`
	AllowsDeletions              bool   `bson:"allows_deletion" json:"allows_deletion"`
	DismissesStaleReviews        bool   `bson:"dismisses_stale_reviews" json:"dismisses_stale_reviews"`
	IsAdminEnforced              bool   `bson:"is_admin_enforced" json:"is_admin_enforced"`
	RequireLastPushApproval      bool   `bson:"require_last_push_approval" json:"require_last_push_approval"`
	RequiredApprovingReviewCount int    `bson:"required_approving_review_count" json:"required_approving_review_count"`
	RequiredStatusChecks         []struct {
		Context string `bson:"context" json:"context"`
	} `bson:"required_status_checks" json:"required_status_checks"`
	RequiresApprovingReviews       bool `bson:"requires_approving_reviews" json:"requires_approving_reviews"`
	RequiresCodeOwnerReviews       bool `bson:"requires_code_owner_reviews" json:"requires_code_owner_reviews"`
	RequiresCommitSignatures       bool `bson:"requires_commit_signatures" json:"requires_commit_signatures"`
	RequiresConversationResolution bool `bson:"requires_conversation_resolution" json:"requires_conversation_resolution"`
	RequiresLinearHistory          bool `bson:"requires_linear_history" json:"requires_linear_history"`
	RequiresStatusChecks           bool `bson:"requires_status_checks" json:"requires_status_checks"`
	RequiresStrictStatusChecks     bool `bson:"requires_strict_status_checks" json:"requires_strict_status_checks"`
	RestrictsPushes                bool `bson:"retricts_pushes" json:"retricts_pushes"`
	RestrictsReviewDismissals      bool `bson:"retricts_review_dismissals" json:"retricts_review_dismissals"`
}

type Commit

type Commit struct {
	CommittedDate time.Time `bson:"-" json:"-"`
}

type CommitFragment

type CommitFragment struct {
	History History `bson:"history" json:"history" graphql:"history(first: 1)"`
}

type GitHub

type GitHub interface {
	CreateBranchProtectionRule(repoID, pattern string) error
	GetOrganizations() ([]*Organization, error)
	GetRepos(orgName string) ([]*Repository, error)
	UpdateBranchProtectionRule(branchProtectionRuleID, field string, value interface{}) error
	GetRepo(orgName, repoName string) (*Repository, error)
}

func New

func New(ctx context.Context, host, pat, caCertPath string) (GitHub, error)

type GitHubImpl

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

func (*GitHubImpl) CreateBranchProtectionRule

func (ghi *GitHubImpl) CreateBranchProtectionRule(repoID, pattern string) error

func (*GitHubImpl) GetOrganizations

func (ghi *GitHubImpl) GetOrganizations() ([]*Organization, error)

func (*GitHubImpl) GetRepo

func (ghi *GitHubImpl) GetRepo(orgName, repoName string) (*Repository, error)

func (*GitHubImpl) GetRepos

func (ghi *GitHubImpl) GetRepos(orgName string) ([]*Repository, error)

func (*GitHubImpl) NewRepository

func (ghi *GitHubImpl) NewRepository(node GqlRepository) *Repository

func (*GitHubImpl) UpdateBranchProtectionRule

func (ghi *GitHubImpl) UpdateBranchProtectionRule(branchProtectionRuleID, field string, value interface{}) error

type GqlRepository

type GqlRepository struct {
	ID            string `bson:"id" json:"id"`
	Name          string `bson:"name" json:"name"`
	NameWithOwner string `bson:"full_name" json:"full_name"`
	Owner         struct {
		Login string `bson:"login" json:"login"`
	} `bson:"owner" json:"owner"`
	DefaultBranchRef struct {
		Name                 string               `bson:"name" json:"name"`
		BranchProtectionRule BranchProtectionRule `bson:"branch_protection_rule" json:"branch_protection_rule"`
		Target               Target               `bson:"target" json:"target"`
	} `bson:"default_branch" json:"default_branch"`
	PrimaryLanguage struct {
		Name string `bson:"name" json:"name"`
	} `bson:"primary_language" json:"primary_language"`
	PullRequests        PullRequests `bson:"pull_requests" json:"pull_requests"`
	Refs                Refs         `bson:"refs" json:"refs" graphql:"refs(first: 0, refPrefix: \"refs/heads/\")"`
	IsArchived          bool         `bson:"is_archived" json:"is_archived"`
	IsDisabled          bool         `bson:"is_disabled" json:"is_disabled"`
	IsEmpty             bool         `bson:"is_empty" json:"is_empty"`
	IsLocked            bool         `bson:"is_locked" json:"is_locked"`
	IsPrivate           bool         `bson:"is_private" json:"is_private"`
	DeleteBranchOnMerge bool         `bson:"delete_branch_on_merge" json:"delete_branch_on_merge"`
	MergeCommitAllowed  bool         `bson:"merge_commit_allowed" json:"merge_commit_allowed"`
	RebaseMergeAllowed  bool         `bson:"rebase_merge_allowed" json:"rebase_merge_allowed"`
	SquashMergeAllowed  bool         `bson:"squash_merge_allowed" json:"squash_merge_allowed"`
	DiskUsage           int          `bson:"disk_usage" json:"disk_usage"`
	CreatedAt           time.Time    `bson:"created_at" json:"created_at"`
	UpdatedAt           time.Time    `bson:"updated_at" json:"updated_at"`
}

type History

type History struct {
	Nodes      []Commit `bson:"-" json:"-"`
	TotalCount int      `bson:"total_count" json:"total_count"`
}

type Organization

type Organization struct {
	Login string
}

type PullRequests

type PullRequests struct {
	TotalCount int `bson:"total_count" json:"total_count"`
}

type Refs

type Refs struct {
	TotalCount int `bson:"total_count" json:"total_count"`
}

type Repository

type Repository struct {
	*GqlRepository  `bson:"inline"`
	Customs         map[string]interface{} `bson:"customs,omitempty" json:"customs,omitempty"`
	GitHubHost      string                 `bson:"github_host,omitempty" json:"github_host,omitempty"`
	Score           *int                   `bson:"score,omitempty" json:"score,omitempty"`
	ScoreColor      *string                `bson:"score_color,omitempty" json:"score_color,omitempty"`
	FetchedAt       time.Time              `bson:"fetched_at,omitempty" json:"fetched_at,omitempty"`
	CustomRunAt     time.Time              `bson:"custom_run_at,omitempty" json:"custom_run_at,omitempty"`
	LastCommittedAt time.Time              `bson:"last_committed_at" json:"last_committed_at"`
	RepoOwner       string                 `bson:"repo_owner,omitempty" json:"repo_owner,omitempty"`
}

func (*Repository) UpdateRepoScoreAndColor

func (repo *Repository) UpdateRepoScoreAndColor(gs *config.GlobalSettings) error

type Target

type Target struct {
	Commit CommitFragment `bson:"commit" json:"commit" graphql:"... on Commit"`
}

Jump to

Keyboard shortcuts

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