clients

package
v2.1.3 Latest Latest
Warning

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

Go to latest
Published: Aug 9, 2021 License: Apache-2.0 Imports: 2 Imported by: 0

Documentation

Overview

Package clients defines the interface for RepoClient and related structs.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func NewRepoUnavailableError

func NewRepoUnavailableError(err error) error

NewRepoUnavailableError returns a wrapped error of type ErrRepoUnavailable.

Types

type BranchProtectionRule

type BranchProtectionRule struct {
	RequiredApprovingReviewCount int
}

BranchProtectionRule specifies rules for a Git branch.

type BranchRef

type BranchRef struct {
	Name                 string
	BranchProtectionRule BranchProtectionRule
}

BranchRef holds data about a Git branch.

type Commit added in v2.1.3

type Commit struct {
	CommittedDate       time.Time
	Message             string
	SHA                 string
	Committer           User
	AuthoredByCommitter bool
}

Commit represents a Git commit.

type ErrRepoUnavailable

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

ErrRepoUnavailable is returned when RepoClient is unable to reach the repo. UPGRADEv2: use ErrRepoUnreachable instead.

func (*ErrRepoUnavailable) Error

func (e *ErrRepoUnavailable) Error() string

Error returns the error string.

func (*ErrRepoUnavailable) Unwrap

func (e *ErrRepoUnavailable) Unwrap() error

Unwrap returns the wrapped error.

type Label

type Label struct {
	Name string
}

Label represents a PR label.

type PullRequest

type PullRequest struct {
	MergedAt    time.Time
	MergeCommit Commit
	Number      int
	Labels      []Label
	Reviews     []Review
}

PullRequest struct represents a PR as returned by RepoClient. nolint: govet

type RepoClient

type RepoClient interface {
	InitRepo(owner, repo string) error
	IsArchived() (bool, error)
	ListFiles(predicate func(string) (bool, error)) ([]string, error)
	GetFileContent(filename string) ([]byte, error)
	ListMergedPRs() ([]PullRequest, error)
	GetDefaultBranch() (BranchRef, error)
	ListCommits() ([]Commit, error)
	Close() error
}

RepoClient interface is used by Scorecard checks to access a repo.

type Review

type Review struct {
	State string
}

Review represents a PR review.

type User added in v2.1.3

type User struct {
	Login string
}

User represents a Git user.

Directories

Path Synopsis
Package githubrepo implements clients.RepoClient for GitHub.
Package githubrepo implements clients.RepoClient for GitHub.

Jump to

Keyboard shortcuts

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