Documentation
¶
Overview ¶
Package clients defines the interface for RepoClient and related structs.
Index ¶
- Variables
- type BadgeLevel
- type BadgeResponse
- type BranchProtectionRule
- type BranchRef
- type CIIBestPracticesClient
- type CheckRun
- type CheckRunApp
- type Commit
- type Contributor
- type Issue
- type Label
- type PullRequest
- type PullRequestReviewRule
- type Release
- type ReleaseAsset
- type Repo
- type RepoClient
- type Review
- type SearchRequest
- type SearchResponse
- type SearchResult
- type Status
- type StatusChecksRule
- type User
- type WorkflowRun
Constants ¶
This section is empty.
Variables ¶
var ErrUnsupportedFeature = errors.New("unsupported feature")
ErrUnsupportedFeature indicates an API that is not supported by the client.
Functions ¶
This section is empty.
Types ¶
type BadgeLevel ¶ added in v3.2.1
type BadgeLevel uint
BadgeLevel corresponds to CII-Best-Practices badge levels. https://bestpractices.coreinfrastructure.org/en
const ( // Unknown or non-parsable CII Best Practices badge. Unknown BadgeLevel = iota // NotFound represents when CII Best Practices returns an empty response for a project. NotFound // InProgress state of CII Best Practices badge. InProgress // Passing level for CII Best Practices badge. Passing // Silver level for CII Best Practices badge. Silver // Gold level for CII Best Practices badge. Gold )
type BadgeResponse ¶ added in v3.2.1
type BadgeResponse struct {
BadgeLevel string `json:"badge_level"`
}
BadgeResponse struct is used to read/write CII Best Practices badge data.
func ParseBadgeResponseFromJSON ¶ added in v3.2.1
func ParseBadgeResponseFromJSON(data []byte) ([]BadgeResponse, error)
ParseBadgeResponseFromJSON parses input []byte value into []BadgeResponse.
func (BadgeResponse) AsJSON ¶ added in v3.2.1
func (resp BadgeResponse) AsJSON() ([]byte, error)
AsJSON outputs BadgeResponse struct in JSON format.
type BranchProtectionRule ¶
type BranchProtectionRule struct {
RequiredPullRequestReviews PullRequestReviewRule
AllowDeletions *bool
AllowForcePushes *bool
RequireLinearHistory *bool
EnforceAdmins *bool
CheckRules StatusChecksRule
}
BranchProtectionRule captures the settings enabled on a branch for security.
type BranchRef ¶
type BranchRef struct {
Name *string
Protected *bool
BranchProtectionRule BranchProtectionRule
}
BranchRef represents a single branch reference and its protection rules.
type CIIBestPracticesClient ¶ added in v3.2.1
type CIIBestPracticesClient interface {
GetBadgeLevel(ctx context.Context, uri string) (BadgeLevel, error)
}
CIIBestPracticesClient interface returns the BadgeLevel for a repo URL.
func BlobCIIBestPracticesClient ¶ added in v3.2.1
func BlobCIIBestPracticesClient(bucketURL string) CIIBestPracticesClient
BlobCIIBestPracticesClient returns a blob-based implementation of the interface.
func DefaultCIIBestPracticesClient ¶ added in v3.2.1
func DefaultCIIBestPracticesClient() CIIBestPracticesClient
DefaultCIIBestPracticesClient returns http-based implementation of the interface.
type CheckRun ¶
type CheckRun struct {
Status string
Conclusion string
URL string
App CheckRunApp
}
CheckRun is a single instance of a VCS CheckRun.
type CheckRunApp ¶
type CheckRunApp struct {
Slug string
}
CheckRunApp is the app running the Check.
type Contributor ¶
Contributor represents a contributor to a repo.
type PullRequest ¶
type PullRequest struct {
MergedAt time.Time
MergeCommit Commit
Number int
HeadSHA string
Labels []Label
Reviews []Review
Author User
}
PullRequest struct represents a PR as returned by RepoClient. nolint: govet
type PullRequestReviewRule ¶
type PullRequestReviewRule struct {
RequiredApprovingReviewCount *int32
DismissStaleReviews *bool
RequireCodeOwnerReviews *bool
}
PullRequestReviewRule captures settings on a PullRequest.
type Release ¶
type Release struct {
TagName string
URL string
TargetCommitish string
Assets []ReleaseAsset
}
Release represents a release version of a package/repo.
type ReleaseAsset ¶
ReleaseAsset is part of the Release bundle.
type Repo ¶
type Repo interface {
URI() string
String() string
Org() Repo
IsValid() error
Metadata() []string
AppendMetadata(metadata ...string)
}
Repo interface uniquely identifies a repo.
type RepoClient ¶
type RepoClient interface {
InitRepo(repo Repo) error
URI() string
IsArchived() (bool, error)
ListFiles(predicate func(string) (bool, error)) ([]string, error)
GetFileContent(filename string) ([]byte, error)
ListMergedPRs() ([]PullRequest, error)
ListBranches() ([]*BranchRef, error)
GetDefaultBranch() (*BranchRef, error)
ListCommits() ([]Commit, error)
ListIssues() ([]Issue, error)
ListReleases() ([]Release, error)
ListContributors() ([]Contributor, error)
ListSuccessfulWorkflowRuns(filename string) ([]WorkflowRun, error)
ListCheckRunsForRef(ref string) ([]CheckRun, error)
ListStatuses(ref string) ([]Status, error)
Search(request SearchRequest) (SearchResponse, error)
Close() error
}
RepoClient interface is used by Scorecard checks to access a repo.
type SearchRequest ¶
SearchRequest queries a repo for `Query`. If `Filename` is provided, only matching filenames are queried. If `Path` is provided, only files with matching paths are queried.
type SearchResponse ¶
type SearchResponse struct {
Results []SearchResult
Hits int
}
SearchResponse returns the results from a search request on a repo.
type SearchResult ¶
type SearchResult struct {
Path string
}
SearchResult represents a matching result from the search query.
type StatusChecksRule ¶
type StatusChecksRule struct {
UpToDateBeforeMerge *bool
RequiresStatusChecks *bool
Contexts []string
}
StatusChecksRule captures settings on status checks.
Source Files
¶
Directories
¶
| Path | Synopsis |
|---|---|
|
Package githubrepo implements clients.RepoClient for GitHub.
|
Package githubrepo implements clients.RepoClient for GitHub. |
|
roundtripper
Package roundtripper has implementations of http.RoundTripper useful to clients.RepoClient.
|
Package roundtripper has implementations of http.RoundTripper useful to clients.RepoClient. |
|
roundtripper/tokens
Package tokens defines interface to access GitHub PATs.
|
Package tokens defines interface to access GitHub PATs. |
|
roundtripper/tokens/server
command
Package main implements the GitHub token server.
|
Package main implements the GitHub token server. |
|
Package localdir implements RepoClient on local source code.
|
Package localdir implements RepoClient on local source code. |
|
Package mockrepo is a generated GoMock package.
|
Package mockrepo is a generated GoMock package. |