github

package
v4.21.0 Latest Latest
Warning

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

Go to latest
Published: Oct 30, 2023 License: LGPL-3.0 Imports: 27 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	ErrProjectHasNoStatusField    = errors.New("project has no status field")
	ErrProjectHasNoSuchField      = errors.New("project field not found")
	ErrProjectHasNoSuchFieldValue = errors.New("project field value not found")
	ErrProjectItemsNotFound       = errors.New("project items not found")
	ErrProjectNotFound            = errors.New("project not found")
	ErrProjectStatusNotFound      = errors.New("project status not found")
	ErrProjectItemNotFound        = errors.New("project item not found")
)
View Source
var (
	ErrDiscussionNotFound = errors.New("discussion not found")
)

Functions

func CheckoutBranch

func CheckoutBranch(log *logrus.Entry, repo *git.Repository, branchName string) error

CheckoutBranch checks out a given branch in the given repository.

func CloneRepository

func CloneRepository(log *logrus.Entry, url string, token string, path string, options *git.CloneOptions) (*git.Repository, string, error)

CloneRepository clones a repository from a given URL to the provided path. url needs to be an HTTPS uri (e.g. https://github.com/libgit2/TestGitRepository) path can be empty. In this case, the repository will be cloned to a temporary location and the location is returned.

func GetPullRequestBaseOwnerName

func GetPullRequestBaseOwnerName(pullRequest *pbc.PullRequest) string

func GetPullRequestBaseRepoName

func GetPullRequestBaseRepoName(pullRequest *pbc.PullRequest) string

func GetPullRequestHeadOwnerName

func GetPullRequestHeadOwnerName(pullRequest *pbc.PullRequest) string

func GetPullRequestHeadRepoName

func GetPullRequestHeadRepoName(pullRequest *pbc.PullRequest) string

func GetPullRequestNumber

func GetPullRequestNumber(pullRequest *pbc.PullRequest) int64

func PaginatedRequest

func PaginatedRequest(
	initFn func() interface{},
	reqFn func(interface{}, int) (interface{}, *github.Response, error),
) (interface{}, error)

func ParseNumPages

func ParseNumPages(resp *github.Response) int

ParseNumPages Given a link header string representing pagination info, returns total number of pages.

func ParseNumPagesFromLink(link string) int

func Push

func Push(log *logrus.Entry, repo *git.Repository, remoteName string, branchName string, token string, force bool) error

Push performs a push of the provided remote/branch.

func RebaseOnto

func RebaseOnto(log *logrus.Entry, repo *git.Repository, branchName string, rebaseOptions *git.RebaseOptions) error

RebaseOnto performs a rebase of the current repository Head onto the given branch. Inspired by https://github.com/libgit2/git2go/blob/main/rebase_test.go#L359

Types

type AddDiscussionCommentMutation added in v4.10.0

type AddDiscussionCommentMutation struct {
	AddDiscussionComment struct {
		ClientMutationID string
	} `graphql:"addDiscussionComment(input: $input)"`
}

type AddProjectV2ItemByIdInput

type AddProjectV2ItemByIdInput struct {
	ProjectID string `json:"projectId"`
	ContentID string `json:"contentId"`
	// A unique identifier for the client performing the mutation. (Optional.)
	ClientMutationID *string `json:"clientMutationId,omitempty"`
}

type AddPullRequestToMergeQueueMutation added in v4.12.0

type AddPullRequestToMergeQueueMutation struct {
	EnqueuePullRequest struct {
		ClientMutationID string
	} `graphql:"enqueuePullRequest(input: $input)"`
}

type AddReactionMutation added in v4.10.0

type AddReactionMutation struct {
	AddReaction struct {
		ClientMutationID string
	} `graphql:"addReaction(input: $input)"`
}

type CommitStatus

type CommitStatus struct {
	ID  uint64 `json:"id"`
	URL string `json:"url"`
}

type CompareBaseAndHeadQuery

type CompareBaseAndHeadQuery struct {
	Repository struct {
		PullRequest struct {
			BaseRefOID string
			BaseRef    struct {
				Target struct {
					Commit struct {
						History struct {
							Nodes []struct {
								OID string
							}
						} `graphql:"history(first: 1)"`
					} `graphql:"... on Commit"`
				} `graphql:"target"`
			} `graphql:"baseRef"`
		} `graphql:"pullRequest(number: $number)"`
	} `graphql:"repository(owner: $owner, name: $name)"`
}

type CreateCommitStatusOptions

type CreateCommitStatusOptions struct {
	State       string `json:"state"`
	Context     string `json:"context"`
	Description string `json:"description"`
}

type DeleteProjectV2ItemMutation

type DeleteProjectV2ItemMutation struct {
	DeleteProjectV2Item struct {
		ClientMutationID string
	} `graphql:"deleteProjectV2Item(input: $input)"`
}

type DiscussionComment added in v4.10.0

type DiscussionComment struct {
	ID          string
	Body        string
	AuthorLogin string
}

type DownloadContentsOptions added in v4.13.0

type DownloadContentsOptions struct {
	Method DownloadMethod
}

type DownloadMethod added in v4.13.0

type DownloadMethod string
const (
	DownloadMethodSHA        DownloadMethod = "withSHA"
	DownloadMethodBranchName DownloadMethod = "withBranchName"
)

type FieldDetails

type FieldDetails struct {
	ID       string
	Name     string
	DataType string
}

type FieldNode

type FieldNode struct {
	TypeName                 string                   `graphql:"__typename"`
	SingleSelectFieldDetails SingleSelectFieldDetails `graphql:"... on ProjectV2SingleSelectField"`
	FieldDetails             FieldDetails             `graphql:"... on ProjectV2Field"`
}

type FieldValue

type FieldValue interface{}

type Fields

type Fields struct {
	PageInfo PageInfo
	Nodes    []FieldNode
}

type FileSliceLimits

type FileSliceLimits struct {
	From uint64
	To   uint64
}

type FirstCommitAndReviewDateQuery

type FirstCommitAndReviewDateQuery struct {
	Repository struct {
		PullRequest struct {
			Commits struct {
				Nodes []struct {
					Commit struct {
						AuthoredDate time.Time
					}
				}
			} `graphql:"commits(first: 1)"`
			Reviews struct {
				Nodes []struct {
					CreatedAt time.Time
				}
			} `graphql:"reviews(first: 1)"`
		} `graphql:"pullRequest(number: $pullRequestNumber)"`
	} `graphql:"repository(owner: $repositoryOwner, name: $repositoryName)"`
}

type GQLProjectV2Item

type GQLProjectV2Item struct {
	ID      string
	Project ProjectV2
}

type GQLReviewThread

type GQLReviewThread struct {
	IsResolved githubv4.Boolean
	IsOutdated githubv4.Boolean
}

type GetAllReviewersApprovedQuery added in v4.18.0

type GetAllReviewersApprovedQuery struct {
	Repository struct {
		PullRequest struct {
			ReviewRequests struct {
				TotalCount int `graphql:"totalCount"`
			} `graphql:"reviewRequests"`
			LatestReviews struct {
				Nodes []struct {
					State string `graphql:"state"`
				}
			} `graphql:"latestReviews(first: 100)"`
		} `graphql:"pullRequest(number: $number)"`
	} `graphql:"repository(owner: $owner, name: $name)"`
}

type GetAllReviewersQuery added in v4.18.0

type GetAllReviewersQuery struct {
	Repository struct {
		PullRequest struct {
			ReviewRequests struct {
				Nodes []struct {
					RequestedReviewer struct {
						User struct {
							Login string `graphql:"login"`
						} `graphql:"... on User"`
						Team struct {
							Slug string `graphql:"slug"`
						} `graphql:"... on Team"`
					} `graphql:"requestedReviewer"`
				}
			} `graphql:"reviewRequests(first: 100)"`
			Reviews struct {
				Nodes []struct {
					State  string `graphql:"state"`
					Author struct {
						Login string `graphql:"login"`
					}
				}
			} `graphql:"latestReviews(first: 100)"`
		} `graphql:"pullRequest(number: $number)"`
	} `graphql:"repository(owner: $owner, name: $name)"`
}

type GetApprovalsCountQuery

type GetApprovalsCountQuery struct {
	Repository struct {
		PullRequest struct {
			Reviews struct {
				TotalCount int `graphql:"totalCount"`
			} `graphql:"reviews(first: 1, states: [APPROVED])"`
		} `graphql:"pullRequest(number: $pullRequestNumber)"`
	} `graphql:"repository(owner: $repositoryOwner, name: $repositoryName)"`
}

type GetDiscussionCommentsQuery added in v4.10.0

type GetDiscussionCommentsQuery struct {
	Repository struct {
		Discussion struct {
			ID     string
			Body   string
			Author struct {
				Login string
			}
			Comments struct {
				PageInfo PageInfo
				Nodes    []struct {
					ID     string
					Body   string
					Author struct {
						Login string
					}
				}
			} `graphql:"comments(first: 50, after: $afterCursor)"`
		} `graphql:"discussion(number: $number)"`
	} `graphql:"repository(owner: $owner, name: $name)"`
}

type GetDiscussionIDQuery added in v4.10.0

type GetDiscussionIDQuery struct {
	Repository struct {
		Discussion struct {
			ID string
		} `graphql:"discussion(number: $number)"`
	} `graphql:"repository(owner: $owner, name: $name)"`
}

type GetIssueProjectItemsQuery

type GetIssueProjectItemsQuery struct {
	Repository struct {
		Issue struct {
			ProjectItems struct {
				PageInfo PageInfo
				Nodes    []struct {
					Project struct {
						ID string
					}
					ID string
				}
			} `graphql:"projectItems(first: 100, after: $afterCursor)"`
		} `graphql:"issue(number: $number)"`
	} `graphql:"repository(owner: $owner, name: $name)"`
}

type GetLastCommitSHAQuery

type GetLastCommitSHAQuery struct {
	Repository struct {
		PullRequest struct {
			Commits struct {
				Nodes []struct {
					Commit struct {
						OID string
					}
				}
			} `graphql:"commits(last: 1)"`
		} `graphql:"pullRequest(number: $pullRequestNumber)"`
	} `graphql:"repository(owner: $repositoryOwner, name: $repositoryName)"`
}

type GetObjectQuery

type GetObjectQuery struct {
	Repository struct {
		Object struct {
			Blog struct {
				IsBinary bool
			} `graphql:"... on Blob"`
		} `graphql:"object(expression: $expression)"`
	} `graphql:"repository(owner: $repositoryOwner, name: $repositoryName)"`
}

type GetPullRequestProjectItemsQuery

type GetPullRequestProjectItemsQuery struct {
	Repository struct {
		PullRequest struct {
			ProjectItems struct {
				PageInfo PageInfo
				Nodes    []struct {
					Project struct {
						ID string
					}
					ID string
				}
			} `graphql:"projectItems(first: 100, after: $afterCursor)"`
		} `graphql:"pullRequest(number: $number)"`
	} `graphql:"repository(owner: $owner, name: $name)"`
}

type GetRefIDQuery

type GetRefIDQuery struct {
	Repository struct {
		Ref struct {
			ID string
		} `graphql:"ref(qualifiedName: $ref)"`
	} `graphql:"repository(owner: $owner, name: $repo)"`
}

type GitBlame

type GitBlame struct {
	CommitSHA string
	Files     map[string]GitBlameFile
}

type GitBlameAuthorRank

type GitBlameAuthorRank struct {
	Username   string
	TotalLines int
}

type GitBlameFile

type GitBlameFile struct {
	FilePath  string
	LineCount uint64
	Lines     []GitBlameFileLines
}

type GitBlameFileLines

type GitBlameFileLines struct {
	FromLine uint64
	ToLine   uint64
	Author   string
}

type GitBlameQuery

type GitBlameQuery struct {
	Repository struct {
		Object map[string]struct {
			Ranges []struct {
				StartingLine uint64
				EndingLine   uint64
				Age          uint64
				Commit       struct {
					Author struct {
						User struct {
							Login string
						}
					}
				}
			}
		}
	}
}

type GithubAppClient

type GithubAppClient struct {
	*github.Client
}

func NewGithubAppClient

func NewGithubAppClient(gitHubAppID int64, gitHubAppPrivateKey []byte) (*GithubAppClient, error)

func (*GithubAppClient) CreateInstallationToken

func (c *GithubAppClient) CreateInstallationToken(ctx context.Context, id int64, opts *github.InstallationTokenOptions) (*github.InstallationToken, error)

CreateInstallationToken creates a new installation token for the github app. For more details see https://docs.github.com/en/rest/apps/apps#create-an-installation-access-token-for-an-app

func (*GithubAppClient) GetInstallations

func (c *GithubAppClient) GetInstallations(ctx context.Context) ([]*github.Installation, error)

GetInstallations returns all installations for the github app. For more details see https://docs.github.com/en/rest/apps/apps#list-installations-for-the-authenticated-app

type GithubClient

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

func NewGithubClient

func NewGithubClient(clientREST *github.Client, clientGQL *githubv4.Client, rawClientGQL *graphql.Client, logger *logrus.Entry) *GithubClient

func NewGithubClientFromToken

func NewGithubClientFromToken(ctx context.Context, token string, logger *logrus.Entry) *GithubClient

func (*GithubClient) AddAssignees

func (c *GithubClient) AddAssignees(ctx context.Context, owner string, repo string, number int, assignees []string) (*github.Issue, *github.Response, error)

func (*GithubClient) AddCommentToDiscussion added in v4.10.0

func (c *GithubClient) AddCommentToDiscussion(ctx context.Context, discussionID, body string) error

func (*GithubClient) AddLabels

func (c *GithubClient) AddLabels(ctx context.Context, owner string, repo string, number int, labels []string) ([]*github.Label, *github.Response, error)

func (*GithubClient) AddPullRequestToGithubMergeQueue added in v4.12.0

func (c *GithubClient) AddPullRequestToGithubMergeQueue(ctx context.Context, pullRequestID string) error

func (*GithubClient) AddReactionToDiscussionComment added in v4.10.0

func (c *GithubClient) AddReactionToDiscussionComment(ctx context.Context, subjectID string, reaction githubv4.ReactionContent) error

func (*GithubClient) ComputeGitBlameRank

func (c *GithubClient) ComputeGitBlameRank(gitBlame *GitBlame) []GitBlameAuthorRank

func (*GithubClient) CreateComment

func (c *GithubClient) CreateComment(ctx context.Context, owner string, repo string, number int, comment *github.IssueComment) (*github.IssueComment, *github.Response, error)

func (*GithubClient) CreateCommitStatus

func (c *GithubClient) CreateCommitStatus(ctx context.Context, owner string, repo string, headSHA string, opt *CreateCommitStatusOptions) (*CommitStatus, error)

func (*GithubClient) CreateLabel

func (c *GithubClient) CreateLabel(ctx context.Context, owner string, repo string, label *github.Label) (*github.Label, *github.Response, error)

func (*GithubClient) DeleteComment

func (c *GithubClient) DeleteComment(ctx context.Context, owner string, repo string, commentId int64) (*github.Response, error)

func (*GithubClient) DeleteProjectV2Item

func (c *GithubClient) DeleteProjectV2Item(ctx context.Context, projectID, itemID string) error

func (*GithubClient) DeleteReference

func (c *GithubClient) DeleteReference(ctx context.Context, owner, repo, ref string) error

func (*GithubClient) DownloadContents

func (c *GithubClient) DownloadContents(ctx context.Context, filePath string, branch *pbc.Branch, options *DownloadContentsOptions) ([]byte, error)

func (*GithubClient) EditComment

func (c *GithubClient) EditComment(ctx context.Context, owner string, repo string, commentId int64, comment *github.IssueComment) (*github.IssueComment, *github.Response, error)

func (*GithubClient) EditIssue

func (c *GithubClient) EditIssue(ctx context.Context, owner string, repo string, number int, issue *github.IssueRequest) (*github.Issue, *github.Response, error)

func (*GithubClient) EditLabel

func (c *GithubClient) EditLabel(ctx context.Context, owner string, repo string, name string, label *github.Label) (*github.Label, *github.Response, error)

func (*GithubClient) EditPullRequest

func (c *GithubClient) EditPullRequest(ctx context.Context, owner string, repo string, number int, pull *github.PullRequest) (*github.PullRequest, *github.Response, error)

func (*GithubClient) GetAllReviewers added in v4.18.0

func (c *GithubClient) GetAllReviewers(ctx context.Context, owner, repo, state string, number int) ([]string, error)

func (*GithubClient) GetAllReviewersApproved added in v4.18.0

func (c *GithubClient) GetAllReviewersApproved(ctx context.Context, owner, repo string, number int) (bool, error)

func (*GithubClient) GetApprovalsCount

func (c *GithubClient) GetApprovalsCount(ctx context.Context, owner, repo string, number int) (int, error)

func (*GithubClient) GetAuthenticatedUserLogin

func (c *GithubClient) GetAuthenticatedUserLogin() (string, error)

func (*GithubClient) GetCheckRunsForRef

func (c *GithubClient) GetCheckRunsForRef(ctx context.Context, owner string, repo string, number int, ref string, opts *github.ListCheckRunsOptions) ([]*github.CheckRun, error)

func (*GithubClient) GetClientGraphQL

func (c *GithubClient) GetClientGraphQL() *githubv4.Client

func (*GithubClient) GetClientREST

func (c *GithubClient) GetClientREST() *github.Client

FIXME: Remove these to hide the implementation details.

func (*GithubClient) GetComments

func (c *GithubClient) GetComments(ctx context.Context, owner string, repo string, number int, opts *github.IssueListCommentsOptions) ([]*github.IssueComment, error)

func (*GithubClient) GetDefaultRepositoryBranch

func (c *GithubClient) GetDefaultRepositoryBranch(ctx context.Context, owner string, repo string) (string, error)

func (*GithubClient) GetDiscussionComments added in v4.10.0

func (c *GithubClient) GetDiscussionComments(ctx context.Context, owner, repo string, discussionNum int) ([]DiscussionComment, error)

GetDiscussionComments returns the discussion comments for a given discussion number. The first element of the list is the body of the discussion.

func (*GithubClient) GetDiscussionID added in v4.10.0

func (c *GithubClient) GetDiscussionID(ctx context.Context, owner, repo string, discussionNum int) (string, error)

func (*GithubClient) GetFirstCommitAndReviewDate

func (c *GithubClient) GetFirstCommitAndReviewDate(ctx context.Context, owner, repo string, number int) (*time.Time, *time.Time, error)

func (*GithubClient) GetGitBlame

func (c *GithubClient) GetGitBlame(ctx context.Context, owner, name, commitSHA string, filePaths []string) (*GitBlame, error)

func (*GithubClient) GetGitHubMergeQueueEntries added in v4.12.0

func (c *GithubClient) GetGitHubMergeQueueEntries(ctx context.Context, repoOwner, repoName, branch string, retryCount int) ([]int, error)

func (*GithubClient) GetIssue

func (c *GithubClient) GetIssue(ctx context.Context, owner, repo string, number int) (*github.Issue, *github.Response, error)

func (*GithubClient) GetIssueProjectV2ItemID

func (c *GithubClient) GetIssueProjectV2ItemID(ctx context.Context, owner, repo, projectID string, issueNum int) (string, error)

GetIssueProjectV2ItemID returns the project item ID for an issue. Each item on a project board is represented by a project item.

func (*GithubClient) GetIssueTimeline

func (c *GithubClient) GetIssueTimeline(ctx context.Context, owner string, repo string, number int) ([]*github.Timeline, error)

func (*GithubClient) GetIssuesAvailableAssignees

func (c *GithubClient) GetIssuesAvailableAssignees(ctx context.Context, owner string, repo string) ([]*github.User, error)

func (*GithubClient) GetLabel

func (c *GithubClient) GetLabel(ctx context.Context, owner string, repo string, name string) (*github.Label, *github.Response, error)

func (*GithubClient) GetLastCommitSHA

func (c *GithubClient) GetLastCommitSHA(ctx context.Context, owner, repo string, number int) (string, error)

func (*GithubClient) GetLinkedProjectsForIssue

func (c *GithubClient) GetLinkedProjectsForIssue(ctx context.Context, owner, repo string, number int, retryCount int) ([]GQLProjectV2Item, error)

func (*GithubClient) GetLinkedProjectsForPullRequest

func (c *GithubClient) GetLinkedProjectsForPullRequest(ctx context.Context, owner, repo string, number int, retryCount int) ([]GQLProjectV2Item, error)

func (*GithubClient) GetOpenPullRequestsAsReviewer

func (c *GithubClient) GetOpenPullRequestsAsReviewer(ctx context.Context, owner string, repo string, usernames []string) (map[string]int, error)

func (*GithubClient) GetOrganizationTeams added in v4.18.0

func (c *GithubClient) GetOrganizationTeams(ctx context.Context, owner string) ([]string, error)

func (*GithubClient) GetProjectFieldsByProjectNumber

func (c *GithubClient) GetProjectFieldsByProjectNumber(ctx context.Context, owner, repo string, projectNumber uint64, retryCount int) ([]FieldNode, error)

func (*GithubClient) GetProjectV2ByName

func (c *GithubClient) GetProjectV2ByName(ctx context.Context, owner, repo, name string) (*ProjectV2, error)

func (*GithubClient) GetPullRequest

func (c *GithubClient) GetPullRequest(ctx context.Context, owner string, repo string, number int) (*github.PullRequest, *github.Response, error)

func (*GithubClient) GetPullRequestClosingIssuesCount

func (c *GithubClient) GetPullRequestClosingIssuesCount(ctx context.Context, owner string, repo string, number int) (int, error)

func (*GithubClient) GetPullRequestCommits

func (c *GithubClient) GetPullRequestCommits(ctx context.Context, owner string, repo string, number int) ([]*github.RepositoryCommit, error)

func (*GithubClient) GetPullRequestFiles

func (c *GithubClient) GetPullRequestFiles(ctx context.Context, owner string, repo string, number int) ([]*github.CommitFile, error)

func (*GithubClient) GetPullRequestLastPushDate

func (c *GithubClient) GetPullRequestLastPushDate(ctx context.Context, owner string, repo string, number int) (time.Time, error)

func (*GithubClient) GetPullRequestProjectV2ItemID

func (c *GithubClient) GetPullRequestProjectV2ItemID(ctx context.Context, owner, repo, projectID string, prNum int) (string, error)

GetPullRequestProjectV2ItemID returns the project item ID for a pull request. Each item on a project board is represented by a project item.

func (*GithubClient) GetPullRequestReviewers

func (c *GithubClient) GetPullRequestReviewers(ctx context.Context, owner string, repo string, number int, opts *github.ListOptions) (*github.Reviewers, error)

func (*GithubClient) GetPullRequestReviews

func (c *GithubClient) GetPullRequestReviews(ctx context.Context, owner string, repo string, number int) ([]*github.PullRequestReview, error)

func (*GithubClient) GetPullRequestUpToDate added in v4.10.0

func (c *GithubClient) GetPullRequestUpToDate(ctx context.Context, owner, repo string, number int) (bool, error)

func (*GithubClient) GetPullRequests

func (c *GithubClient) GetPullRequests(ctx context.Context, owner string, repo string) ([]*github.PullRequest, error)

func (*GithubClient) GetRawClientGraphQL

func (c *GithubClient) GetRawClientGraphQL() *graphql.Client

func (*GithubClient) GetRepoCollaborators

func (c *GithubClient) GetRepoCollaborators(ctx context.Context, owner string, repo string) ([]*github.User, error)

func (*GithubClient) GetRepositoryBranch

func (c *GithubClient) GetRepositoryBranch(ctx context.Context, owner string, repo string, branch string, followRedirects bool) (*github.Branch, *github.Response, error)

func (*GithubClient) GetReviewThreads

func (c *GithubClient) GetReviewThreads(ctx context.Context, owner string, repo string, number int, retryCount int) ([]GQLReviewThread, error)

func (*GithubClient) GetToken

func (c *GithubClient) GetToken() string

func (*GithubClient) GetTotalRequests added in v4.19.0

func (c *GithubClient) GetTotalRequests() uint64

func (*GithubClient) GetUserTeams added in v4.18.0

func (c *GithubClient) GetUserTeams(ctx context.Context, owner string, login string) ([]string, error)

func (*GithubClient) IsFileBinary

func (c *GithubClient) IsFileBinary(ctx context.Context, owner, repo, branch, file string) (bool, error)

func (*GithubClient) IsGithubMergeQueueEnabled added in v4.12.0

func (c *GithubClient) IsGithubMergeQueueEnabled(ctx context.Context, repoOwner, repoName, branch string) (bool, error)

func (*GithubClient) ListCheckRunsForRef

func (c *GithubClient) ListCheckRunsForRef(ctx context.Context, owner string, repo string, ref string, opts *github.ListCheckRunsOptions) (*github.ListCheckRunsResults, *github.Response, error)

func (*GithubClient) ListIssuesByRepo

func (c *GithubClient) ListIssuesByRepo(ctx context.Context, owner string, repo string, opts *github.IssueListByRepoOptions) ([]*github.Issue, *github.Response, error)

func (*GithubClient) ListOrganizationMembers

func (c *GithubClient) ListOrganizationMembers(ctx context.Context, org string, opts *github.ListMembersOptions) ([]*github.User, *github.Response, error)

func (*GithubClient) ListTeamMembersBySlug

func (c *GithubClient) ListTeamMembersBySlug(ctx context.Context, org string, slug string, opts *github.TeamListTeamMembersOptions) ([]*github.User, *github.Response, error)

func (*GithubClient) Merge

func (c *GithubClient) Merge(ctx context.Context, owner string, repo string, number int, commitMessage string, options *github.PullRequestOptions) (*github.PullRequestMergeResult, *github.Response, error)

func (*GithubClient) RefExists

func (c *GithubClient) RefExists(ctx context.Context, owner, repo, ref string) (bool, error)

func (*GithubClient) RemoveLabelForIssue

func (c *GithubClient) RemoveLabelForIssue(ctx context.Context, owner string, repo string, number int, label string) (*github.Response, error)

func (*GithubClient) RemoveReactionToDiscussionComment added in v4.10.0

func (c *GithubClient) RemoveReactionToDiscussionComment(ctx context.Context, subjectID string, reaction githubv4.ReactionContent) error

func (*GithubClient) RequestReviewers

func (c *GithubClient) RequestReviewers(ctx context.Context, owner string, repo string, number int, reviewers github.ReviewersRequest) (*github.PullRequest, *github.Response, error)

func (*GithubClient) Review

func (*GithubClient) RoundTrip added in v4.19.0

func (t *GithubClient) RoundTrip(req *http.Request) (*http.Response, error)

func (*GithubClient) SliceGitBlame

func (c *GithubClient) SliceGitBlame(blame *GitBlame, filePath string, slices []FileSliceLimits) (*GitBlame, error)

func (*GithubClient) TriggerWorkflowByFileName

func (c *GithubClient) TriggerWorkflowByFileName(ctx context.Context, owner, repo, branch, workflowFileName string) (*github.Response, error)

func (*GithubClient) WithLogger added in v4.19.0

func (c *GithubClient) WithLogger(ctx context.Context, logger *logrus.Entry) *GithubClient

type GraphQLRateLimitResponse added in v4.19.0

type GraphQLRateLimitResponse struct {
	Data struct {
		RateLimit struct {
			Limit     int    `json:"limit"`
			Cost      int    `json:"cost"`
			Remaining int    `json:"remaining"`
			ResetAt   string `json:"resetAt"`
		} `json:"rateLimit"`
	} `json:"data"`
}

type GraphQLRequest added in v4.19.0

type GraphQLRequest struct {
	Query         string                 `json:"query"`
	Variables     map[string]interface{} `json:"variables,omitempty"`
	OperationName *string                `json:"operationName,omitempty"`
}

type IssueLinkedProjectsQuery

type IssueLinkedProjectsQuery struct {
	Repository struct {
		Issue struct {
			ProjectItems *struct {
				Nodes    []GQLProjectV2Item
				PageInfo struct {
					EndCursor   githubv4.String
					HasNextPage bool
				}
			} `graphql:"projectItems(first: 10, after: $projectItemsCursor)"`
		} `graphql:"issue(number: $issueNumber)"`
	} `graphql:"repository(owner: $repositoryOwner, name: $repositoryName)"`
}

type LastFiftyOpenedPullRequestsQuery

type LastFiftyOpenedPullRequestsQuery struct {
	Repository struct {
		PullRequests struct {
			Nodes []PullRequestsQuery
		} `graphql:"pullRequests(states: OPEN, last: 50)"`
	} `graphql:"repository(owner: $owner, name: $name)"`
}

type LastPushQuery

type LastPushQuery struct {
	Repository struct {
		PullRequest struct {
			TimelineItems struct {
				Nodes []struct {
					Typename                string `graphql:"__typename"`
					HeadRefForcePushedEvent struct {
						CreatedAt *time.Time
					} `graphql:"... on HeadRefForcePushedEvent"`
					PullRequestCommit struct {
						Commit struct {
							PushedDate    *time.Time
							CommittedDate *time.Time
						}
					} `graphql:"... on PullRequestCommit"`
				}
			} `graphql:"timelineItems(last: 1, itemTypes: [HEAD_REF_FORCE_PUSHED_EVENT, PULL_REQUEST_COMMIT])"`
		} `graphql:"pullRequest(number: $pullRequestNumber)"`
	} `graphql:"repository(owner: $repositoryOwner, name: $repositoryName)"`
}

type MergeQueueEntriesQuery added in v4.12.0

type MergeQueueEntriesQuery struct {
	Repository struct {
		MergeQueue struct {
			ID      string
			Entries struct {
				Nodes []struct {
					PullRequest struct {
						Number int
					}
				}
				PageInfo struct {
					EndCursor   githubv4.String
					HasNextPage bool
				}
			} `graphql:"entries(first: 100, after: $cursor)"`
		} `graphql:"mergeQueue(branch: $branchName)"`
	} `graphql:"repository(owner: $repositoryOwner, name: $repositoryName)"`
}

type MergeQueueQuery added in v4.12.0

type MergeQueueQuery struct {
	Repository struct {
		MergeQueue struct {
			ID string
		} `graphql:"mergeQueue(branch: $branchName)"`
	} `graphql:"repository(owner: $repositoryOwner, name: $repositoryName)"`
}

type NumberFieldValue

type NumberFieldValue struct {
	Number githubv4.Float `json:"number"`
}

type OrganizationTeamsQuery added in v4.18.0

type OrganizationTeamsQuery struct {
	RepositoryOwner struct {
		Organization struct {
			Teams struct {
				PageInfo struct {
					HasNextPage bool   `graphql:"hasNextPage"`
					EndCursor   string `graphql:"endCursor"`
				}
				Nodes []struct {
					Slug string `graphql:"slug"`
				}
			} `graphql:"teams(first: 100, after: $cursor)"`
		} `graphql:"... on Organization"`
	} `graphql:"repositoryOwner(login: $owner)"`
}

type PageInfo

type PageInfo struct {
	HasNextPage bool
	EndCursor   string
}

type ProjectV2

type ProjectV2 struct {
	ID     string
	Number uint64
	Title  string
}

type PullRequestLinkedProjectsQuery

type PullRequestLinkedProjectsQuery struct {
	Repository struct {
		PullRequest struct {
			ProjectItems *struct {
				Nodes    []GQLProjectV2Item
				PageInfo struct {
					EndCursor   githubv4.String
					HasNextPage bool
				}
			} `graphql:"projectItems(first: 10, after: $projectItemsCursor)"`
		} `graphql:"pullRequest(number: $issueNumber)"`
	} `graphql:"repository(owner: $repositoryOwner, name: $repositoryName)"`
}

type PullRequestsQuery

type PullRequestsQuery struct {
	ReviewRequests struct {
		Nodes []struct {
			RequestedReviewer struct {
				TypeName string `graphql:"__typename"`
				AsUser   struct {
					Login githubv4.String
				} `graphql:"... on User"`
			}
		}
	} `graphql:"reviewRequests(first: 50)"`
	Reviews struct {
		Nodes []struct {
			Author struct {
				Login githubv4.String
			}
		}
	} `graphql:"reviews(first: 50)"`
}

type RemoveReactionMutation added in v4.10.0

type RemoveReactionMutation struct {
	RemoveReaction struct {
		ClientMutationID string
	} `graphql:"removeReaction(input: $input)"`
}

type ReviewThreadsQuery

type ReviewThreadsQuery struct {
	Repository struct {
		PullRequest struct {
			ReviewThreads struct {
				Nodes    []GQLReviewThread
				PageInfo struct {
					EndCursor   githubv4.String
					HasNextPage bool
				}
			} `graphql:"reviewThreads(first: 10, after: $reviewThreadsCursor)"`
		} `graphql:"pullRequest(number: $pullRequestNumber)"`
	} `graphql:"repository(owner: $repositoryOwner, name: $repositoryName)"`
}

type SingleSelectFieldDetails

type SingleSelectFieldDetails struct {
	ID      string
	Name    string
	Options []struct {
		ID   string
		Name string
	}
}

type SingleSelectFieldValue

type SingleSelectFieldValue struct {
	SingleSelectOptionId string `json:"singleSelectOptionId"`
}

type TextFieldValue

type TextFieldValue struct {
	Text string `json:"text"`
}

type UpdateProjectV2ItemFieldValueInput

type UpdateProjectV2ItemFieldValueInput struct {
	ItemID    string     `json:"itemId"`
	Value     FieldValue `json:"value"`
	ProjectID string     `json:"projectId"`
	FieldID   string     `json:"fieldId"`
}

type UserTeamsQuery added in v4.18.0

type UserTeamsQuery struct {
	RepositoryOwner struct {
		Organization struct {
			Teams struct {
				PageInfo struct {
					HasNextPage bool   `graphql:"hasNextPage"`
					EndCursor   string `graphql:"endCursor"`
				}
				Nodes []struct {
					Slug string `graphql:"slug"`
				}
			} `graphql:"teams(first: 100, userLogins: [$login], after: $cursor)"`
		} `graphql:"... on Organization"`
	} `graphql:"repositoryOwner(login: $owner)"`
}

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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