ghapi

package
v0.0.0-...-8bdf0cb Latest Latest
Warning

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

Go to latest
Published: Feb 16, 2020 License: MIT, MIT Imports: 8 Imported by: 0

Documentation

Index

Constants

View Source
const (
	MigrationDiffLabel                  string = "migration:skeema:diff"
	MigrationDetectedLabel              string = "migration:skeefree:detected"
	MigrationQueuedLabel                string = "migration:skeefree:queued"
	MigrationApprovedByDBReviewersLabel string = "migration:approved:schema-reviewers"
	MigrationApprovedByDBInfraLabel     string = "migration:approved:database-team"
	MigrationForReviewLabel             string = "migration:for:review"
	MigrationForReviewAlternateLabel    string = "DB migration" // Used internally at GitHub for backwards compatability

	CheckRunSuccessfulConclusion string = "success"
)

Variables

This section is empty.

Functions

This section is empty.

Types

type GitHubAPI

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

func NewGitHubAPI

func NewGitHubAPI(c *config.Config) (*GitHubAPI, error)

func (*GitHubAPI) AddPullRequestComment

func (c *GitHubAPI) AddPullRequestComment(ctx context.Context, org, repo string, number int, comment string) (ic *github.IssueComment, err error)

AddPullRequestComment adds a comment to a PR

func (*GitHubAPI) AddPullRequestLabel

func (c *GitHubAPI) AddPullRequestLabel(ctx context.Context, org, repo string, number int, label string) (err error)

AddPullRequestLabel adds a label to a PR. The label should exist beforehand.

func (*GitHubAPI) GetAdminTeams

func (c *GitHubAPI) GetAdminTeams(ctx context.Context, org, repo string) (adminTeams []*github.Team, err error)

ValidateTeam validates a team owns a given repo

func (*GitHubAPI) IsSkeemaCheckStatusPassingForPullRequest

func (c *GitHubAPI) IsSkeemaCheckStatusPassingForPullRequest(ctx context.Context, org, repo string, number int, skeemaCheckName string) (passing bool, err error)

func (*GitHubAPI) IsTeamMember

func (c *GitHubAPI) IsTeamMember(ctx context.Context, org, user string, teamSlug string) (isMember bool, err error)

IsTeamMember checks if a given user (login) is member of given team (slug) The result of this function is cached.

func (*GitHubAPI) PullRequestApprovedBySomeone

func (c *GitHubAPI) PullRequestApprovedBySomeone(ctx context.Context, org, repo string, number int) (approved bool, err error)

PullRequestApprovedBySomeone sees if there's at least one APPROVED review on the PR.

func (*GitHubAPI) PullRequestApprovedByTeam

func (c *GitHubAPI) PullRequestApprovedByTeam(ctx context.Context, org, repo string, number int, teamSlug string) (approvedByTeam bool, err error)

ReadPullRequest reads and returns a pull request

func (*GitHubAPI) ReadPullRequest

func (c *GitHubAPI) ReadPullRequest(ctx context.Context, org, repo string, number int) (pr *github.PullRequest, err error)

ReadPullRequest reads and returns a pull request

func (*GitHubAPI) ReadPullRequestApprovedByAdmin

func (c *GitHubAPI) ReadPullRequestApprovedByAdmin(ctx context.Context, org, repo string, number int) (user *github.User, err error)

ReadPullRequest reads and returns a pull request

func (*GitHubAPI) ReadPullRequestSkeemaDiffMagicComment

func (c *GitHubAPI) ReadPullRequestSkeemaDiffMagicComment(ctx context.Context, org, repo string, number int) (ic *github.IssueComment, err error)

ReadPullRequest reads and returns a pull request

func (*GitHubAPI) RemovePullRequestLabel

func (c *GitHubAPI) RemovePullRequestLabel(ctx context.Context, org, repo string, number int, label string) (err error)

AddPullRequestLabel adds a label to a PR. The label should exist beforehand.

func (*GitHubAPI) RequestPullRequestReview

func (c *GitHubAPI) RequestPullRequestReview(ctx context.Context, org, repo string, number int, teamSlug string) (newlyRequested bool, err error)

RequestPullRequestReview requests a review on a given PR from a given team

func (*GitHubAPI) SearchSkeemaDiffUndetectedPRs

func (c *GitHubAPI) SearchSkeemaDiffUndetectedPRs(ctx context.Context, orgRepo string) (issuesSearchResult *github.IssuesSearchResult, searchString string, err error)

func (*GitHubAPI) TeamRequestedToReviewPullRequest

func (c *GitHubAPI) TeamRequestedToReviewPullRequest(ctx context.Context, org, repo string, number int, teamSlug string) (requested bool, err error)

TeamRequestedToReviewPullRequest checks if a team is already requested to review a PR

func (*GitHubAPI) ValidateAdminTeam

func (c *GitHubAPI) ValidateAdminTeam(ctx context.Context, org, repo string, teamSlug string) (isAdmin bool, err error)

ValidateTeam validates a team owns a given repo

func (*GitHubAPI) ValidateAdminUser

func (c *GitHubAPI) ValidateAdminUser(ctx context.Context, org, repo string, user string) (isAdmin bool, err error)

ValidateAdminUser validates that a user is an admin of a repo

func (*GitHubAPI) ValidateRepo

func (c *GitHubAPI) ValidateRepo(ctx context.Context, org, repo string) (repository *github.Repository, err error)

ValidateRepo validates that a requested repository exists and is accessible

Jump to

Keyboard shortcuts

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