Documentation
¶
Index ¶
- Variables
- func FetchLatestReleaseTag(ctx context.Context, client *http.Client, owner string, repo string) (string, error)
- type CreatePROptions
- type CreateReleaseOptions
- type Github
- func New(git git.Git, cfg *viper.Viper) (Github, error)
- func NewAuthOnly(cfg *viper.Viper) (Github, error)
- func NewAuthOnlyWithOptions(cfg *viper.Viper, allowPrompt bool) (Github, error)
- func NewWithHTTPClient(g git.Git, cfg *viper.Viper, httpClient *http.Client, baseURL string) (Github, error)
- func NewWithHTTPClientAndRepo(g git.Git, cfg *viper.Viper, httpClient *http.Client, ...) (Github, error)
- func NewWithOptions(git git.Git, cfg *viper.Viper, allowPrompt bool) (Github, error)
- type GithubConfig
- type Label
- type NativeStackClient
- type PullRequest
- type PullRequestBodyUpdate
- type PullRequestConversation
- type PullRequestDiscussion
- type PullRequestIssueComment
- type PullRequestLoader
- type PullRequestReview
- type PullRequestReviewComment
- type PullRequestStack
- type Release
- type Team
- type UpdatePROptions
- type User
Constants ¶
This section is empty.
Variables ¶
var ErrAuthRequired = errors.New("github authentication required; run `fotingo login` interactively")
var ErrOAuthClientIDMissing = errors.New("github oauth client id is missing in this build; use `fotingo login` with API token auth or rebuild with oauth ldflags")
Functions ¶
Types ¶
type CreatePROptions ¶
CreatePROptions contains the options for creating a pull request
type CreateReleaseOptions ¶
type CreateReleaseOptions struct {
TagName string
TargetCommitish string
Name string
Body string
Draft bool
Prerelease bool
}
CreateReleaseOptions contains the options for creating a release
type Github ¶
type Github interface {
auth.OauthService
config.ConfigurableService
// GetPullRequestUrl returns the URL of the pull request for current branch or an error if it can't be found
GetPullRequestUrl() (string, error)
// GetCurrentUser returns the information about the current authenticated user
GetCurrentUser() (*hub.User, error)
// CreatePullRequest creates a new pull request
CreatePullRequest(opts CreatePROptions) (*PullRequest, error)
// UpdatePullRequest updates an existing pull request
UpdatePullRequest(prNumber int, opts UpdatePROptions) (*PullRequest, error)
// GetPullRequestDiscussion returns comments and reviews for an existing pull request
GetPullRequestDiscussion(prNumber int) (*PullRequestDiscussion, error)
// GetLabels returns all labels from the repository
GetLabels() ([]Label, error)
// AddLabelsToPR adds labels to a pull request
AddLabelsToPR(prNumber int, labels []string) error
// GetCollaborators returns repository collaborators for reviewer selection
GetCollaborators() ([]User, error)
// GetOrgMembers returns organization members for participant selection
GetOrgMembers() ([]User, error)
// GetTeams returns organization teams for team reviewer selection
GetTeams() ([]Team, error)
// RequestReviewers requests reviewers on a pull request
RequestReviewers(prNumber int, reviewers []string, teamReviewers []string) error
// RemoveReviewers removes pending reviewer requests from a pull request
RemoveReviewers(prNumber int, reviewers []string, teamReviewers []string) error
// AssignUsersToPR assigns users to a pull request
AssignUsersToPR(prNumber int, assignees []string) error
// RemoveAssigneesFromPR removes users assigned to a pull request
RemoveAssigneesFromPR(prNumber int, assignees []string) error
// MarkPullRequestReadyForReview moves a draft pull request to ready for review
MarkPullRequestReadyForReview(prNodeID string) error
// DoesPRExistForBranch checks if a PR exists for a given branch
DoesPRExistForBranch(branch string) (bool, *PullRequest, error)
// CreateRelease creates a GitHub release
CreateRelease(opts CreateReleaseOptions) (*Release, error)
}
func NewAuthOnlyWithOptions ¶
func NewWithHTTPClient ¶
func NewWithHTTPClient(g git.Git, cfg *viper.Viper, httpClient *http.Client, baseURL string) (Github, error)
NewWithHTTPClient returns a new GitHub client using the provided HTTP client and base URL. This bypasses OAuth authentication and is intended for testing with mock servers.
type GithubConfig ¶
type GithubConfig struct {
Token string
}
type NativeStackClient ¶
type NativeStackClient interface {
ListPullRequestStacks(pullRequestNumber int) ([]PullRequestStack, error)
CreatePullRequestStack(pullRequestNumbers []int) (*PullRequestStack, error)
AddPullRequestsToStack(stackNumber int, pullRequestNumbers []int) (*PullRequestStack, error)
}
NativeStackClient is implemented by GitHub clients that support native PR stacks.
type PullRequest ¶
type PullRequest struct {
Title string
Body string
Number int
NodeID string
URL string
HTMLURL string
HeadRef string
HeadSHA string
BaseRef string
Draft bool
State string
Merged bool
Mergeable *bool
}
PullRequest represents a GitHub pull request
type PullRequestBodyUpdate ¶
PullRequestBodyUpdate contains a PR body update for stack synchronization.
type PullRequestConversation ¶
type PullRequestConversation struct {
ID string
Resolved *bool
Comments []PullRequestReviewComment
}
PullRequestConversation groups related inline review comments.
func GroupPullRequestReviewComments ¶
func GroupPullRequestReviewComments(comments []PullRequestReviewComment) []PullRequestConversation
GroupPullRequestReviewComments groups inline review comments into conversation-like threads.
type PullRequestDiscussion ¶
type PullRequestDiscussion struct {
Comments []PullRequestIssueComment
Reviews []PullRequestReview
ReviewComments []PullRequestReviewComment
Conversations []PullRequestConversation
}
PullRequestDiscussion contains comments, reviews, and review conversations for a pull request.
type PullRequestIssueComment ¶
type PullRequestIssueComment struct {
ID int64
Author string
Body string
URL string
HTMLURL string
AuthorAssociation string
CreatedAt string
UpdatedAt string
}
PullRequestIssueComment represents a top-level pull request issue comment.
type PullRequestLoader ¶
type PullRequestLoader interface {
GetPullRequest(prNumber int) (*PullRequest, error)
}
PullRequestLoader loads complete pull request metadata by number.
type PullRequestReview ¶
type PullRequestReview struct {
ID int64
Author string
State string
Body string
CommitID string
URL string
HTMLURL string
AuthorAssociation string
SubmittedAt string
}
PullRequestReview represents a submitted pull request review.
type PullRequestReviewComment ¶
type PullRequestReviewComment struct {
ID int64
NodeID string
ReviewID int64
InReplyToID int64
Author string
Body string
Path string
DiffHunk string
Side string
StartSide string
Line int
StartLine int
OriginalLine int
OriginalStartLine int
Position int
OriginalPosition int
CommitID string
OriginalCommitID string
SubjectType string
URL string
HTMLURL string
PullRequestURL string
AuthorAssociation string
CreatedAt string
UpdatedAt string
ConversationID string
ConversationResolved *bool
}
PullRequestReviewComment represents an inline pull request review comment.
type PullRequestStack ¶
type PullRequestStack struct {
ID int64
Number int
BaseRef string
Open bool
PullRequests []PullRequest
}
PullRequestStack contains GitHub-native stack metadata and its ordered PRs.
type UpdatePROptions ¶
UpdatePROptions contains optional fields for editing an existing pull request.