Documentation ¶
Index ¶
- Constants
- Variables
- func HasLabel(label string, issueLabels []Label) bool
- func HasLabels(labels []string, issueLabels []Label) bool
- func ImageTooBig(url string) (bool, error)
- func IsNotFound(err error) bool
- func NewNotFound() error
- func NormLogin(login string) string
- func PayloadSignature(payload []byte, key []byte) string
- func ValidatePayload(payload []byte, sig string, tokenGenerator func() []byte) bool
- func ValidateWebhook(w http.ResponseWriter, r *http.Request, tokenGenerator func() []byte) (string, string, []byte, bool, int)
- type AlternativeClientError
- type App
- type Branch
- type BranchProtection
- type BranchProtectionRequest
- type CheckRun
- type CheckRunAnnotation
- type CheckRunImage
- type CheckRunList
- type CheckRunOutput
- type CheckSuite
- type Client
- func NewClient(getToken func() []byte, censor func([]byte) []byte, graphqlEndpoint string, ...) Client
- func NewClientWithFields(fields logrus.Fields, getToken func() []byte, censor func([]byte) []byte, ...) Client
- func NewDryRunClient(getToken func() []byte, censor func([]byte) []byte, graphqlEndpoint string, ...) Client
- func NewDryRunClientWithFields(fields logrus.Fields, getToken func() []byte, censor func([]byte) []byte, ...) Client
- func NewFakeClient() Client
- type ClientError
- type CombinedStatus
- type CommentClient
- type Commit
- type CommitAuthor
- type CommitClient
- type CommitFile
- type CommitStats
- type Content
- type DraftReview
- type DraftReviewComment
- type EnforceAdmins
- type ExtraUsers
- type FileNotFound
- type FullRepo
- type GenericCommentEvent
- type GenericCommentEventAction
- type GenericEvent
- type GetRefResponse
- type GetRefResult
- type GetRefTooManyResultsError
- type GitCommit
- type HMACToken
- type HMACsForRepo
- type Hook
- type HookClient
- type HookConfig
- type HookRequest
- type InstallationPermissions
- type Issue
- type IssueClient
- type IssueComment
- type IssueCommentEvent
- type IssueCommentEventAction
- type IssueEvent
- type IssueEventAction
- type IssuesSearchResult
- type Label
- type ListedIssueEvent
- type Membership
- type MergeCommitsForbiddenError
- type MergeDetails
- type Milestone
- type MilestoneClient
- type MissingUsers
- type ModifiedHeadError
- type OrgInvitation
- type OrgMembership
- type Organization
- type OrganizationClient
- type Project
- type ProjectCard
- type ProjectClient
- type ProjectColumn
- type PullRequest
- type PullRequestBranch
- type PullRequestChange
- type PullRequestClient
- type PullRequestEvent
- type PullRequestEventAction
- type PullRequestFileStatus
- type PullRequestMergeType
- type PushEvent
- type Reaction
- type Repo
- type RepoCreateRequest
- type RepoPermissionLevel
- type RepoPermissions
- type RepoRequest
- type RepoUpdateRequest
- type RepositoryClient
- type RepositoryCommit
- type RequiredPullRequestReviews
- type RequiredPullRequestReviewsRequest
- type RequiredStatusChecks
- type RerunClient
- type Restrictions
- type RestrictionsRequest
- type Review
- type ReviewAction
- type ReviewComment
- type ReviewCommentEvent
- type ReviewCommentEventAction
- type ReviewEvent
- type ReviewEventAction
- type ReviewState
- type SignatureVerification
- type StateCannotBeChanged
- type Status
- type StatusEvent
- type Team
- type TeamClient
- type TeamMember
- type TeamMembership
- type TeamPermission
- type Tree
- type UnauthorizedToPushError
- type UnmergablePRBaseChangedError
- type UnmergablePRError
- type User
- type UserClient
Constants ¶
const ( // EventGUID is sent by GitHub in a header of every webhook request. // Used as a log field across prow. EventGUID = "event-GUID" // PrLogField is the number of a PR. // Used as a log field across prow. PrLogField = "pr" // OrgLogField is the organization of a PR. // Used as a log field across prow. OrgLogField = "org" // RepoLogField is the repository of a PR. // Used as a log field across prow. RepoLogField = "repo" // SearchTimeFormat is a time.Time format string for ISO8601 which is the // format that GitHub requires for times specified as part of a search query. SearchTimeFormat = "2006-01-02T15:04:05Z" // DefaultAPIEndpoint is the default GitHub API endpoint. DefaultAPIEndpoint = "https://api.github.com" // DefaultHost is the default GitHub base endpoint. DefaultHost = "github.com" // DefaultGraphQLEndpoint is the default GitHub GraphQL API endpoint. DefaultGraphQLEndpoint = "https://api.github.com/graphql" )
const ( StatusPending = "pending" StatusSuccess = "success" StatusError = "error" StatusFailure = "failure" )
These are possible State entries for a Status.
const ( ReactionThumbsUp = "+1" ReactionThumbsDown = "-1" ReactionLaugh = "laugh" ReactionConfused = "confused" ReactionHeart = "heart" ReactionHooray = "hooray" )
Possible contents for reactions.
const ( // UserTypeUser identifies an actual user account in the User.Type field UserTypeUser = "User" // UserTypeBot identifies a github app bot user in the User.Type field UserTypeBot = "Bot" )
const ( // PullRequestFileModified means a file changed. PullRequestFileModified PullRequestFileStatus = "modified" // PullRequestFileAdded means a file was added. PullRequestFileAdded = "added" // PullRequestFileRemoved means a file was deleted. PullRequestFileRemoved = "removed" // PullRequestFileRenamed means a file moved. PullRequestFileRenamed = "renamed" )
const ( ReviewStateApproved ReviewState = "APPROVED" ReviewStateChangesRequested = "CHANGES_REQUESTED" ReviewStateCommented = "COMMENTED" ReviewStateDismissed = "DISMISSED" ReviewStatePending = "PENDING" )
Possible review states.
const ( Approve ReviewAction = "APPROVE" RequestChanges = "REQUEST_CHANGES" Comment = "COMMENT" )
Possible review actions. Leave Action blank for a pending review.
const ( // PrivacySecret memberships are only visible to other team members. PrivacySecret = "secret" // PrivacyClosed memberships are visible to org members. PrivacyClosed = "closed" )
const ( // RoleAll lists both members and admins RoleAll = "all" // RoleAdmin specifies the user is an org admin, or lists only admins RoleAdmin = "admin" // RoleMaintainer specifies the user is a team maintainer, or lists only maintainers RoleMaintainer = "maintainer" // RoleMember specifies the user is a regular user, or only lists regular users RoleMember = "member" // StatePending specifies the user has an invitation to the org/team. StatePending = "pending" // StateActive specifies the user's membership is active. StateActive = "active" )
const ImageSizeLimit = 5242880
ImageSizeLimit is the maximum image size GitHub allows in bytes (5MB).
Variables ¶
var AllHookEvents = []string{"*"}
AllHookEvents causes github to send all events. https://developer.github.com/v3/activity/events/types/
var (
// FoundingYear is the year GitHub was founded. This is just used so that
// we can lower bound dates related to PRs and issues.
FoundingYear, _ = time.Parse(SearchTimeFormat, "2007-01-01T00:00:00Z")
)
var SecurityForkNameRE = regexp.MustCompile(`^[\w-]+-ghsa-[\w-]+$`)
SecurityForkNameRE is a regexp matching repos that are temporary security forks. https://help.github.com/en/github/managing-security-vulnerabilities/collaborating-in-a-temporary-private-fork-to-resolve-a-security-vulnerability
Functions ¶
func ImageTooBig ¶
ImageTooBig checks if image is bigger than github limits.
func IsNotFound ¶
func NewNotFound ¶
func NewNotFound() error
NewNotFound returns a NotFound error which may be useful for tests
func PayloadSignature ¶
PayloadSignature returns the signature that matches the payload.
func ValidatePayload ¶
ValidatePayload ensures that the request payload signature matches the key.
func ValidateWebhook ¶
func ValidateWebhook(w http.ResponseWriter, r *http.Request, tokenGenerator func() []byte) (string, string, []byte, bool, int)
ValidateWebhook ensures that the provided request conforms to the format of a GitHub webhook and the payload can be validated with the provided hmac secret. It returns the event type, the event guid, the payload of the request, whether the webhook is valid or not, and finally the resultant HTTP status code
Types ¶
type AlternativeClientError ¶
type AlternativeClientError struct { Message string `json:"message"` Errors []string `json:"errors,omitempty"` DocumentationURL string `json:"documentation_url,omitempty"` }
AlternativeClientError represents an alternative format for https://developer.github.com/v3/#client-errors This is probably a GitHub bug, as documentation_url should appear only in custom errors
func (AlternativeClientError) Error ¶
func (r AlternativeClientError) Error() string
type App ¶
type App struct { ID int64 `json:"id,omitempty"` Slug string `json:"slug,omitempty"` NodeID string `json:"node_id,omitempty"` Owner User `json:"owner,omitempty"` Name string `json:"name,omitempty"` Description string `json:"description,omitempty"` ExternalURL string `json:"external_url,omitempty"` HTMLURL string `json:"html_url,omitempty"` CreatedAt string `json:"created_at,omitempty"` UpdatedAt string `json:"updated_at,omitempty"` Permissions *InstallationPermissions `json:"permissions,omitempty"` Events []string `json:"events,omitempty"` }
type Branch ¶
type Branch struct { Name string `json:"name"` Protected bool `json:"protected"` // only included for ?protection=true requests }
Branch contains general branch information.
type BranchProtection ¶
type BranchProtection struct { RequiredStatusChecks *RequiredStatusChecks `json:"required_status_checks"` EnforceAdmins EnforceAdmins `json:"enforce_admins"` RequiredPullRequestReviews *RequiredPullRequestReviews `json:"required_pull_request_reviews"` Restrictions *Restrictions `json:"restrictions"` }
BranchProtection represents protections currently in place for a branch See also: https://developer.github.com/v3/repos/branches/#get-branch-protection
type BranchProtectionRequest ¶
type BranchProtectionRequest struct { RequiredStatusChecks *RequiredStatusChecks `json:"required_status_checks"` EnforceAdmins *bool `json:"enforce_admins"` RequiredPullRequestReviews *RequiredPullRequestReviewsRequest `json:"required_pull_request_reviews"` Restrictions *RestrictionsRequest `json:"restrictions"` RequiredLinearHistory bool `json:"required_linear_history"` AllowForcePushes bool `json:"allow_force_pushes"` AllowDeletions bool `json:"allow_deletions"` }
BranchProtectionRequest represents protections to put in place for a branch. See also: https://developer.github.com/v3/repos/branches/#update-branch-protection
func (BranchProtectionRequest) String ¶
func (r BranchProtectionRequest) String() string
type CheckRun ¶
type CheckRun struct { ID int64 `json:"id,omitempty"` NodeID string `json:"node_id,omitempty"` HeadSHA string `json:"head_sha,omitempty"` ExternalID string `json:"external_id,omitempty"` URL string `json:"url,omitempty"` HTMLURL string `json:"html_url,omitempty"` DetailsURL string `json:"details_url,omitempty"` Status string `json:"status,omitempty"` Conclusion string `json:"conclusion,omitempty"` StartedAt string `json:"started_at,omitempty"` CompletedAt string `json:"completed_at,omitempty"` Output CheckRunOutput `json:"output,omitempty"` Name string `json:"name,omitempty"` CheckSuite CheckSuite `json:"check_suite,omitempty"` App App `json:"app,omitempty"` PullRequests []PullRequest `json:"pull_requests,omitempty"` }
type CheckRunAnnotation ¶
type CheckRunAnnotation struct { Path string `json:"path,omitempty"` StartLine int `json:"start_line,omitempty"` EndLine int `json:"end_line,omitempty"` StartColumn int `json:"start_column,omitempty"` EndColumn int `json:"end_column,omitempty"` AnnotationLevel string `json:"annotation_level,omitempty"` Message string `json:"message,omitempty"` Title string `json:"title,omitempty"` RawDetails string `json:"raw_details,omitempty"` }
type CheckRunImage ¶
type CheckRunList ¶
type CheckRunOutput ¶
type CheckRunOutput struct { Title string `json:"title,omitempty"` Summary string `json:"summary,omitempty"` Text string `json:"text,omitempty"` AnnotationsCount int `json:"annotations_count,omitempty"` AnnotationsURL string `json:"annotations_url,omitempty"` Annotations []CheckRunAnnotation `json:"annotations,omitempty"` Images []CheckRunImage `json:"images,omitempty"` }
type CheckSuite ¶
type CheckSuite struct { ID int64 `json:"id,omitempty"` NodeID string `json:"node_id,omitempty"` HeadBranch string `json:"head_branch,omitempty"` HeadSHA string `json:"head_sha,omitempty"` URL string `json:"url,omitempty"` BeforeSHA string `json:"before,omitempty"` AfterSHA string `json:"after,omitempty"` Status string `json:"status,omitempty"` Conclusion string `json:"conclusion,omitempty"` App *App `json:"app,omitempty"` Repository *Repo `json:"repository,omitempty"` PullRequests []PullRequest `json:"pull_requests,omitempty"` // The following fields are only populated by Webhook events. HeadCommit *Commit `json:"head_commit,omitempty"` }
type Client ¶
type Client interface { PullRequestClient RepositoryClient CommitClient IssueClient CommentClient OrganizationClient TeamClient ProjectClient MilestoneClient UserClient HookClient Throttle(hourlyTokens, burst int) Query(ctx context.Context, q interface{}, vars map[string]interface{}) error SetMax404Retries(int) WithFields(fields logrus.Fields) Client ForPlugin(plugin string) Client ForSubcomponent(subcomponent string) Client }
Client interface for GitHub API
func NewClient ¶
func NewClient(getToken func() []byte, censor func([]byte) []byte, graphqlEndpoint string, bases ...string) Client
NewClient creates a new fully operational GitHub client.
func NewClientWithFields ¶
func NewClientWithFields(fields logrus.Fields, getToken func() []byte, censor func([]byte) []byte, graphqlEndpoint string, bases ...string) Client
NewClientWithFields creates a new fully operational GitHub client. With added logging fields. 'getToken' is a generator for the GitHub access token to use. 'bases' is a variadic slice of endpoints to use in order of preference.
An endpoint is used when all preceding endpoints have returned a conn err. This should be used when using the ghproxy GitHub proxy cache to allow this client to bypass the cache if it is temporarily unavailable.
func NewDryRunClient ¶
func NewDryRunClient(getToken func() []byte, censor func([]byte) []byte, graphqlEndpoint string, bases ...string) Client
NewDryRunClient creates a new client that will not perform mutating actions such as setting statuses or commenting, but it will still query GitHub and use up API tokens. 'getToken' is a generator the GitHub access token to use. 'bases' is a variadic slice of endpoints to use in order of preference.
An endpoint is used when all preceding endpoints have returned a conn err. This should be used when using the ghproxy GitHub proxy cache to allow this client to bypass the cache if it is temporarily unavailable.
func NewDryRunClientWithFields ¶
func NewDryRunClientWithFields(fields logrus.Fields, getToken func() []byte, censor func([]byte) []byte, graphqlEndpoint string, bases ...string) Client
NewDryRunClientWithFields creates a new client that will not perform mutating actions such as setting statuses or commenting, but it will still query GitHub and use up API tokens. Additional fields are added to the logger. 'getToken' is a generator the GitHub access token to use. 'bases' is a variadic slice of endpoints to use in order of preference.
An endpoint is used when all preceding endpoints have returned a conn err. This should be used when using the ghproxy GitHub proxy cache to allow this client to bypass the cache if it is temporarily unavailable.
func NewFakeClient ¶
func NewFakeClient() Client
NewFakeClient creates a new client that will not perform any actions at all.
type ClientError ¶
type ClientError struct { Message string `json:"message"` Errors []clientErrorSubError `json:"errors,omitempty"` }
ClientError represents https://developer.github.com/v3/#client-errors
func (ClientError) Error ¶
func (r ClientError) Error() string
type CombinedStatus ¶
type CombinedStatus struct { SHA string `json:"sha"` Statuses []Status `json:"statuses"` State string `json:"state"` }
CombinedStatus is the latest statuses for a ref.
type CommentClient ¶
type CommentClient interface { CreateComment(org, repo string, number int, comment string) error DeleteComment(org, repo string, id int) error EditComment(org, repo string, id int, comment string) error CreateCommentReaction(org, repo string, id int, reaction string) error DeleteStaleComments(org, repo string, number int, comments []IssueComment, isStale func(IssueComment) bool) error }
CommentClient interface for comment related API actions
type Commit ¶
type Commit struct { Message string `json:"message,omitempty"` Author User `json:"author,omitempty"` URL string `json:"url,omitempty"` Distinct bool `json:"distinct,omitempty"` // The following fields are only populated by Events API. SHA string `json:"sha,omitempty"` // The following fields are only populated by Webhook events. ID string `json:"id,omitempty"` Added []string `json:"added,omitempty"` Removed []string `json:"removed,omitempty"` Modified []string `json:"modified,omitempty"` }
Commit represents a git commit in a GitHub PushEvent.
type CommitAuthor ¶ added in v1.2.4
type CommitAuthor struct { Date time.Time `json:"date,omitempty"` Name string `json:"name,omitempty"` Email string `json:"email,omitempty"` // The following fields are only populated by Webhook events. Login *string `json:"username,omitempty"` }
CommitAuthor represents the author or committer of a commit. The commit author may not correspond to a GitHub User.
type CommitClient ¶
type CommitClient interface { CreateStatus(org, repo, SHA string, s Status) error ListStatuses(org, repo, ref string) ([]Status, error) GetSingleCommit(org, repo, SHA string) (RepositoryCommit, error) GetCombinedStatus(org, repo, ref string) (*CombinedStatus, error) ListCheckRuns(org, repo, ref string) (*CheckRunList, error) GetRef(org, repo, ref string) (string, error) DeleteRef(org, repo, ref string) error }
CommitClient interface for commit related API actions
type CommitFile ¶
type CommitFile struct { SHA string `json:"sha,omitempty"` Filename string `json:"filename,omitempty"` Additions int `json:"additions,omitempty"` Deletions int `json:"deletions,omitempty"` Changes int `json:"changes,omitempty"` Status string `json:"status,omitempty"` Patch string `json:"patch,omitempty"` BlobURL string `json:"blob_url,omitempty"` RawURL string `json:"raw_url,omitempty"` ContentsURL string `json:"contents_url,omitempty"` PreviousFilename string `json:"previous_filename,omitempty"` }
CommitFile represents a file modified in a commit.
type CommitStats ¶
type CommitStats struct { Additions int `json:"additions,omitempty"` Deletions int `json:"deletions,omitempty"` Total int `json:"total,omitempty"` }
CommitStats represents the number of additions / deletions from a file in a given RepositoryCommit or GistCommit.
type DraftReview ¶
type DraftReview struct { // If unspecified, defaults to the most recent commit in the PR. CommitSHA string `json:"commit_id,omitempty"` Body string `json:"body"` // If unspecified, defaults to PENDING. Action ReviewAction `json:"event,omitempty"` Comments []DraftReviewComment `json:"comments,omitempty"` }
DraftReview is what we give GitHub when we want to make a PR Review. This is different than what we receive when we ask for a Review.
type DraftReviewComment ¶
type DraftReviewComment struct { Path string `json:"path"` // Position in the patch, not the line number in the file. Position int `json:"position"` Body string `json:"body"` }
DraftReviewComment is a comment in a draft review.
type EnforceAdmins ¶
type EnforceAdmins struct {
Enabled bool `json:"enabled"`
}
EnforceAdmins specifies whether to enforce the configured branch restrictions for administrators.
type ExtraUsers ¶
type ExtraUsers struct { Users []string // contains filtered or unexported fields }
ExtraUsers is an error specifying the users that could not be unassigned.
func (ExtraUsers) Error ¶
func (e ExtraUsers) Error() string
type FileNotFound ¶
type FileNotFound struct {
// contains filtered or unexported fields
}
FileNotFound happens when github cannot find the file requested by GetFile().
func (*FileNotFound) Error ¶
func (e *FileNotFound) Error() string
type FullRepo ¶
type FullRepo struct { Repo AllowSquashMerge bool `json:"allow_squash_merge,omitempty"` AllowMergeCommit bool `json:"allow_merge_commit,omitempty"` AllowRebaseMerge bool `json:"allow_rebase_merge,omitempty"` }
Repo contains detailed repository information, including items that are not available in repo records returned by GH "List" methods but are in those returned by GH "Get" method. See https://developer.github.com/v3/repos/#list-organization-repositories See https://developer.github.com/v3/repos/#get
type GenericCommentEvent ¶
type GenericCommentEvent struct { ID int `json:"id"` CommentID *int IsPR bool Action GenericCommentEventAction Body string HTMLURL string Number int Repo Repo User User IssueAuthor User Assignees []User IssueState string IssueTitle string IssueBody string IssueHTMLURL string GUID string }
GenericCommentEvent is a fake event type that is instantiated for any github event that contains comment like content. The specific events that are also handled as GenericCommentEvents are: - issue_comment events - pull_request_review events - pull_request_review_comment events - pull_request events with action in ["opened", "edited"] - issue events with action in ["opened", "edited"]
Issue and PR "closed" events are not coerced to the "deleted" Action and do not trigger a GenericCommentEvent because these events don't actually remove the comment content from GH.
type GenericCommentEventAction ¶
type GenericCommentEventAction string
GenericCommentEventAction coerces multiple actions into its generic equivalent.
const ( // GenericCommentActionCreated means something was created/opened/submitted GenericCommentActionCreated GenericCommentEventAction = "created" // "opened", "submitted" // GenericCommentActionEdited means something was edited. GenericCommentActionEdited GenericCommentEventAction = "edited" // GenericCommentActionDeleted means something was deleted/dismissed. GenericCommentActionDeleted GenericCommentEventAction = "deleted" // "dismissed" )
Comments indicate values that are coerced to the specified value.
type GenericEvent ¶
type GenericEvent struct { Sender User `json:"sender"` Org Organization `json:"organization"` Repo Repo `json:"repository"` }
GenericEvent is a lightweight struct containing just Sender, Organization and Repo as they are allWebhook payload object common properties: https://developer.github.com/webhooks/event-payloads/#webhook-payload-object-common-properties
type GetRefResponse ¶
type GetRefResponse []GetRefResult
func (*GetRefResponse) RefNames ¶
func (grr *GetRefResponse) RefNames() []string
func (*GetRefResponse) UnmarshalJSON ¶
func (grr *GetRefResponse) UnmarshalJSON(data []byte) error
We need a custom unmarshaler because the GetRefResult may either be a single GetRefResponse or multiple
type GetRefResult ¶
type GetRefTooManyResultsError ¶
type GetRefTooManyResultsError struct {
// contains filtered or unexported fields
}
func (GetRefTooManyResultsError) Error ¶
func (e GetRefTooManyResultsError) Error() string
func (GetRefTooManyResultsError) Is ¶
func (GetRefTooManyResultsError) Is(err error) bool
type GitCommit ¶
type GitCommit struct { SHA string `json:"sha,omitempty"` Author CommitAuthor `json:"author,omitempty"` Committer CommitAuthor `json:"committer,omitempty"` Message string `json:"message,omitempty"` Tree Tree `json:"tree,omitempty"` Parents []GitCommit `json:"parents,omitempty"` Stats *CommitStats `json:"stats,omitempty"` HTMLURL string `json:"html_url,omitempty"` URL string `json:"url,omitempty"` Verification *SignatureVerification `json:"verification,omitempty"` NodeID string `json:"node_id,omitempty"` // CommentCount is the number of GitHub comments on the commit. This // is only populated for requests that fetch GitHub data like // Pulls.ListCommits, Repositories.ListCommits, etc. CommentCount *int `json:"comment_count,omitempty"` }
GitCommit represents a GitHub commit.
type HMACsForRepo ¶
type HMACsForRepo []HMACToken
HMACsForRepo contains all hmac tokens configured for a repo, org or globally.
type Hook ¶
type Hook struct { ID int `json:"id"` Name string `json:"name"` Events []string `json:"events"` Active bool `json:"active"` Config HookConfig `json:"config"` }
Hook holds info about the webhook configuration.
type HookClient ¶
type HookClient interface { ListOrgHooks(org string) ([]Hook, error) ListRepoHooks(org, repo string) ([]Hook, error) EditRepoHook(org, repo string, id int, req HookRequest) error EditOrgHook(org string, id int, req HookRequest) error CreateOrgHook(org string, req HookRequest) (int, error) CreateRepoHook(org, repo string, req HookRequest) (int, error) DeleteOrgHook(org string, id int, req HookRequest) error DeleteRepoHook(org, repo string, id int, req HookRequest) error }
HookClient interface for hook related API actions
type HookConfig ¶
type HookConfig struct { URL string `json:"url"` ContentType *string `json:"content_type,omitempty"` Secret *string `json:"secret,omitempty"` }
HookConfig holds the endpoint and its secret.
type HookRequest ¶
type HookRequest struct { Name string `json:"name,omitempty"` // must be web or "", only create Active *bool `json:"active,omitempty"` AddEvents []string `json:"add_events,omitempty"` // only repo edit Config *HookConfig `json:"config,omitempty"` Events []string `json:"events,omitempty"` RemoveEvents []string `json:"remove_events,omitempty"` // only repo edit }
HookRequest can create and/or edit a webhook.
AddEvents and RemoveEvents are only valid during an edit, and only for a repo
type InstallationPermissions ¶
type InstallationPermissions struct { Administration string `json:"administration,omitempty"` Blocking string `json:"blocking,omitempty"` Checks string `json:"checks,omitempty"` Contents string `json:"contents,omitempty"` ContentReferences string `json:"content_references,omitempty"` Deployments string `json:"deployments,omitempty"` Emails string `json:"emails,omitempty"` Followers string `json:"followers,omitempty"` Issues string `json:"issues,omitempty"` Metadata string `json:"metadata,omitempty"` Members string `json:"members,omitempty"` OrganizationAdministration string `json:"organization_administration,omitempty"` OrganizationHooks string `json:"organization_hooks,omitempty"` OrganizationPlan string `json:"organization_plan,omitempty"` OrganizationPreReceiveHooks string `json:"organization_pre_receive_hooks,omitempty"` OrganizationProjects string `json:"organization_projects,omitempty"` OrganizationUserBlocking string `json:"organization_user_blocking,omitempty"` Packages string `json:"packages,omitempty"` Pages string `json:"pages,omitempty"` PullRequests string `json:"pull_requests,omitempty"` RepositoryHooks string `json:"repository_hooks,omitempty"` RepositoryProjects string `json:"repository_projects,omitempty"` RepositoryPreReceiveHooks string `json:"repository_pre_receive_hooks,omitempty"` SingleFile string `json:"single_file,omitempty"` Statuses string `json:"statuses,omitempty"` TeamDiscussions string `json:"team_discussions,omitempty"` VulnerabilityAlerts string `json:"vulnerability_alerts,omitempty"` }
type Issue ¶
type Issue struct { ID int `json:"id"` User User `json:"user"` Number int `json:"number"` Title string `json:"title"` State string `json:"state"` HTMLURL string `json:"html_url"` Labels []Label `json:"labels"` Assignees []User `json:"assignees"` Body string `json:"body"` CreatedAt time.Time `json:"created_at"` UpdatedAt time.Time `json:"updated_at"` Milestone Milestone `json:"milestone"` // This will be non-nil if it is a pull request. PullRequest *struct{} `json:"pull_request,omitempty"` }
Issue represents general info about an issue.
func (Issue) IsAssignee ¶
IsAssignee checks if a user is assigned to the issue.
func (Issue) IsPullRequest ¶
IsPullRequest checks if an issue is a pull request.
type IssueClient ¶
type IssueClient interface { CreateIssue(org, repo, title, body string, milestone int, labels, assignees []string) (int, error) CreateIssueReaction(org, repo string, id int, reaction string) error ListIssueComments(org, repo string, number int) ([]IssueComment, error) GetIssueLabels(org, repo string, number int) ([]Label, error) ListIssueEvents(org, repo string, num int) ([]ListedIssueEvent, error) AssignIssue(org, repo string, number int, logins []string) error UnassignIssue(org, repo string, number int, logins []string) error CloseIssue(org, repo string, number int) error ReopenIssue(org, repo string, number int) error FindIssues(query, sort string, asc bool) ([]Issue, error) ListOpenIssues(org, repo string) ([]Issue, error) GetIssue(org, repo string, number int) (*Issue, error) EditIssue(org, repo string, number int, issue *Issue) (*Issue, error) }
IssueClient interface for issue related API actions
type IssueComment ¶
type IssueComment struct { ID int `json:"id,omitempty"` Body string `json:"body"` User User `json:"user,omitempty"` HTMLURL string `json:"html_url,omitempty"` CreatedAt time.Time `json:"created_at,omitempty"` UpdatedAt time.Time `json:"updated_at,omitempty"` }
IssueComment represents general info about an issue comment.
type IssueCommentEvent ¶
type IssueCommentEvent struct { Action IssueCommentEventAction `json:"action"` Issue Issue `json:"issue"` Comment IssueComment `json:"comment"` Repo Repo `json:"repository"` // GUID is included in the header of the request received by GitHub. GUID string }
IssueCommentEvent is what GitHub sends us when an issue comment is changed.
type IssueCommentEventAction ¶
type IssueCommentEventAction string
IssueCommentEventAction enumerates the triggers for this webhook payload type. See also: https://developer.github.com/v3/activity/events/types/#issuecommentevent
const ( // IssueCommentActionCreated means the comment was created. IssueCommentActionCreated IssueCommentEventAction = "created" // IssueCommentActionEdited means the comment was edited. IssueCommentActionEdited IssueCommentEventAction = "edited" // IssueCommentActionDeleted means the comment was deleted. IssueCommentActionDeleted IssueCommentEventAction = "deleted" )
type IssueEvent ¶
type IssueEvent struct { Action IssueEventAction `json:"action"` Issue Issue `json:"issue"` Repo Repo `json:"repository"` // Label is specified for IssueActionLabeled and IssueActionUnlabeled events. Label Label `json:"label"` // GUID is included in the header of the request received by GitHub. GUID string }
IssueEvent represents an issue event from a webhook payload (not from the events API).
type IssueEventAction ¶
type IssueEventAction string
IssueEventAction enumerates the triggers for this webhook payload type. See also: https://developer.github.com/v3/activity/events/types/#issuesevent
const ( // IssueActionAssigned means assignees were added. IssueActionAssigned IssueEventAction = "assigned" // IssueActionUnassigned means assignees were added. IssueActionUnassigned IssueEventAction = "unassigned" // IssueActionLabeled means labels were added. IssueActionLabeled IssueEventAction = "labeled" // IssueActionUnlabeled means labels were removed. IssueActionUnlabeled IssueEventAction = "unlabeled" // IssueActionOpened means issue was opened/created. IssueActionOpened IssueEventAction = "opened" // IssueActionEdited means issue body was edited. IssueActionEdited IssueEventAction = "edited" // IssueActionDeleted means the issue was deleted. IssueActionDeleted IssueEventAction = "deleted" // IssueActionMilestoned means the milestone was added/changed. IssueActionMilestoned IssueEventAction = "milestoned" // IssueActionDemilestoned means a milestone was removed. IssueActionDemilestoned IssueEventAction = "demilestoned" // IssueActionClosed means issue was closed. IssueActionClosed IssueEventAction = "closed" // IssueActionReopened means issue was reopened. IssueActionReopened IssueEventAction = "reopened" // IssueActionPinned means the issue was pinned. IssueActionPinned IssueEventAction = "pinned" // IssueActionUnpinned means the issue was unpinned. IssueActionUnpinned IssueEventAction = "unpinned" // IssueActionTransferred means the issue was transferred to another repo. IssueActionTransferred IssueEventAction = "transferred" // IssueActionLocked means the issue was locked. IssueActionLocked IssueEventAction = "locked" // IssueActionUnlocked means the issue was unlocked. IssueActionUnlocked IssueEventAction = "unlocked" )
type IssuesSearchResult ¶
type IssuesSearchResult struct { Total int `json:"total_count,omitempty"` Issues []Issue `json:"items,omitempty"` }
IssuesSearchResult represents the result of an issues search.
type Label ¶
type Label struct { URL string `json:"url"` Name string `json:"name"` Description string `json:"description"` Color string `json:"color"` }
Label describes a GitHub label.
type ListedIssueEvent ¶
type ListedIssueEvent struct { Event IssueEventAction `json:"event"` // This is the same as IssueEvent.Action. Actor User `json:"actor"` Label Label `json:"label"` CreatedAt time.Time `json:"created_at"` }
ListedIssueEvent represents an issue event from the events API (not from a webhook payload). https://developer.github.com/v3/issues/events/
type Membership ¶
type Membership struct { // admin or member Role string `json:"role"` // pending or active State string `json:"state,omitempty"` }
Membership specifies the role and state details for an org and/or team.
type MergeCommitsForbiddenError ¶
type MergeCommitsForbiddenError string
MergeCommitsForbiddenError happens when the repo disallows the merge strategy configured for the repo in Tide.
func (MergeCommitsForbiddenError) Error ¶
func (e MergeCommitsForbiddenError) Error() string
type MergeDetails ¶
type MergeDetails struct { // CommitTitle defaults to the automatic message. CommitTitle string `json:"commit_title,omitempty"` // CommitMessage defaults to the automatic message. CommitMessage string `json:"commit_message,omitempty"` // The PR HEAD must match this to prevent races. SHA string `json:"sha,omitempty"` // Can be "merge", "squash", or "rebase". Defaults to merge. MergeMethod string `json:"merge_method,omitempty"` }
MergeDetails contains desired properties of the merge.
See https://developer.github.com/v3/pulls/#merge-a-pull-request-merge-button
type MilestoneClient ¶
type MilestoneClient interface { ClearMilestone(org, repo string, num int) error SetMilestone(org, repo string, issueNum, milestoneNum int) error ListMilestones(org, repo string) ([]Milestone, error) }
MilestoneClient interface for milestone related API actions
type MissingUsers ¶
type MissingUsers struct { Users []string // contains filtered or unexported fields }
MissingUsers is an error specifying the users that could not be unassigned.
func (MissingUsers) Error ¶
func (m MissingUsers) Error() string
type ModifiedHeadError ¶
type ModifiedHeadError string
ModifiedHeadError happens when github refuses to merge a PR because the PR changed.
func (ModifiedHeadError) Error ¶
func (e ModifiedHeadError) Error() string
type OrgInvitation ¶
type OrgInvitation struct { TeamMember Email string `json:"email"` Inviter TeamMember `json:"inviter"` }
OrgInvitation contains Login and other details about the invitation.
type OrgMembership ¶
type OrgMembership struct {
Membership
}
OrgMembership contains Membership fields for user membership in an org.
type Organization ¶
type Organization struct { // Login has the same meaning as Name, but it's more reliable to use as Name can sometimes be empty, // see https://developer.github.com/v3/orgs/#list-organizations Login string `json:"login"` // BillingEmail holds private billing address BillingEmail string `json:"billing_email"` Company string `json:"company"` // Email is publicly visible Email string `json:"email"` Location string `json:"location"` Name string `json:"name"` Description string `json:"description"` HasOrganizationProjects bool `json:"has_organization_projects"` HasRepositoryProjects bool `json:"has_repository_projects"` DefaultRepositoryPermission string `json:"default_repository_permission"` MembersCanCreateRepositories bool `json:"members_can_create_repositories"` }
Organization stores metadata information about an organization
type OrganizationClient ¶
type OrganizationClient interface { IsMember(org, user string) (bool, error) GetOrg(name string) (*Organization, error) EditOrg(name string, config Organization) (*Organization, error) ListOrgInvitations(org string) ([]OrgInvitation, error) ListOrgMembers(org, role string) ([]TeamMember, error) HasPermission(org, repo, user string, roles ...string) (bool, error) GetUserPermission(org, repo, user string) (string, error) UpdateOrgMembership(org, user string, admin bool) (*OrgMembership, error) RemoveOrgMembership(org, user string) error }
OrganizationClient interface for organisation related API actions
type ProjectCard ¶
type ProjectCard struct { ID int `json:"id"` ContentID int `json:"content_id"` ContentType string `json:"content_type"` ContentURL string `json:"content_url"` }
ProjectCard is a github project card
type ProjectClient ¶
type ProjectClient interface { GetRepoProjects(owner, repo string) ([]Project, error) GetOrgProjects(org string) ([]Project, error) GetProjectColumns(projectID int) ([]ProjectColumn, error) CreateProjectCard(columnID int, projectCard ProjectCard) (*ProjectCard, error) GetColumnProjectCards(columnID int) ([]ProjectCard, error) GetColumnProjectCard(columnID int, issueURL string) (*ProjectCard, error) MoveProjectCard(projectCardID int, newColumnID int) error DeleteProjectCard(projectCardID int) error }
ProjectClient interface for project related API actions
type ProjectColumn ¶
ProjectColumn is a colunm in a github project
type PullRequest ¶
type PullRequest struct { ID int `json:"id"` Number int `json:"number"` HTMLURL string `json:"html_url"` User User `json:"user"` Labels []Label `json:"labels"` Base PullRequestBranch `json:"base"` Head PullRequestBranch `json:"head"` Title string `json:"title"` Body string `json:"body"` RequestedReviewers []User `json:"requested_reviewers"` Assignees []User `json:"assignees"` State string `json:"state"` Draft bool `json:"draft"` Merged bool `json:"merged"` CreatedAt time.Time `json:"created_at,omitempty"` UpdatedAt time.Time `json:"updated_at,omitempty"` // ref https://developer.github.com/v3/pulls/#get-a-single-pull-request // If Merged is true, MergeSHA is the SHA of the merge commit, or squashed commit // If Merged is false, MergeSHA is a commit SHA that github created to test if // the PR can be merged automatically. MergeSHA *string `json:"merge_commit_sha"` // ref https://developer.github.com/v3/pulls/#response-1 // The value of the mergeable attribute can be true, false, or null. If the value // is null, this means that the mergeability hasn't been computed yet, and a // background job was started to compute it. When the job is complete, the response // will include a non-null value for the mergeable attribute. Mergable *bool `json:"mergeable,omitempty"` // If the PR doesn't have any milestone, `milestone` is null and is unmarshaled to nil. Milestone *Milestone `json:"milestone,omitempty"` Commits int `json:"commits"` }
PullRequest contains information about a PullRequest.
type PullRequestBranch ¶
type PullRequestBranch struct { Ref string `json:"ref"` SHA string `json:"sha"` Repo Repo `json:"repo"` }
PullRequestBranch contains information about a particular branch in a PR.
type PullRequestChange ¶
type PullRequestChange struct { SHA string `json:"sha"` Filename string `json:"filename"` Status string `json:"status"` Additions int `json:"additions"` Deletions int `json:"deletions"` Changes int `json:"changes"` Patch string `json:"patch"` BlobURL string `json:"blob_url"` PreviousFilename string `json:"previous_filename"` }
PullRequestChange contains information about what a PR changed.
type PullRequestClient ¶
type PullRequestClient interface { GetPullRequests(org, repo string) ([]PullRequest, error) GetPullRequest(org, repo string, number int) (*PullRequest, error) EditPullRequest(org, repo string, number int, pr *PullRequest) (*PullRequest, error) GetPullRequestPatch(org, repo string, number int) ([]byte, error) CreatePullRequest(org, repo, title, body, head, base string, canModify bool) (int, error) UpdatePullRequest(org, repo string, number int, title, body *string, open *bool, branch *string, canModify *bool) error GetPullRequestChanges(org, repo string, number int) ([]PullRequestChange, error) ListPullRequestComments(org, repo string, number int) ([]ReviewComment, error) ListReviews(org, repo string, number int) ([]Review, error) ClosePR(org, repo string, number int) error ReopenPR(org, repo string, number int) error CreateReview(org, repo string, number int, r DraftReview) error RequestReview(org, repo string, number int, logins []string) error UnrequestReview(org, repo string, number int, logins []string) error Merge(org, repo string, pr int, details MergeDetails) error IsMergeable(org, repo string, number int, SHA string) (bool, error) ListPRCommits(org, repo string, number int) ([]RepositoryCommit, error) UpdatePullRequestBranch(org, repo string, number int, expectedHeadSha *string) error }
PullRequestClient interface for pull request related API actions
type PullRequestEvent ¶
type PullRequestEvent struct { Action PullRequestEventAction `json:"action"` Number int `json:"number"` PullRequest PullRequest `json:"pull_request"` Repo Repo `json:"repository"` Label Label `json:"label"` Sender User `json:"sender"` // Changes holds raw change data, which we must inspect // and deserialize later as this is a polymorphic field Changes json.RawMessage `json:"changes"` // GUID is included in the header of the request received by GitHub. GUID string }
PullRequestEvent is what GitHub sends us when a PR is changed.
type PullRequestEventAction ¶
type PullRequestEventAction string
PullRequestEventAction enumerates the triggers for this webhook payload type. See also: https://developer.github.com/v3/activity/events/types/#pullrequestevent
const ( // PullRequestActionAssigned means assignees were added. PullRequestActionAssigned PullRequestEventAction = "assigned" // PullRequestActionUnassigned means assignees were removed. PullRequestActionUnassigned PullRequestEventAction = "unassigned" // PullRequestActionReviewRequested means review requests were added. PullRequestActionReviewRequested PullRequestEventAction = "review_requested" // PullRequestActionReviewRequestRemoved means review requests were removed. PullRequestActionReviewRequestRemoved PullRequestEventAction = "review_request_removed" // PullRequestActionLabeled means labels were added. PullRequestActionLabeled PullRequestEventAction = "labeled" // PullRequestActionUnlabeled means labels were removed PullRequestActionUnlabeled PullRequestEventAction = "unlabeled" // PullRequestActionOpened means the PR was created PullRequestActionOpened PullRequestEventAction = "opened" // PullRequestActionEdited means the PR body changed. PullRequestActionEdited PullRequestEventAction = "edited" // PullRequestActionClosed means the PR was closed (or was merged). PullRequestActionClosed PullRequestEventAction = "closed" // PullRequestActionReopened means the PR was reopened. PullRequestActionReopened PullRequestEventAction = "reopened" // PullRequestActionSynchronize means the git state changed. PullRequestActionSynchronize PullRequestEventAction = "synchronize" // PullRequestActionReadyForReview means the PR is no longer a draft PR. PullRequestActionReadyForReview PullRequestEventAction = "ready_for_review" // PullRequestActionConvertedToDraft means the PR is now a draft PR. PullRequestActionConvertedToDraft PullRequestEventAction = "converted_to_draft" // PullRequestActionLocked means labels were added. PullRequestActionLocked PullRequestEventAction = "locked" // PullRequestActionUnlocked means labels were removed PullRequestActionUnlocked PullRequestEventAction = "unlocked" )
type PullRequestFileStatus ¶
type PullRequestFileStatus string
PullRequestFileStatus enumerates the statuses for this webhook payload type.
type PullRequestMergeType ¶
type PullRequestMergeType string
PullRequestMergeType enumerates the types of merges the GitHub API can perform https://developer.github.com/v3/pulls/#merge-a-pull-request-merge-button
const ( MergeMerge PullRequestMergeType = "merge" MergeRebase PullRequestMergeType = "rebase" MergeSquash PullRequestMergeType = "squash" )
Possible types of merges for the GitHub merge API
type PushEvent ¶
type PushEvent struct { Ref string `json:"ref"` Before string `json:"before"` After string `json:"after"` Created bool `json:"created"` Deleted bool `json:"deleted"` Forced bool `json:"forced"` Compare string `json:"compare"` Commits []Commit `json:"commits"` // Pusher is the user that pushed the commit, valid in a webhook event. Pusher User `json:"pusher"` // Sender contains more information that Pusher about the user. Sender User `json:"sender"` Repo Repo `json:"repository"` // GUID is included in the header of the request received by GitHub. GUID string }
PushEvent is what GitHub sends us when a user pushes to a repo.
type Reaction ¶
type Reaction struct {
Content string `json:"content"`
}
Reaction holds the type of emotional reaction.
type Repo ¶
type Repo struct { Owner User `json:"owner"` Name string `json:"name"` FullName string `json:"full_name"` HTMLURL string `json:"html_url"` Fork bool `json:"fork"` DefaultBranch string `json:"default_branch"` Archived bool `json:"archived"` Private bool `json:"private"` Description string `json:"description"` Homepage string `json:"homepage"` HasIssues bool `json:"has_issues"` HasProjects bool `json:"has_projects"` HasWiki bool `json:"has_wiki"` // Permissions reflect the permission level for the requester, so // on a repository GET call this will be for the user whose token // is being used, if listing a team's repos this will be for the // team's privilege level in the repo Permissions RepoPermissions `json:"permissions"` }
Repo contains general repository information: it includes fields available in repo records returned by GH "List" methods but not those returned by GH "Get" method. See also https://developer.github.com/v3/repos/#list-organization-repositories
type RepoCreateRequest ¶
type RepoCreateRequest struct { RepoRequest `json:",omitempty"` AutoInit *bool `json:"auto_init,omitempty"` GitignoreTemplate *string `json:"gitignore_template,omitempty"` LicenseTemplate *string `json:"license_template,omitempty"` }
RepoCreateRequest contains metadata used in requests to create a repo. See also: https://developer.github.com/v3/repos/#create
type RepoPermissionLevel ¶
type RepoPermissionLevel string
RepoPermissionLevel is admin, write, read or none.
See https://developer.github.com/v3/repos/collaborators/#review-a-users-permission-level
const ( // Read allows pull but not push Read RepoPermissionLevel = "read" // Write allows Read plus push Write RepoPermissionLevel = "write" // Admin allows Write plus change others' rights. Admin RepoPermissionLevel = "admin" // None disallows everything None RepoPermissionLevel = "none" )
func LevelFromPermissions ¶
func LevelFromPermissions(permissions RepoPermissions) RepoPermissionLevel
LevelFromPermissions adapts a repo permissions struct to the appropriate permission level used elsewhere.
func (RepoPermissionLevel) MarshalText ¶
func (l RepoPermissionLevel) MarshalText() ([]byte, error)
MarshalText returns the byte representation of the permission
func (*RepoPermissionLevel) UnmarshalText ¶
func (l *RepoPermissionLevel) UnmarshalText(text []byte) error
UnmarshalText validates the text is a valid string
type RepoPermissions ¶
type RepoPermissions struct { // Pull is equivalent to "Read" permissions in the web UI Pull bool `json:"pull"` // Push is equivalent to "Edit" permissions in the web UI Push bool `json:"push"` Admin bool `json:"admin"` }
RepoPermissions describes which permission level an entity has in a repo. At most one of the booleans here should be true.
func PermissionsFromTeamPermission ¶
func PermissionsFromTeamPermission(permission TeamPermission) RepoPermissions
PermissionsFromTeamPermissions
type RepoRequest ¶
type RepoRequest struct { Name *string `json:"name,omitempty"` Description *string `json:"description,omitempty"` Homepage *string `json:"homepage,omitempty"` Private *bool `json:"private,omitempty"` HasIssues *bool `json:"has_issues,omitempty"` HasProjects *bool `json:"has_projects,omitempty"` HasWiki *bool `json:"has_wiki,omitempty"` AllowSquashMerge *bool `json:"allow_squash_merge,omitempty"` AllowMergeCommit *bool `json:"allow_merge_commit,omitempty"` AllowRebaseMerge *bool `json:"allow_rebase_merge,omitempty"` }
RepoRequest contains metadata used in requests to create or update a Repo. Compared to `Repo`, its members are pointers to allow the "not set/use default semantics. See also: - https://developer.github.com/v3/repos/#create - https://developer.github.com/v3/repos/#edit
func (RepoRequest) Defined ¶
func (r RepoRequest) Defined() bool
Defined returns true if at least one of the pointer fields are not nil
func (RepoRequest) ToRepo ¶
func (r RepoRequest) ToRepo() *FullRepo
type RepoUpdateRequest ¶
type RepoUpdateRequest struct { RepoRequest `json:",omitempty"` DefaultBranch *string `json:"default_branch,omitempty"` Archived *bool `json:"archived,omitempty"` }
RepoUpdateRequest contains metadata used for updating a repository See also: https://developer.github.com/v3/repos/#edit
func (RepoUpdateRequest) Defined ¶
func (r RepoUpdateRequest) Defined() bool
func (RepoUpdateRequest) ToRepo ¶
func (r RepoUpdateRequest) ToRepo() *FullRepo
type RepositoryClient ¶
type RepositoryClient interface { GetRepo(owner, name string) (FullRepo, error) GetRepos(org string, isUser bool) ([]Repo, error) GetBranches(org, repo string, onlyProtected bool) ([]Branch, error) GetBranchProtection(org, repo, branch string) (*BranchProtection, error) RemoveBranchProtection(org, repo, branch string) error UpdateBranchProtection(org, repo, branch string, config BranchProtectionRequest) error AddRepoLabel(org, repo, label, description, color string) error UpdateRepoLabel(org, repo, label, newName, description, color string) error DeleteRepoLabel(org, repo, label string) error GetRepoLabels(org, repo string) ([]Label, error) AddLabel(org, repo string, number int, label string) error RemoveLabel(org, repo string, number int, label string) error GetFile(org, repo, filepath, commit string) ([]byte, error) IsCollaborator(org, repo, user string) (bool, error) ListCollaborators(org, repo string) ([]User, error) CreateFork(owner, repo string) (string, error) ListRepoTeams(org, repo string) ([]Team, error) CreateRepo(owner string, isUser bool, repo RepoCreateRequest) (*FullRepo, error) UpdateRepo(owner, name string, repo RepoUpdateRequest) (*FullRepo, error) }
RepositoryClient interface for repository related API actions
type RepositoryCommit ¶
type RepositoryCommit struct { NodeID string `json:"node_id,omitempty"` SHA string `json:"sha,omitempty"` Commit GitCommit `json:"commit,omitempty"` Author User `json:"author,omitempty"` Committer User `json:"committer,omitempty"` Parents []GitCommit `json:"parents,omitempty"` HTMLURL string `json:"html_url,omitempty"` URL string `json:"url,omitempty"` CommentsURL string `json:"comments_url,omitempty"` // Details about how many changes were made in this commit. Only filled in during GetCommit! Stats *CommitStats `json:"stats,omitempty"` // Details about which files, and how this commit touched. Only filled in during GetCommit! Files []CommitFile `json:"files,omitempty"` }
RepositoryCommit represents a commit in a repo. Note that it's wrapping a GitCommit, so author/committer information is in two places, but contain different details about them: in RepositoryCommit "github details", in GitCommit - "git details".
type RequiredPullRequestReviews ¶
type RequiredPullRequestReviews struct { DismissalRestrictions *Restrictions `json:"dismissal_restrictions"` DismissStaleReviews bool `json:"dismiss_stale_reviews"` RequireCodeOwnerReviews bool `json:"require_code_owner_reviews"` RequiredApprovingReviewCount int `json:"required_approving_review_count"` }
RequiredPullRequestReviews exposes the state of review rights.
type RequiredPullRequestReviewsRequest ¶
type RequiredPullRequestReviewsRequest struct { DismissalRestrictions RestrictionsRequest `json:"dismissal_restrictions"` DismissStaleReviews bool `json:"dismiss_stale_reviews"` RequireCodeOwnerReviews bool `json:"require_code_owner_reviews"` RequiredApprovingReviewCount int `json:"required_approving_review_count"` }
RequiredPullRequestReviewsRequest controls a request for review rights.
type RequiredStatusChecks ¶
type RequiredStatusChecks struct { Strict bool `json:"strict"` // PR must be up to date (include latest base branch commit). Contexts []string `json:"contexts"` }
RequiredStatusChecks specifies which contexts must pass to merge.
type RerunClient ¶
type RerunClient interface { TeamHasMember(teamID int, memberLogin string) (bool, error) GetTeamBySlug(slug string, org string) (*Team, error) IsCollaborator(org, repo, user string) (bool, error) IsMember(org, user string) (bool, error) GetIssueLabels(org, repo string, number int) ([]Label, error) }
RerunClient interface for job rerun access check related API actions
type Restrictions ¶
type Restrictions struct { Users []User `json:"users,omitempty"` Teams []Team `json:"teams,omitempty"` }
Restrictions exposes restrictions in github for an activity to people/teams.
type RestrictionsRequest ¶
type RestrictionsRequest struct { // Users is a list of user logins Users *[]string `json:"users,omitempty"` // Teams is a list of team slugs Teams *[]string `json:"teams,omitempty"` }
RestrictionsRequest tells github to restrict an activity to people/teams.
Use *[]string in order to distinguish unset and empty list. This is needed by dismissal_restrictions to distinguish do not restrict (empty object) and restrict everyone (nil user/teams list)
type Review ¶
type Review struct { ID int `json:"id"` User User `json:"user"` Body string `json:"body"` State ReviewState `json:"state"` HTMLURL string `json:"html_url"` SubmittedAt time.Time `json:"submitted_at"` }
Review describes a Pull Request review.
type ReviewAction ¶
type ReviewAction string
ReviewAction is the action that a review can be made with.
type ReviewComment ¶
type ReviewComment struct { ID int `json:"id"` ReviewID int `json:"pull_request_review_id"` User User `json:"user"` Body string `json:"body"` Path string `json:"path"` HTMLURL string `json:"html_url"` CreatedAt time.Time `json:"created_at"` UpdatedAt time.Time `json:"updated_at"` // Position will be nil if the code has changed such that the comment is no // longer relevant. Position *int `json:"position"` }
ReviewComment describes a Pull Request review.
type ReviewCommentEvent ¶
type ReviewCommentEvent struct { Action ReviewCommentEventAction `json:"action"` PullRequest PullRequest `json:"pull_request"` Repo Repo `json:"repository"` Comment ReviewComment `json:"comment"` // GUID is included in the header of the request received by GitHub. GUID string }
ReviewCommentEvent is what GitHub sends us when a PR review comment is changed.
type ReviewCommentEventAction ¶
type ReviewCommentEventAction string
ReviewCommentEventAction enumerates the triggers for this webhook payload type. See also: https://developer.github.com/v3/activity/events/types/#pullrequestreviewcommentevent
const ( // ReviewCommentActionCreated means the comment was created. ReviewCommentActionCreated ReviewCommentEventAction = "created" // ReviewCommentActionEdited means the comment was edited. ReviewCommentActionEdited ReviewCommentEventAction = "edited" // ReviewCommentActionDeleted means the comment was deleted. ReviewCommentActionDeleted ReviewCommentEventAction = "deleted" )
type ReviewEvent ¶
type ReviewEvent struct { Action ReviewEventAction `json:"action"` PullRequest PullRequest `json:"pull_request"` Repo Repo `json:"repository"` Review Review `json:"review"` // GUID is included in the header of the request received by GitHub. GUID string }
ReviewEvent is what GitHub sends us when a PR review is changed.
type ReviewEventAction ¶
type ReviewEventAction string
ReviewEventAction enumerates the triggers for this webhook payload type. See also: https://developer.github.com/v3/activity/events/types/#pullrequestreviewevent
const ( // ReviewActionSubmitted means the review was submitted. ReviewActionSubmitted ReviewEventAction = "submitted" // ReviewActionEdited means the review was edited. ReviewActionEdited ReviewEventAction = "edited" // ReviewActionDismissed means the review was dismissed. ReviewActionDismissed ReviewEventAction = "dismissed" )
type SignatureVerification ¶
type SignatureVerification struct { Verified bool `json:"verified,omitempty"` Reason string `json:"reason,omitempty"` Signature string `json:"signature,omitempty"` Payload string `json:"payload,omitempty"` }
SignatureVerification represents GPG signature verification.
type StateCannotBeChanged ¶
type StateCannotBeChanged struct {
Message string
}
StateCannotBeChanged represents the "custom" GitHub API error that occurs when a resource cannot be changed
func (StateCannotBeChanged) Error ¶
func (s StateCannotBeChanged) Error() string
type Status ¶
type Status struct { State string `json:"state"` TargetURL string `json:"target_url,omitempty"` Description string `json:"description,omitempty"` Context string `json:"context,omitempty"` }
Status is used to set a commit status line.
type StatusEvent ¶
type StatusEvent struct { SHA string `json:"sha,omitempty"` State string `json:"state,omitempty"` Description string `json:"description,omitempty"` TargetURL string `json:"target_url,omitempty"` ID int `json:"id,omitempty"` Name string `json:"name,omitempty"` Context string `json:"context,omitempty"` Sender User `json:"sender,omitempty"` Repo Repo `json:"repository,omitempty"` // GUID is included in the header of the request received by GitHub. GUID string }
StatusEvent fires whenever a git commit changes.
See https://developer.github.com/v3/activity/events/types/#statusevent
type Team ¶
type Team struct { ID int `json:"id,omitempty"` Name string `json:"name"` Slug string `json:"slug"` Description string `json:"description,omitempty"` Privacy string `json:"privacy,omitempty"` Parent *Team `json:"parent,omitempty"` // Only present in responses ParentTeamID *int `json:"parent_team_id,omitempty"` // Only valid in creates/edits Permission TeamPermission `json:"permission,omitempty"` }
Team is a github organizational team
type TeamClient ¶
type TeamClient interface { CreateTeam(org string, team Team) (*Team, error) EditTeam(t Team) (*Team, error) DeleteTeam(id int) error ListTeams(org string) ([]Team, error) UpdateTeamMembership(id int, user string, maintainer bool) (*TeamMembership, error) RemoveTeamMembership(id int, user string) error ListTeamMembers(id int, role string) ([]TeamMember, error) ListTeamRepos(id int) ([]Repo, error) UpdateTeamRepo(id int, org, repo string, permission TeamPermission) error RemoveTeamRepo(id int, org, repo string) error ListTeamInvitations(id int) ([]OrgInvitation, error) TeamHasMember(teamID int, memberLogin string) (bool, error) GetTeamBySlug(slug string, org string) (*Team, error) }
TeamClient interface for team related API actions
type TeamMember ¶
type TeamMember struct {
Login string `json:"login"`
}
TeamMember is a member of an organizational team
type TeamMembership ¶
type TeamMembership struct {
Membership
}
TeamMembership contains Membership fields for user membership on a team.
type TeamPermission ¶
type TeamPermission string
const ( RepoPull TeamPermission = "pull" RepoPush TeamPermission = "push" RepoAdmin TeamPermission = "admin" )
type UnauthorizedToPushError ¶
type UnauthorizedToPushError string
UnauthorizedToPushError happens when client is not allowed to push to github.
func (UnauthorizedToPushError) Error ¶
func (e UnauthorizedToPushError) Error() string
type UnmergablePRBaseChangedError ¶
type UnmergablePRBaseChangedError string
UnmergablePRBaseChangedError happens when github refuses merging a PR because the base changed.
func (UnmergablePRBaseChangedError) Error ¶
func (e UnmergablePRBaseChangedError) Error() string
type UnmergablePRError ¶
type UnmergablePRError string
UnmergablePRError happens when github refuses to merge a PR for other reasons (merge confclit).
func (UnmergablePRError) Error ¶
func (e UnmergablePRError) Error() string