pending_review

package
v3.1.1 Latest Latest
Warning

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

Go to latest
Published: Jan 6, 2023 License: MIT Imports: 8 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var ErrBumpLabel = errors.New("the pull request is labelled as bump and will automatically be merged")

ErrStoppedLabel indicates the pull request only has minor impact and is automatically handled by the bot, does not require attention

View Source
var ErrInvalidChange = errors.New("the files, or lack thereof, make this PR invalid")

ErrInvalidChange in the commit files of the pull request which break the rules of CCI

View Source
var ErrNoCommitStatus = errors.New("no repository status avialble for this commit")

ErrNoCommitStatus available

View Source
var ErrNoReviews = errors.New("no reviews on pull request")

ErrNoReviews indicated there were no reviews on a pull request and a summary could not be generated

View Source
var ErrStoppedLabel = errors.New("the pull request contains at least one label indicated that progress has stopped")

ErrStoppedLabel indicates there is an issue with the pull request

Functions

This section is empty.

Types

type Category

type Category int

Category describing the type of change being introduced by the pull request

const (
	NEW    Category = iota
	EDIT   Category = iota
	DOCS   Category = iota
	CONFIG Category = iota
)

Category describing the type of change being introduced by the pull request

type Client

type Client struct {
	*github.Client

	Repository  *RepositoryService
	PullRequest *PullRequestService

	WorkingRepository WorkingRepository
	// contains filtered or unexported fields
}

A Client manages communication with the GitHub API. This wraps the github.Client and provides convenient access to interrupt information from CCI perspective

func NewClient

func NewClient(httpClient *http.Client, target WorkingRepository) *Client

NewClient returns a new GitHub API client. Requires authentication.

func (*Client) RateLimits

func (c *Client) RateLimits(ctx context.Context) (*RateLimit, *Response, error)

RateLimits returns the rate limits for the current client.

type CombinedStatus

type CombinedStatus = github.CombinedStatus

CombinedStatus represents the combined status of a repository at a particular reference.

type CommitFile

type CommitFile = github.CommitFile

CommitFile represents a file modified in a commit.

type ConanCenterReviewers

type ConanCenterReviewers struct {
	Reviewers []Reviewer `yaml:"reviewers"`
}

func DownloadKnownReviewersList

func DownloadKnownReviewersList(context context.Context, client *Client) (*ConanCenterReviewers, error)

func (*ConanCenterReviewers) IsCommunityMember

func (reviewers *ConanCenterReviewers) IsCommunityMember(reviewerName string) bool

func (*ConanCenterReviewers) IsTeamMember

func (reviewers *ConanCenterReviewers) IsTeamMember(reviewerName string) bool

type Label

type Label = github.Label

Label represents a GitHub label on an Issue

type ListOptions

type ListOptions = github.ListOptions

ListOptions specifies the optional parameters to various List methods that support offset pagination.

type PullRequest

type PullRequest = github.PullRequest

PullRequest represents a GitHub pull request on a repository.

type PullRequestListOptions

type PullRequestListOptions = github.PullRequestListOptions

PullRequestListOptions specifies the optional parameters to the Pull Request service

type PullRequestReview

type PullRequestReview = github.PullRequestReview

PullRequestReview represents a review of a pull request.

func FilterAuthor

func FilterAuthor(reviews []*PullRequestReview, author string) []*PullRequestReview

FilterAuthor removes any reviews by a given user's login

type PullRequestService

type PullRequestService service

PullRequestService handles communication with the pull request related methods of the GitHub API

func (*PullRequestService) GetReviewSummary

func (s *PullRequestService) GetReviewSummary(ctx context.Context, owner string, repo string, reviewers *ConanCenterReviewers, pr *PullRequest) (*PullRequestSummary, *Response, error)

GetReviewSummary of a specific pull request

func (*PullRequestService) ListAllReviews

func (s *PullRequestService) ListAllReviews(ctx context.Context, owner string, repo string, number int) ([]*PullRequestReview, *Response, error)

ListAllReviews lists all reviews on the specified pull request.

type PullRequestSummary

type PullRequestSummary struct {
	Number        int
	OpenedBy      string
	CreatedAt     time.Time
	Recipe        string
	Change        Category
	ReviewURL     string
	LastCommitSHA string
	LastCommitAt  time.Time
	CciBotPassed  bool
	Summary       Reviews
}

PullRequestSummary regarding its location in the review process of conan-center-index. See https://github.com/conan-io/conan-center-index/blob/master/docs/review_process.md for more information

type RateLimit

type RateLimit = github.Rate

RateLimit represents the rate limit for the current client.

type RepoStatus

type RepoStatus = github.RepoStatus

RepoStatus represents the status of a repository at a particular reference.

type RepositoryService

type RepositoryService service

RepositoryService handles communication with the repository related methods of the GitHub API

func (*RepositoryService) GetCommitDate

func (s *RepositoryService) GetCommitDate(ctx context.Context, owner string, repo string, sha string) (time.Time, *Response, error)

GetCommitDate fetches the specified commit's authorship date

func (*RepositoryService) GetStatus

func (s *RepositoryService) GetStatus(ctx context.Context, owner string, repo string, ref string) (*CombinedStatus, *Response, error)

GetStatus fetches the complete status available for a ref

type Response

type Response = github.Response

Response is a GitHub API response.

type Review

type Review struct {
	ReviewerName string
	SubmittedAt  time.Time
	HTMLURL      string
}

Review contains the essentials of a submission

type Reviewer

type Reviewer struct {
	User      string       `yaml:"user"`
	Type      ReviewerType `yaml:"type"`
	Requested bool         `yaml:"request_reviews"`
}

type ReviewerType

type ReviewerType string
const (
	Team      ReviewerType = "team"
	Community ReviewerType = "community"
)

type Reviews

type Reviews struct {
	Count          int  // Total number of comments, requested changes, and approvals
	ValidApprovals int  // Counted by head commit approvals from official community reviewers and the Conan team
	TeamApproval   bool // At least one approval from the Conan team

	Approvals []string // List of users who have approved the pull request on the head commit
	Blockers  []string // List of Conan team members who have requested changes on the head commit

	LastReview *Review `json:",omitempty"` // Snapshot of the last review
}

Reviews summarizes all the reviews of a given pull request

func ProcessReviewComments

func ProcessReviewComments(reviewers *ConanCenterReviewers, reviews []*PullRequestReview, sha string) Reviews

ProcessReviewComments interprets the all the reviews to extract a summary based on the requirements of CCI

func (*Reviews) IsApproved

func (r *Reviews) IsApproved() bool

IsApproved when the conditions for merging are meet as per https://github.com/conan-io/conan-center-index/blob/master/docs/review_process.md

type WorkingRepository

type WorkingRepository struct {
	Owner string
	Name  string
}

WorkingRepository when using the client to access or publish data

Jump to

Keyboard shortcuts

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