gh

package
v0.0.0-...-9ea06bb Latest Latest
Warning

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

Go to latest
Published: Oct 29, 2024 License: MIT Imports: 19 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Actor

type Actor struct {
	User User `graphql:"... on User"`
	Team Team `graphql:"... on Team"`
}

type BranchProtectionRule

type BranchProtectionRule struct {
	ID                           string                      `bson:"id" json:"id" diff:"BranchProtectionRuleID"`
	Pattern                      string                      `bson:"pattern" json:"pattern"`
	AllowsForcePushes            bool                        `bson:"allows_force_pushes" json:"allows_force_pushes"`
	AllowsDeletions              bool                        `bson:"allows_deletion" json:"allows_deletion"`
	BypassPullRequestAllowances  BypassPullRequestAllowances `bson:"-" json:"bypass_pull_request_allowances" graphql:"bypassPullRequestAllowances(first: 100)"`
	DismissesStaleReviews        bool                        `bson:"dismisses_stale_reviews" json:"dismisses_stale_reviews"`
	IsAdminEnforced              bool                        `bson:"is_admin_enforced" json:"is_admin_enforced"`
	PushAllowances               PushAllowances              `bson:"-" json:"push_allowances" graphql:"pushAllowances(first: 100)"`
	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 BypassPullRequestAllowance

type BypassPullRequestAllowance struct {
	Actor Actor `bson:"actor" json:"actor"`
}

type BypassPullRequestAllowances

type BypassPullRequestAllowances struct {
	Nodes []BypassPullRequestAllowance
}

type Commit

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

type CommitFragment

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

type GitActor

type GitActor struct {
	Name string `bson:"-" json:"-"`
}

type GitHub

type GitHub interface {
	ArchiveRepository(repoID string, archive bool) error
	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)
	UpdatePreceiveHook(orgName string, repoName string, hookName string, enabled bool) error
}

func New

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

type GitHubImpl

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

func (*GitHubImpl) ArchiveRepository

func (ghi *GitHubImpl) ArchiveRepository(repoID string, archive bool) error

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

func (*GitHubImpl) UpdatePreceiveHook

func (ghi *GitHubImpl) UpdatePreceiveHook(orgName string, repoName string, hookName string, enabled bool) 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" diff:"DefaultBranch"`
		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" diff:"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" diff:"HistoryTotalCount"`
}

type Organization

type Organization struct {
	Login string
}

type PullRequests

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

type PushAllowance

type PushAllowance struct {
	Actor Actor `bson:"actor" json:"actor"`
}

type PushAllowances

type PushAllowances struct {
	Nodes []PushAllowance
}

type Refs

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

type Repository

type Repository struct {
	*GqlRepository           `bson:"inline"`
	Customs                  map[string]interface{} `bson:"customs,omitempty" json:"customs,omitempty" diff:"Customs"`
	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"`
	RepoOwnerID              primitive.ObjectID     `bson:"repo_owner_id,omitempty" json:"repo_owner_id,omitempty"`
	RepoOwner                string                 `bson:"repo_owner,omitempty" json:"repo_owner,omitempty"`
	RepoOwnerContact         string                 `bson:"repo_owner_contact,omitempty" json:"repo_owner_contact,omitempty"`
	AutomationsCount         int                    `bson:"automations_count,omitempty" json:"automations_count"`
	BypassPullRequestUsers   []string               `bson:"bypass_pull_request_users,omitempty" json:"bypass_pull_request_users,omitempty"`
	BypassPullRequestUserIDs []string               `bson:"bypass_pull_request_user_ids,omitempty" json:"bypass_pull_request_user_ids,omitempty"`
	PushAllowanceUsers       []string               `bson:"push_allowance_users,omitempty" json:"push_allowance_users,omitempty"`
	PushAllowanceUserIDs     []string               `bson:"push_allowance_user_ids,omitempty" json:"push_allowance_user_ids,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"`
}

type Team

type Team struct {
	ID   string `bson:"id" json:"id"`
	Name string `bson:"name" json:"name"`
}

type User

type User struct {
	ID    string `bson:"id" json:"id"`
	Login string `bson:"login" json:"login"`
}

Jump to

Keyboard shortcuts

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