github.com/google/go-github/v50@v50.2.0/github/event_types.go (about)

     1  // Copyright 2016 The go-github AUTHORS. All rights reserved.
     2  //
     3  // Use of this source code is governed by a BSD-style
     4  // license that can be found in the LICENSE file.
     5  
     6  // These event types are shared between the Events API and used as Webhook payloads.
     7  
     8  package github
     9  
    10  import "encoding/json"
    11  
    12  // RequestedAction is included in a CheckRunEvent when a user has invoked an action,
    13  // i.e. when the CheckRunEvent's Action field is "requested_action".
    14  type RequestedAction struct {
    15  	Identifier string `json:"identifier"` // The integrator reference of the action requested by the user.
    16  }
    17  
    18  // BranchProtectionRuleEvent triggered when a check suite is "created", "edited", or "deleted".
    19  // The Webhook event name is "branch_protection_rule".
    20  //
    21  // GitHub API docs: https://docs.github.com/en/developers/webhooks-and-events/webhooks/webhook-events-and-payloads#branch_protection_rule
    22  type BranchProtectionRuleEvent struct {
    23  	Action       *string               `json:"action,omitempty"`
    24  	Rule         *BranchProtectionRule `json:"rule,omitempty"`
    25  	Changes      *ProtectionChanges    `json:"changes,omitempty"`
    26  	Repo         *Repository           `json:"repository,omitempty"`
    27  	Org          *Organization         `json:"organization,omitempty"`
    28  	Sender       *User                 `json:"sender,omitempty"`
    29  	Installation *Installation         `json:"installation,omitempty"`
    30  }
    31  
    32  // CheckRunEvent is triggered when a check run is "created", "completed", or "rerequested".
    33  // The Webhook event name is "check_run".
    34  //
    35  // GitHub API docs: https://docs.github.com/en/developers/webhooks-and-events/webhook-events-and-payloads#check_run
    36  type CheckRunEvent struct {
    37  	CheckRun *CheckRun `json:"check_run,omitempty"`
    38  	// The action performed. Possible values are: "created", "completed", "rerequested" or "requested_action".
    39  	Action *string `json:"action,omitempty"`
    40  
    41  	// The following fields are only populated by Webhook events.
    42  	Repo         *Repository   `json:"repository,omitempty"`
    43  	Org          *Organization `json:"organization,omitempty"`
    44  	Sender       *User         `json:"sender,omitempty"`
    45  	Installation *Installation `json:"installation,omitempty"`
    46  
    47  	// The action requested by the user. Populated when the Action is "requested_action".
    48  	RequestedAction *RequestedAction `json:"requested_action,omitempty"` //
    49  }
    50  
    51  // CheckSuiteEvent is triggered when a check suite is "completed", "requested", or "rerequested".
    52  // The Webhook event name is "check_suite".
    53  //
    54  // GitHub API docs: https://docs.github.com/en/developers/webhooks-and-events/webhook-events-and-payloads#check_suite
    55  type CheckSuiteEvent struct {
    56  	CheckSuite *CheckSuite `json:"check_suite,omitempty"`
    57  	// The action performed. Possible values are: "completed", "requested" or "rerequested".
    58  	Action *string `json:"action,omitempty"`
    59  
    60  	// The following fields are only populated by Webhook events.
    61  	Repo         *Repository   `json:"repository,omitempty"`
    62  	Org          *Organization `json:"organization,omitempty"`
    63  	Sender       *User         `json:"sender,omitempty"`
    64  	Installation *Installation `json:"installation,omitempty"`
    65  }
    66  
    67  // CommitCommentEvent is triggered when a commit comment is created.
    68  // The Webhook event name is "commit_comment".
    69  //
    70  // GitHub API docs: https://docs.github.com/en/developers/webhooks-and-events/webhook-events-and-payloads#commit_comment
    71  type CommitCommentEvent struct {
    72  	Comment *RepositoryComment `json:"comment,omitempty"`
    73  
    74  	// The following fields are only populated by Webhook events.
    75  	Action       *string       `json:"action,omitempty"`
    76  	Repo         *Repository   `json:"repository,omitempty"`
    77  	Sender       *User         `json:"sender,omitempty"`
    78  	Installation *Installation `json:"installation,omitempty"`
    79  }
    80  
    81  // ContentReferenceEvent is triggered when the body or comment of an issue or
    82  // pull request includes a URL that matches a configured content reference
    83  // domain.
    84  // The Webhook event name is "content_reference".
    85  //
    86  // GitHub API docs: https://developer.github.com/webhooks/event-payloads/#content_reference
    87  type ContentReferenceEvent struct {
    88  	Action           *string           `json:"action,omitempty"`
    89  	ContentReference *ContentReference `json:"content_reference,omitempty"`
    90  	Repo             *Repository       `json:"repository,omitempty"`
    91  	Sender           *User             `json:"sender,omitempty"`
    92  	Installation     *Installation     `json:"installation,omitempty"`
    93  }
    94  
    95  // CreateEvent represents a created repository, branch, or tag.
    96  // The Webhook event name is "create".
    97  //
    98  // Note: webhooks will not receive this event for created repositories.
    99  // Additionally, webhooks will not receive this event for tags if more
   100  // than three tags are pushed at once.
   101  //
   102  // GitHub API docs: https://docs.github.com/en/developers/webhooks-and-events/github-event-types#createevent
   103  type CreateEvent struct {
   104  	Ref *string `json:"ref,omitempty"`
   105  	// RefType is the object that was created. Possible values are: "repository", "branch", "tag".
   106  	RefType      *string `json:"ref_type,omitempty"`
   107  	MasterBranch *string `json:"master_branch,omitempty"`
   108  	Description  *string `json:"description,omitempty"`
   109  	PusherType   *string `json:"pusher_type,omitempty"`
   110  
   111  	// The following fields are only populated by Webhook events.
   112  	Repo         *Repository   `json:"repository,omitempty"`
   113  	Org          *Organization `json:"organization,omitempty"`
   114  	Sender       *User         `json:"sender,omitempty"`
   115  	Installation *Installation `json:"installation,omitempty"`
   116  }
   117  
   118  // DeleteEvent represents a deleted branch or tag.
   119  // The Webhook event name is "delete".
   120  //
   121  // Note: webhooks will not receive this event for tags if more than three tags
   122  // are deleted at once.
   123  //
   124  // GitHub API docs: https://docs.github.com/en/developers/webhooks-and-events/github-event-types#deleteevent
   125  type DeleteEvent struct {
   126  	Ref *string `json:"ref,omitempty"`
   127  	// RefType is the object that was deleted. Possible values are: "branch", "tag".
   128  	RefType *string `json:"ref_type,omitempty"`
   129  
   130  	// The following fields are only populated by Webhook events.
   131  	PusherType   *string       `json:"pusher_type,omitempty"`
   132  	Repo         *Repository   `json:"repository,omitempty"`
   133  	Sender       *User         `json:"sender,omitempty"`
   134  	Installation *Installation `json:"installation,omitempty"`
   135  }
   136  
   137  // DeployKeyEvent is triggered when a deploy key is added or removed from a repository.
   138  // The Webhook event name is "deploy_key".
   139  //
   140  // GitHub API docs: https://docs.github.com/en/developers/webhooks-and-events/webhook-events-and-payloads#deploy_key
   141  type DeployKeyEvent struct {
   142  	// Action is the action that was performed. Possible values are:
   143  	// "created" or "deleted".
   144  	Action *string `json:"action,omitempty"`
   145  
   146  	// The deploy key resource.
   147  	Key *Key `json:"key,omitempty"`
   148  
   149  	// The Repository where the event occurred
   150  	Repo *Repository `json:"repository,omitempty"`
   151  
   152  	// The following field is only present when the webhook is triggered on
   153  	// a repository belonging to an organization.
   154  	Organization *Organization `json:"organization,omitempty"`
   155  
   156  	// The following fields are only populated by Webhook events.
   157  	Sender       *User         `json:"sender,omitempty"`
   158  	Installation *Installation `json:"installation,omitempty"`
   159  }
   160  
   161  // DeploymentEvent represents a deployment.
   162  // The Webhook event name is "deployment".
   163  //
   164  // Events of this type are not visible in timelines, they are only used to trigger hooks.
   165  //
   166  // GitHub API docs: https://docs.github.com/en/developers/webhooks-and-events/webhook-events-and-payloads#deployment
   167  type DeploymentEvent struct {
   168  	Deployment *Deployment `json:"deployment,omitempty"`
   169  	Repo       *Repository `json:"repository,omitempty"`
   170  
   171  	// The following fields are only populated by Webhook events.
   172  	Sender       *User         `json:"sender,omitempty"`
   173  	Installation *Installation `json:"installation,omitempty"`
   174  }
   175  
   176  // DeploymentStatusEvent represents a deployment status.
   177  // The Webhook event name is "deployment_status".
   178  //
   179  // Events of this type are not visible in timelines, they are only used to trigger hooks.
   180  //
   181  // GitHub API docs: https://docs.github.com/en/developers/webhooks-and-events/webhook-events-and-payloads#deployment_status
   182  type DeploymentStatusEvent struct {
   183  	Deployment       *Deployment       `json:"deployment,omitempty"`
   184  	DeploymentStatus *DeploymentStatus `json:"deployment_status,omitempty"`
   185  	Repo             *Repository       `json:"repository,omitempty"`
   186  
   187  	// The following fields are only populated by Webhook events.
   188  	Sender       *User         `json:"sender,omitempty"`
   189  	Installation *Installation `json:"installation,omitempty"`
   190  }
   191  
   192  // DiscussionCommentEvent represents a webhook event for a comment on discussion.
   193  // The Webhook event name is "discussion_comment".
   194  //
   195  // GitHub API docs: https://docs.github.com/webhooks-and-events/webhooks/webhook-events-and-payloads#discussion_comment
   196  type DiscussionCommentEvent struct {
   197  	// Action is the action that was performed on the comment.
   198  	// Possible values are: "created", "edited", "deleted". ** check what all can be added
   199  	Action       *string            `json:"action,omitempty"`
   200  	Discussion   *Discussion        `json:"discussion,omitempty"`
   201  	Comment      *CommentDiscussion `json:"comment,omitempty"`
   202  	Repo         *Repository        `json:"repository,omitempty"`
   203  	Org          *Organization      `json:"organization,omitempty"`
   204  	Sender       *User              `json:"sender,omitempty"`
   205  	Installation *Installation      `json:"installation,omitempty"`
   206  }
   207  
   208  // CommentDiscussion represents a comment in a GitHub DiscussionCommentEvent.
   209  type CommentDiscussion struct {
   210  	AuthorAssociation *string    `json:"author_association,omitempty"`
   211  	Body              *string    `json:"body,omitempty"`
   212  	ChildCommentCount *int       `json:"child_comment_count,omitempty"`
   213  	CreatedAt         *Timestamp `json:"created_at,omitempty"`
   214  	DiscussionID      *int64     `json:"discussion_id,omitempty"`
   215  	HTMLURL           *string    `json:"html_url,omitempty"`
   216  	ID                *int64     `json:"id,omitempty"`
   217  	NodeID            *string    `json:"node_id,omitempty"`
   218  	ParentID          *int64     `json:"parent_id,omitempty"`
   219  	Reactions         *Reactions `json:"reactions,omitempty"`
   220  	RepositoryURL     *string    `json:"repository_url,omitempty"`
   221  	UpdatedAt         *Timestamp `json:"updated_at,omitempty"`
   222  	User              *User      `json:"user,omitempty"`
   223  }
   224  
   225  // DiscussionEvent represents a webhook event for a discussion.
   226  // The Webhook event name is "discussion".
   227  //
   228  // GitHub API docs: https://docs.github.com/en/developers/webhooks-and-events/webhooks/webhook-events-and-payloads#discussion
   229  type DiscussionEvent struct {
   230  	// Action is the action that was performed. Possible values are:
   231  	// created, edited, deleted, pinned, unpinned, locked, unlocked,
   232  	// transferred, category_changed, answered, or unanswered.
   233  	Action       *string       `json:"action,omitempty"`
   234  	Discussion   *Discussion   `json:"discussion,omitempty"`
   235  	Repo         *Repository   `json:"repository,omitempty"`
   236  	Org          *Organization `json:"organization,omitempty"`
   237  	Sender       *User         `json:"sender,omitempty"`
   238  	Installation *Installation `json:"installation,omitempty"`
   239  }
   240  
   241  // Discussion represents a discussion in a GitHub DiscussionEvent.
   242  type Discussion struct {
   243  	RepositoryURL      *string             `json:"repository_url,omitempty"`
   244  	DiscussionCategory *DiscussionCategory `json:"category,omitempty"`
   245  	AnswerHTMLURL      *string             `json:"answer_html_url,omitempty"`
   246  	AnswerChosenAt     *Timestamp          `json:"answer_chosen_at,omitempty"`
   247  	AnswerChosenBy     *string             `json:"answer_chosen_by,omitempty"`
   248  	HTMLURL            *string             `json:"html_url,omitempty"`
   249  	ID                 *int64              `json:"id,omitempty"`
   250  	NodeID             *string             `json:"node_id,omitempty"`
   251  	Number             *int                `json:"number,omitempty"`
   252  	Title              *string             `json:"title,omitempty"`
   253  	User               *User               `json:"user,omitempty"`
   254  	State              *string             `json:"state,omitempty"`
   255  	Locked             *bool               `json:"locked,omitempty"`
   256  	Comments           *int                `json:"comments,omitempty"`
   257  	CreatedAt          *Timestamp          `json:"created_at,omitempty"`
   258  	UpdatedAt          *Timestamp          `json:"updated_at,omitempty"`
   259  	AuthorAssociation  *string             `json:"author_association,omitempty"`
   260  	ActiveLockReason   *string             `json:"active_lock_reason,omitempty"`
   261  	Body               *string             `json:"body,omitempty"`
   262  }
   263  
   264  // DiscussionCategory represents a discussion category in a GitHub DiscussionEvent.
   265  type DiscussionCategory struct {
   266  	ID           *int64     `json:"id,omitempty"`
   267  	NodeID       *string    `json:"node_id,omitempty"`
   268  	RepositoryID *int64     `json:"repository_id,omitempty"`
   269  	Emoji        *string    `json:"emoji,omitempty"`
   270  	Name         *string    `json:"name,omitempty"`
   271  	Description  *string    `json:"description,omitempty"`
   272  	CreatedAt    *Timestamp `json:"created_at,omitempty"`
   273  	UpdatedAt    *Timestamp `json:"updated_at,omitempty"`
   274  	Slug         *string    `json:"slug,omitempty"`
   275  	IsAnswerable *bool      `json:"is_answerable,omitempty"`
   276  }
   277  
   278  // ForkEvent is triggered when a user forks a repository.
   279  // The Webhook event name is "fork".
   280  //
   281  // GitHub API docs: https://docs.github.com/en/developers/webhooks-and-events/webhook-events-and-payloads#fork
   282  type ForkEvent struct {
   283  	// Forkee is the created repository.
   284  	Forkee *Repository `json:"forkee,omitempty"`
   285  
   286  	// The following fields are only populated by Webhook events.
   287  	Repo         *Repository   `json:"repository,omitempty"`
   288  	Sender       *User         `json:"sender,omitempty"`
   289  	Installation *Installation `json:"installation,omitempty"`
   290  }
   291  
   292  // GitHubAppAuthorizationEvent is triggered when a user's authorization for a
   293  // GitHub Application is revoked.
   294  //
   295  // GitHub API docs: https://docs.github.com/en/developers/webhooks-and-events/webhook-events-and-payloads#github_app_authorization
   296  type GitHubAppAuthorizationEvent struct {
   297  	// The action performed. Possible value is: "revoked".
   298  	Action *string `json:"action,omitempty"`
   299  
   300  	// The following fields are only populated by Webhook events.
   301  	Sender       *User         `json:"sender,omitempty"`
   302  	Installation *Installation `json:"installation,omitempty"`
   303  }
   304  
   305  // Page represents a single Wiki page.
   306  type Page struct {
   307  	PageName *string `json:"page_name,omitempty"`
   308  	Title    *string `json:"title,omitempty"`
   309  	Summary  *string `json:"summary,omitempty"`
   310  	Action   *string `json:"action,omitempty"`
   311  	SHA      *string `json:"sha,omitempty"`
   312  	HTMLURL  *string `json:"html_url,omitempty"`
   313  }
   314  
   315  // GollumEvent is triggered when a Wiki page is created or updated.
   316  // The Webhook event name is "gollum".
   317  //
   318  // GitHub API docs: https://docs.github.com/en/developers/webhooks-and-events/webhook-events-and-payloads#gollum
   319  type GollumEvent struct {
   320  	Pages []*Page `json:"pages,omitempty"`
   321  
   322  	// The following fields are only populated by Webhook events.
   323  	Repo         *Repository   `json:"repository,omitempty"`
   324  	Sender       *User         `json:"sender,omitempty"`
   325  	Installation *Installation `json:"installation,omitempty"`
   326  }
   327  
   328  // EditChange represents the changes when an issue, pull request, comment,
   329  // or repository has been edited.
   330  type EditChange struct {
   331  	Title *EditTitle `json:"title,omitempty"`
   332  	Body  *EditBody  `json:"body,omitempty"`
   333  	Base  *EditBase  `json:"base,omitempty"`
   334  	Repo  *EditRepo  `json:"repository,omitempty"`
   335  }
   336  
   337  // EditTitle represents a pull-request title change.
   338  type EditTitle struct {
   339  	From *string `json:"from,omitempty"`
   340  }
   341  
   342  // EditBody represents a change of pull-request body.
   343  type EditBody struct {
   344  	From *string `json:"from,omitempty"`
   345  }
   346  
   347  // EditBase represents the change of a pull-request base branch.
   348  type EditBase struct {
   349  	Ref *EditRef `json:"ref,omitempty"`
   350  	SHA *EditSHA `json:"sha,omitempty"`
   351  }
   352  
   353  // EditRef represents a ref change of a pull-request.
   354  type EditRef struct {
   355  	From *string `json:"from,omitempty"`
   356  }
   357  
   358  // EditRepo represents a change of repository name.
   359  type EditRepo struct {
   360  	Name *RepoName `json:"name,omitempty"`
   361  }
   362  
   363  // RepoName represents a change of repository name.
   364  type RepoName struct {
   365  	From *string `json:"from,omitempty"`
   366  }
   367  
   368  // EditSHA represents a sha change of a pull-request.
   369  type EditSHA struct {
   370  	From *string `json:"from,omitempty"`
   371  }
   372  
   373  // ProjectChange represents the changes when a project has been edited.
   374  type ProjectChange struct {
   375  	Name *ProjectName `json:"name,omitempty"`
   376  	Body *ProjectBody `json:"body,omitempty"`
   377  }
   378  
   379  // ProjectName represents a project name change.
   380  type ProjectName struct {
   381  	From *string `json:"from,omitempty"`
   382  }
   383  
   384  // ProjectBody represents a project body change.
   385  type ProjectBody struct {
   386  	From *string `json:"from,omitempty"`
   387  }
   388  
   389  // ProjectCardChange represents the changes when a project card has been edited.
   390  type ProjectCardChange struct {
   391  	Note *ProjectCardNote `json:"note,omitempty"`
   392  }
   393  
   394  // ProjectCardNote represents a change of a note of a project card.
   395  type ProjectCardNote struct {
   396  	From *string `json:"from,omitempty"`
   397  }
   398  
   399  // ProjectColumnChange represents the changes when a project column has been edited.
   400  type ProjectColumnChange struct {
   401  	Name *ProjectColumnName `json:"name,omitempty"`
   402  }
   403  
   404  // ProjectColumnName represents a project column name change.
   405  type ProjectColumnName struct {
   406  	From *string `json:"from,omitempty"`
   407  }
   408  
   409  // TeamChange represents the changes when a team has been edited.
   410  type TeamChange struct {
   411  	Description *TeamDescription `json:"description,omitempty"`
   412  	Name        *TeamName        `json:"name,omitempty"`
   413  	Privacy     *TeamPrivacy     `json:"privacy,omitempty"`
   414  	Repository  *TeamRepository  `json:"repository,omitempty"`
   415  }
   416  
   417  // TeamDescription represents a team description change.
   418  type TeamDescription struct {
   419  	From *string `json:"from,omitempty"`
   420  }
   421  
   422  // TeamName represents a team name change.
   423  type TeamName struct {
   424  	From *string `json:"from,omitempty"`
   425  }
   426  
   427  // TeamPrivacy represents a team privacy change.
   428  type TeamPrivacy struct {
   429  	From *string `json:"from,omitempty"`
   430  }
   431  
   432  // TeamRepository represents a team repository permission change.
   433  type TeamRepository struct {
   434  	Permissions *TeamPermissions `json:"permissions,omitempty"`
   435  }
   436  
   437  // TeamPermissions represents a team permission change.
   438  type TeamPermissions struct {
   439  	From *TeamPermissionsFrom `json:"from,omitempty"`
   440  }
   441  
   442  // TeamPermissionsFrom represents a team permission change.
   443  type TeamPermissionsFrom struct {
   444  	Admin *bool `json:"admin,omitempty"`
   445  	Pull  *bool `json:"pull,omitempty"`
   446  	Push  *bool `json:"push,omitempty"`
   447  }
   448  
   449  // InstallationEvent is triggered when a GitHub App has been installed, uninstalled, suspend, unsuspended
   450  // or new permissions have been accepted.
   451  // The Webhook event name is "installation".
   452  //
   453  // GitHub API docs: https://docs.github.com/en/developers/webhooks-and-events/webhook-events-and-payloads#installation
   454  type InstallationEvent struct {
   455  	// The action that was performed. Can be either "created", "deleted", "suspend", "unsuspend" or "new_permissions_accepted".
   456  	Action       *string       `json:"action,omitempty"`
   457  	Repositories []*Repository `json:"repositories,omitempty"`
   458  	Sender       *User         `json:"sender,omitempty"`
   459  	Installation *Installation `json:"installation,omitempty"`
   460  	// TODO key "requester" is not covered
   461  }
   462  
   463  // InstallationRepositoriesEvent is triggered when a repository is added or
   464  // removed from an installation. The Webhook event name is "installation_repositories".
   465  //
   466  // GitHub API docs: https://docs.github.com/en/developers/webhooks-and-events/webhook-events-and-payloads#installation_repositories
   467  type InstallationRepositoriesEvent struct {
   468  	// The action that was performed. Can be either "added" or "removed".
   469  	Action              *string       `json:"action,omitempty"`
   470  	RepositoriesAdded   []*Repository `json:"repositories_added,omitempty"`
   471  	RepositoriesRemoved []*Repository `json:"repositories_removed,omitempty"`
   472  	RepositorySelection *string       `json:"repository_selection,omitempty"`
   473  	Sender              *User         `json:"sender,omitempty"`
   474  	Installation        *Installation `json:"installation,omitempty"`
   475  }
   476  
   477  // IssueCommentEvent is triggered when an issue comment is created on an issue
   478  // or pull request.
   479  // The Webhook event name is "issue_comment".
   480  //
   481  // GitHub API docs: https://docs.github.com/en/developers/webhooks-and-events/webhook-events-and-payloads#issue_comment
   482  type IssueCommentEvent struct {
   483  	// Action is the action that was performed on the comment.
   484  	// Possible values are: "created", "edited", "deleted".
   485  	Action  *string       `json:"action,omitempty"`
   486  	Issue   *Issue        `json:"issue,omitempty"`
   487  	Comment *IssueComment `json:"comment,omitempty"`
   488  
   489  	// The following fields are only populated by Webhook events.
   490  	Changes      *EditChange   `json:"changes,omitempty"`
   491  	Repo         *Repository   `json:"repository,omitempty"`
   492  	Sender       *User         `json:"sender,omitempty"`
   493  	Installation *Installation `json:"installation,omitempty"`
   494  
   495  	// The following field is only present when the webhook is triggered on
   496  	// a repository belonging to an organization.
   497  	Organization *Organization `json:"organization,omitempty"`
   498  }
   499  
   500  // IssuesEvent is triggered when an issue is opened, edited, deleted, transferred,
   501  // pinned, unpinned, closed, reopened, assigned, unassigned, labeled, unlabeled,
   502  // locked, unlocked, milestoned, or demilestoned.
   503  // The Webhook event name is "issues".
   504  //
   505  // GitHub API docs: https://docs.github.com/en/developers/webhooks-and-events/webhook-events-and-payloads#issues
   506  type IssuesEvent struct {
   507  	// Action is the action that was performed. Possible values are: "opened",
   508  	// "edited", "deleted", "transferred", "pinned", "unpinned", "closed", "reopened",
   509  	// "assigned", "unassigned", "labeled", "unlabeled", "locked", "unlocked",
   510  	// "milestoned", or "demilestoned".
   511  	Action   *string `json:"action,omitempty"`
   512  	Issue    *Issue  `json:"issue,omitempty"`
   513  	Assignee *User   `json:"assignee,omitempty"`
   514  	Label    *Label  `json:"label,omitempty"`
   515  
   516  	// The following fields are only populated by Webhook events.
   517  	Changes      *EditChange   `json:"changes,omitempty"`
   518  	Repo         *Repository   `json:"repository,omitempty"`
   519  	Sender       *User         `json:"sender,omitempty"`
   520  	Installation *Installation `json:"installation,omitempty"`
   521  	Milestone    *Milestone    `json:"milestone,omitempty"`
   522  }
   523  
   524  // LabelEvent is triggered when a repository's label is created, edited, or deleted.
   525  // The Webhook event name is "label"
   526  //
   527  // GitHub API docs: https://docs.github.com/en/developers/webhooks-and-events/webhook-events-and-payloads#label
   528  type LabelEvent struct {
   529  	// Action is the action that was performed. Possible values are:
   530  	// "created", "edited", "deleted"
   531  	Action  *string     `json:"action,omitempty"`
   532  	Label   *Label      `json:"label,omitempty"`
   533  	Changes *EditChange `json:"changes,omitempty"`
   534  
   535  	// The following fields are only populated by Webhook events.
   536  	Repo         *Repository   `json:"repository,omitempty"`
   537  	Org          *Organization `json:"organization,omitempty"`
   538  	Sender       *User         `json:"sender,omitempty"`
   539  	Installation *Installation `json:"installation,omitempty"`
   540  }
   541  
   542  // MarketplacePurchaseEvent is triggered when a user purchases, cancels, or changes
   543  // their GitHub Marketplace plan.
   544  // Webhook event name "marketplace_purchase".
   545  //
   546  // GitHub API docs: https://docs.github.com/en/developers/webhooks-and-events/webhook-events-and-payloads#marketplace_purchase
   547  type MarketplacePurchaseEvent struct {
   548  	// Action is the action that was performed. Possible values are:
   549  	// "purchased", "cancelled", "pending_change", "pending_change_cancelled", "changed".
   550  	Action *string `json:"action,omitempty"`
   551  
   552  	// The following fields are only populated by Webhook events.
   553  	EffectiveDate               *Timestamp           `json:"effective_date,omitempty"`
   554  	MarketplacePurchase         *MarketplacePurchase `json:"marketplace_purchase,omitempty"`
   555  	PreviousMarketplacePurchase *MarketplacePurchase `json:"previous_marketplace_purchase,omitempty"`
   556  	Sender                      *User                `json:"sender,omitempty"`
   557  	Installation                *Installation        `json:"installation,omitempty"`
   558  }
   559  
   560  // MemberEvent is triggered when a user is added as a collaborator to a repository.
   561  // The Webhook event name is "member".
   562  //
   563  // GitHub API docs: https://docs.github.com/en/developers/webhooks-and-events/webhook-events-and-payloads#member
   564  type MemberEvent struct {
   565  	// Action is the action that was performed. Possible value is: "added".
   566  	Action *string `json:"action,omitempty"`
   567  	Member *User   `json:"member,omitempty"`
   568  
   569  	// The following fields are only populated by Webhook events.
   570  	Repo         *Repository   `json:"repository,omitempty"`
   571  	Sender       *User         `json:"sender,omitempty"`
   572  	Installation *Installation `json:"installation,omitempty"`
   573  }
   574  
   575  // MembershipEvent is triggered when a user is added or removed from a team.
   576  // The Webhook event name is "membership".
   577  //
   578  // Events of this type are not visible in timelines, they are only used to
   579  // trigger organization webhooks.
   580  //
   581  // GitHub API docs: https://docs.github.com/en/developers/webhooks-and-events/webhook-events-and-payloads#membership
   582  type MembershipEvent struct {
   583  	// Action is the action that was performed. Possible values are: "added", "removed".
   584  	Action *string `json:"action,omitempty"`
   585  	// Scope is the scope of the membership. Possible value is: "team".
   586  	Scope  *string `json:"scope,omitempty"`
   587  	Member *User   `json:"member,omitempty"`
   588  	Team   *Team   `json:"team,omitempty"`
   589  
   590  	// The following fields are only populated by Webhook events.
   591  	Org          *Organization `json:"organization,omitempty"`
   592  	Sender       *User         `json:"sender,omitempty"`
   593  	Installation *Installation `json:"installation,omitempty"`
   594  }
   595  
   596  // MergeGroup represents the merge group in a merge queue.
   597  type MergeGroup struct {
   598  	// The SHA of the merge group.
   599  	HeadSHA *string `json:"head_sha,omitempty"`
   600  	// The full ref of the merge group.
   601  	HeadRef *string `json:"head_ref,omitempty"`
   602  	// The SHA of the merge group's parent commit.
   603  	BaseSHA *string `json:"base_sha,omitempty"`
   604  	// The full ref of the branch the merge group will be merged into.
   605  	BaseRef *string `json:"base_ref,omitempty"`
   606  	// An expanded representation of the head_sha commit.
   607  	HeadCommit *Commit `json:"head_commit,omitempty"`
   608  }
   609  
   610  // MergeGroupEvent represents activity related to merge groups in a merge queue. The type of activity is specified
   611  // in the action property of the payload object.
   612  //
   613  // GitHub API docs: https://docs.github.com/en/developers/webhooks-and-events/webhook-events-and-payloads#merge_group
   614  type MergeGroupEvent struct {
   615  	// The action that was performed. Currently, can only be checks_requested.
   616  	Action *string `json:"action,omitempty"`
   617  	// The merge group.
   618  	MergeGroup *MergeGroup `json:"merge_group,omitempty"`
   619  
   620  	// The following fields are only populated by Webhook events.
   621  	Repo         *Repository   `json:"repository,omitempty"`
   622  	Org          *Organization `json:"organization,omitempty"`
   623  	Installation *Installation `json:"installation,omitempty"`
   624  	Sender       *User         `json:"sender,omitempty"`
   625  }
   626  
   627  // MetaEvent is triggered when the webhook that this event is configured on is deleted.
   628  // This event will only listen for changes to the particular hook the event is installed on.
   629  // Therefore, it must be selected for each hook that you'd like to receive meta events for.
   630  // The Webhook event name is "meta".
   631  //
   632  // GitHub API docs: https://docs.github.com/en/developers/webhooks-and-events/webhook-events-and-payloads#meta
   633  type MetaEvent struct {
   634  	// Action is the action that was performed. Possible value is: "deleted".
   635  	Action *string `json:"action,omitempty"`
   636  	// The ID of the modified webhook.
   637  	HookID *int64 `json:"hook_id,omitempty"`
   638  	// The modified webhook.
   639  	// This will contain different keys based on the type of webhook it is: repository,
   640  	// organization, business, app, or GitHub Marketplace.
   641  	Hook *Hook `json:"hook,omitempty"`
   642  
   643  	// The following fields are only populated by Webhook events.
   644  	Repo         *Repository   `json:"repository,omitempty"`
   645  	Org          *Organization `json:"organization,omitempty"`
   646  	Sender       *User         `json:"sender,omitempty"`
   647  	Installation *Installation `json:"installation,omitempty"`
   648  }
   649  
   650  // MilestoneEvent is triggered when a milestone is created, closed, opened, edited, or deleted.
   651  // The Webhook event name is "milestone".
   652  //
   653  // GitHub API docs: https://docs.github.com/en/developers/webhooks-and-events/webhook-events-and-payloads#milestone
   654  type MilestoneEvent struct {
   655  	// Action is the action that was performed. Possible values are:
   656  	// "created", "closed", "opened", "edited", "deleted"
   657  	Action    *string    `json:"action,omitempty"`
   658  	Milestone *Milestone `json:"milestone,omitempty"`
   659  
   660  	// The following fields are only populated by Webhook events.
   661  	Changes      *EditChange   `json:"changes,omitempty"`
   662  	Repo         *Repository   `json:"repository,omitempty"`
   663  	Sender       *User         `json:"sender,omitempty"`
   664  	Org          *Organization `json:"organization,omitempty"`
   665  	Installation *Installation `json:"installation,omitempty"`
   666  }
   667  
   668  // OrganizationEvent is triggered when an organization is deleted and renamed, and when a user is added,
   669  // removed, or invited to an organization.
   670  // Events of this type are not visible in timelines. These events are only used to trigger organization hooks.
   671  // Webhook event name is "organization".
   672  //
   673  // GitHub API docs: https://docs.github.com/en/developers/webhooks-and-events/webhook-events-and-payloads#organization
   674  type OrganizationEvent struct {
   675  	// Action is the action that was performed.
   676  	// Possible values are: "deleted", "renamed", "member_added", "member_removed", or "member_invited".
   677  	Action *string `json:"action,omitempty"`
   678  
   679  	// Invitation is the invitation for the user or email if the action is "member_invited".
   680  	Invitation *Invitation `json:"invitation,omitempty"`
   681  
   682  	// Membership is the membership between the user and the organization.
   683  	// Not present when the action is "member_invited".
   684  	Membership *Membership `json:"membership,omitempty"`
   685  
   686  	Organization *Organization `json:"organization,omitempty"`
   687  	Sender       *User         `json:"sender,omitempty"`
   688  	Installation *Installation `json:"installation,omitempty"`
   689  }
   690  
   691  // OrgBlockEvent is triggered when an organization blocks or unblocks a user.
   692  // The Webhook event name is "org_block".
   693  //
   694  // GitHub API docs: https://docs.github.com/en/developers/webhooks-and-events/webhook-events-and-payloads#org_block
   695  type OrgBlockEvent struct {
   696  	// Action is the action that was performed.
   697  	// Can be "blocked" or "unblocked".
   698  	Action       *string       `json:"action,omitempty"`
   699  	BlockedUser  *User         `json:"blocked_user,omitempty"`
   700  	Organization *Organization `json:"organization,omitempty"`
   701  	Sender       *User         `json:"sender,omitempty"`
   702  
   703  	// The following fields are only populated by Webhook events.
   704  	Installation *Installation `json:"installation,omitempty"`
   705  }
   706  
   707  // PackageEvent represents activity related to GitHub Packages.
   708  // The Webhook event name is "package".
   709  //
   710  // This event is triggered when a GitHub Package is published or updated.
   711  //
   712  // GitHub API docs: https://developer.github.com/webhooks/event-payloads/#package
   713  type PackageEvent struct {
   714  	// Action is the action that was performed.
   715  	// Can be "published" or "updated".
   716  	Action  *string       `json:"action,omitempty"`
   717  	Package *Package      `json:"package,omitempty"`
   718  	Repo    *Repository   `json:"repository,omitempty"`
   719  	Org     *Organization `json:"organization,omitempty"`
   720  	Sender  *User         `json:"sender,omitempty"`
   721  
   722  	// The following fields are only populated by Webhook events.
   723  	Installation *Installation `json:"installation,omitempty"`
   724  }
   725  
   726  // PageBuildEvent represents an attempted build of a GitHub Pages site, whether
   727  // successful or not.
   728  // The Webhook event name is "page_build".
   729  //
   730  // This event is triggered on push to a GitHub Pages enabled branch (gh-pages
   731  // for project pages, master for user and organization pages).
   732  //
   733  // Events of this type are not visible in timelines, they are only used to trigger hooks.
   734  //
   735  // GitHub API docs: https://docs.github.com/en/developers/webhooks-and-events/webhook-events-and-payloads#page_build
   736  type PageBuildEvent struct {
   737  	Build *PagesBuild `json:"build,omitempty"`
   738  
   739  	// The following fields are only populated by Webhook events.
   740  	ID           *int64        `json:"id,omitempty"`
   741  	Repo         *Repository   `json:"repository,omitempty"`
   742  	Sender       *User         `json:"sender,omitempty"`
   743  	Installation *Installation `json:"installation,omitempty"`
   744  }
   745  
   746  // PingEvent is triggered when a Webhook is added to GitHub.
   747  //
   748  // GitHub API docs: https://developer.github.com/webhooks/#ping-event
   749  type PingEvent struct {
   750  	// Random string of GitHub zen.
   751  	Zen *string `json:"zen,omitempty"`
   752  	// The ID of the webhook that triggered the ping.
   753  	HookID *int64 `json:"hook_id,omitempty"`
   754  	// The webhook configuration.
   755  	Hook *Hook `json:"hook,omitempty"`
   756  
   757  	// The following fields are only populated by Webhook events.
   758  	Repo         *Repository   `json:"repository,omitempty"`
   759  	Org          *Organization `json:"organization,omitempty"`
   760  	Sender       *User         `json:"sender,omitempty"`
   761  	Installation *Installation `json:"installation,omitempty"`
   762  }
   763  
   764  // ProjectEvent is triggered when project is created, modified or deleted.
   765  // The webhook event name is "project".
   766  //
   767  // GitHub API docs: https://docs.github.com/en/developers/webhooks-and-events/webhook-events-and-payloads#project
   768  type ProjectEvent struct {
   769  	Action  *string        `json:"action,omitempty"`
   770  	Changes *ProjectChange `json:"changes,omitempty"`
   771  	Project *Project       `json:"project,omitempty"`
   772  
   773  	// The following fields are only populated by Webhook events.
   774  	Repo         *Repository   `json:"repository,omitempty"`
   775  	Org          *Organization `json:"organization,omitempty"`
   776  	Sender       *User         `json:"sender,omitempty"`
   777  	Installation *Installation `json:"installation,omitempty"`
   778  }
   779  
   780  // ProjectCardEvent is triggered when a project card is created, updated, moved, converted to an issue, or deleted.
   781  // The webhook event name is "project_card".
   782  //
   783  // GitHub API docs: https://docs.github.com/en/developers/webhooks-and-events/webhook-events-and-payloads#project_card
   784  type ProjectCardEvent struct {
   785  	Action      *string            `json:"action,omitempty"`
   786  	Changes     *ProjectCardChange `json:"changes,omitempty"`
   787  	AfterID     *int64             `json:"after_id,omitempty"`
   788  	ProjectCard *ProjectCard       `json:"project_card,omitempty"`
   789  
   790  	// The following fields are only populated by Webhook events.
   791  	Repo         *Repository   `json:"repository,omitempty"`
   792  	Org          *Organization `json:"organization,omitempty"`
   793  	Sender       *User         `json:"sender,omitempty"`
   794  	Installation *Installation `json:"installation,omitempty"`
   795  }
   796  
   797  // ProjectColumnEvent is triggered when a project column is created, updated, moved, or deleted.
   798  // The webhook event name is "project_column".
   799  //
   800  // GitHub API docs: https://docs.github.com/en/developers/webhooks-and-events/webhook-events-and-payloads#project_column
   801  type ProjectColumnEvent struct {
   802  	Action        *string              `json:"action,omitempty"`
   803  	Changes       *ProjectColumnChange `json:"changes,omitempty"`
   804  	AfterID       *int64               `json:"after_id,omitempty"`
   805  	ProjectColumn *ProjectColumn       `json:"project_column,omitempty"`
   806  
   807  	// The following fields are only populated by Webhook events.
   808  	Repo         *Repository   `json:"repository,omitempty"`
   809  	Org          *Organization `json:"organization,omitempty"`
   810  	Sender       *User         `json:"sender,omitempty"`
   811  	Installation *Installation `json:"installation,omitempty"`
   812  }
   813  
   814  // PublicEvent is triggered when a private repository is open sourced.
   815  // According to GitHub: "Without a doubt: the best GitHub event."
   816  // The Webhook event name is "public".
   817  //
   818  // GitHub API docs: https://docs.github.com/en/developers/webhooks-and-events/webhook-events-and-payloads#public
   819  type PublicEvent struct {
   820  	// The following fields are only populated by Webhook events.
   821  	Repo         *Repository   `json:"repository,omitempty"`
   822  	Sender       *User         `json:"sender,omitempty"`
   823  	Installation *Installation `json:"installation,omitempty"`
   824  }
   825  
   826  // PullRequestEvent is triggered when a pull request is assigned, unassigned, labeled,
   827  // unlabeled, opened, edited, closed, reopened, synchronize, ready_for_review,
   828  // locked, unlocked, a pull request review is requested, or a review request is removed.
   829  // The Webhook event name is "pull_request".
   830  //
   831  // GitHub API docs: https://docs.github.com/en/developers/webhooks-and-events/github-event-types#pullrequestevent
   832  type PullRequestEvent struct {
   833  	// Action is the action that was performed. Possible values are:
   834  	// "assigned", "unassigned", "review_requested", "review_request_removed", "labeled", "unlabeled",
   835  	// "opened", "edited", "closed", "ready_for_review", "locked", "unlocked", or "reopened".
   836  	// If the action is "closed" and the "merged" key is "false", the pull request was closed with unmerged commits.
   837  	// If the action is "closed" and the "merged" key is "true", the pull request was merged.
   838  	// While webhooks are also triggered when a pull request is synchronized, Events API timelines
   839  	// don't include pull request events with the "synchronize" action.
   840  	Action      *string      `json:"action,omitempty"`
   841  	Assignee    *User        `json:"assignee,omitempty"`
   842  	Number      *int         `json:"number,omitempty"`
   843  	PullRequest *PullRequest `json:"pull_request,omitempty"`
   844  
   845  	// The following fields are only populated by Webhook events.
   846  	Changes *EditChange `json:"changes,omitempty"`
   847  	// RequestedReviewer is populated in "review_requested", "review_request_removed" event deliveries.
   848  	// A request affecting multiple reviewers at once is split into multiple
   849  	// such event deliveries, each with a single, different RequestedReviewer.
   850  	RequestedReviewer *User `json:"requested_reviewer,omitempty"`
   851  	// In the event that a team is requested instead of a user, "requested_team" gets sent in place of
   852  	// "requested_user" with the same delivery behavior.
   853  	RequestedTeam *Team         `json:"requested_team,omitempty"`
   854  	Repo          *Repository   `json:"repository,omitempty"`
   855  	Sender        *User         `json:"sender,omitempty"`
   856  	Installation  *Installation `json:"installation,omitempty"`
   857  	Label         *Label        `json:"label,omitempty"` // Populated in "labeled" event deliveries.
   858  
   859  	// The following field is only present when the webhook is triggered on
   860  	// a repository belonging to an organization.
   861  	Organization *Organization `json:"organization,omitempty"`
   862  
   863  	// The following fields are only populated when the Action is "synchronize".
   864  	Before *string `json:"before,omitempty"`
   865  	After  *string `json:"after,omitempty"`
   866  }
   867  
   868  // PullRequestReviewEvent is triggered when a review is submitted on a pull
   869  // request.
   870  // The Webhook event name is "pull_request_review".
   871  //
   872  // GitHub API docs: https://docs.github.com/en/developers/webhooks-and-events/webhook-events-and-payloads#pull_request_review
   873  type PullRequestReviewEvent struct {
   874  	// Action is always "submitted".
   875  	Action      *string            `json:"action,omitempty"`
   876  	Review      *PullRequestReview `json:"review,omitempty"`
   877  	PullRequest *PullRequest       `json:"pull_request,omitempty"`
   878  
   879  	// The following fields are only populated by Webhook events.
   880  	Repo         *Repository   `json:"repository,omitempty"`
   881  	Sender       *User         `json:"sender,omitempty"`
   882  	Installation *Installation `json:"installation,omitempty"`
   883  
   884  	// The following field is only present when the webhook is triggered on
   885  	// a repository belonging to an organization.
   886  	Organization *Organization `json:"organization,omitempty"`
   887  }
   888  
   889  // PullRequestReviewCommentEvent is triggered when a comment is created on a
   890  // portion of the unified diff of a pull request.
   891  // The Webhook event name is "pull_request_review_comment".
   892  //
   893  // GitHub API docs: https://docs.github.com/en/developers/webhooks-and-events/webhook-events-and-payloads#pull_request_review_comment
   894  type PullRequestReviewCommentEvent struct {
   895  	// Action is the action that was performed on the comment.
   896  	// Possible values are: "created", "edited", "deleted".
   897  	Action      *string             `json:"action,omitempty"`
   898  	PullRequest *PullRequest        `json:"pull_request,omitempty"`
   899  	Comment     *PullRequestComment `json:"comment,omitempty"`
   900  
   901  	// The following fields are only populated by Webhook events.
   902  	Changes      *EditChange   `json:"changes,omitempty"`
   903  	Repo         *Repository   `json:"repository,omitempty"`
   904  	Sender       *User         `json:"sender,omitempty"`
   905  	Installation *Installation `json:"installation,omitempty"`
   906  }
   907  
   908  // PullRequestReviewThreadEvent is triggered when a comment made as part of a
   909  // review of a pull request is marked resolved or unresolved.
   910  // The Webhook event name is "pull_request_review_thread".
   911  //
   912  // GitHub API docs: https://docs.github.com/en/developers/webhooks-and-events/webhook-events-and-payloads#pull_request_review_thread
   913  type PullRequestReviewThreadEvent struct {
   914  	// Action is the action that was performed on the comment.
   915  	// Possible values are: "resolved", "unresolved".
   916  	Action      *string            `json:"action,omitempty"`
   917  	Thread      *PullRequestThread `json:"thread,omitempty"`
   918  	PullRequest *PullRequest       `json:"pull_request,omitempty"`
   919  
   920  	// The following fields are only populated by Webhook events.
   921  	Repo         *Repository   `json:"repository,omitempty"`
   922  	Sender       *User         `json:"sender,omitempty"`
   923  	Installation *Installation `json:"installation,omitempty"`
   924  }
   925  
   926  // PullRequestTargetEvent is triggered when a pull request is assigned, unassigned, labeled,
   927  // unlabeled, opened, edited, closed, reopened, synchronize, ready_for_review,
   928  // locked, unlocked, a pull request review is requested, or a review request is removed.
   929  // The Webhook event name is "pull_request_target".
   930  //
   931  // GitHub API docs: https://docs.github.com/en/actions/events-that-trigger-workflows#pull_request_target
   932  type PullRequestTargetEvent struct {
   933  	// Action is the action that was performed. Possible values are:
   934  	// "assigned", "unassigned", "labeled", "unlabeled", "opened", "edited", "closed", "reopened",
   935  	// "ready_for_review", "locked", "unlocked", "review_requested" or "review_request_removed".
   936  	// If the action is "closed" and the "merged" key is "false", the pull request was closed with unmerged commits.
   937  	// If the action is "closed" and the "merged" key is "true", the pull request was merged.
   938  	// While webhooks are also triggered when a pull request is synchronized, Events API timelines
   939  	// don't include pull request events with the "synchronize" action.
   940  	Action      *string      `json:"action,omitempty"`
   941  	Assignee    *User        `json:"assignee,omitempty"`
   942  	Number      *int         `json:"number,omitempty"`
   943  	PullRequest *PullRequest `json:"pull_request,omitempty"`
   944  
   945  	// The following fields are only populated by Webhook events.
   946  	Changes *EditChange `json:"changes,omitempty"`
   947  	// RequestedReviewer is populated in "review_requested", "review_request_removed" event deliveries.
   948  	// A request affecting multiple reviewers at once is split into multiple
   949  	// such event deliveries, each with a single, different RequestedReviewer.
   950  	RequestedReviewer *User `json:"requested_reviewer,omitempty"`
   951  	// In the event that a team is requested instead of a user, "requested_team" gets sent in place of
   952  	// "requested_user" with the same delivery behavior.
   953  	RequestedTeam *Team         `json:"requested_team,omitempty"`
   954  	Repo          *Repository   `json:"repository,omitempty"`
   955  	Sender        *User         `json:"sender,omitempty"`
   956  	Installation  *Installation `json:"installation,omitempty"`
   957  	Label         *Label        `json:"label,omitempty"` // Populated in "labeled" event deliveries.
   958  
   959  	// The following field is only present when the webhook is triggered on
   960  	// a repository belonging to an organization.
   961  	Organization *Organization `json:"organization,omitempty"`
   962  
   963  	// The following fields are only populated when the Action is "synchronize".
   964  	Before *string `json:"before,omitempty"`
   965  	After  *string `json:"after,omitempty"`
   966  }
   967  
   968  // PushEvent represents a git push to a GitHub repository.
   969  //
   970  // GitHub API docs: https://docs.github.com/en/developers/webhooks-and-events/webhook-events-and-payloads#push
   971  type PushEvent struct {
   972  	PushID       *int64        `json:"push_id,omitempty"`
   973  	Head         *string       `json:"head,omitempty"`
   974  	Ref          *string       `json:"ref,omitempty"`
   975  	Size         *int          `json:"size,omitempty"`
   976  	Commits      []*HeadCommit `json:"commits,omitempty"`
   977  	Before       *string       `json:"before,omitempty"`
   978  	DistinctSize *int          `json:"distinct_size,omitempty"`
   979  
   980  	// The following fields are only populated by Webhook events.
   981  	Action       *string              `json:"action,omitempty"`
   982  	After        *string              `json:"after,omitempty"`
   983  	Created      *bool                `json:"created,omitempty"`
   984  	Deleted      *bool                `json:"deleted,omitempty"`
   985  	Forced       *bool                `json:"forced,omitempty"`
   986  	BaseRef      *string              `json:"base_ref,omitempty"`
   987  	Compare      *string              `json:"compare,omitempty"`
   988  	Repo         *PushEventRepository `json:"repository,omitempty"`
   989  	HeadCommit   *HeadCommit          `json:"head_commit,omitempty"`
   990  	Pusher       *User                `json:"pusher,omitempty"`
   991  	Sender       *User                `json:"sender,omitempty"`
   992  	Installation *Installation        `json:"installation,omitempty"`
   993  
   994  	// The following field is only present when the webhook is triggered on
   995  	// a repository belonging to an organization.
   996  	Organization *Organization `json:"organization,omitempty"`
   997  }
   998  
   999  func (p PushEvent) String() string {
  1000  	return Stringify(p)
  1001  }
  1002  
  1003  // HeadCommit represents a git commit in a GitHub PushEvent.
  1004  type HeadCommit struct {
  1005  	Message  *string       `json:"message,omitempty"`
  1006  	Author   *CommitAuthor `json:"author,omitempty"`
  1007  	URL      *string       `json:"url,omitempty"`
  1008  	Distinct *bool         `json:"distinct,omitempty"`
  1009  
  1010  	// The following fields are only populated by Events API.
  1011  	SHA *string `json:"sha,omitempty"`
  1012  
  1013  	// The following fields are only populated by Webhook events.
  1014  	ID        *string       `json:"id,omitempty"`
  1015  	TreeID    *string       `json:"tree_id,omitempty"`
  1016  	Timestamp *Timestamp    `json:"timestamp,omitempty"`
  1017  	Committer *CommitAuthor `json:"committer,omitempty"`
  1018  	Added     []string      `json:"added,omitempty"`
  1019  	Removed   []string      `json:"removed,omitempty"`
  1020  	Modified  []string      `json:"modified,omitempty"`
  1021  }
  1022  
  1023  func (h HeadCommit) String() string {
  1024  	return Stringify(h)
  1025  }
  1026  
  1027  // PushEventRepository represents the repo object in a PushEvent payload.
  1028  type PushEventRepository struct {
  1029  	ID              *int64     `json:"id,omitempty"`
  1030  	NodeID          *string    `json:"node_id,omitempty"`
  1031  	Name            *string    `json:"name,omitempty"`
  1032  	FullName        *string    `json:"full_name,omitempty"`
  1033  	Owner           *User      `json:"owner,omitempty"`
  1034  	Private         *bool      `json:"private,omitempty"`
  1035  	Description     *string    `json:"description,omitempty"`
  1036  	Fork            *bool      `json:"fork,omitempty"`
  1037  	CreatedAt       *Timestamp `json:"created_at,omitempty"`
  1038  	PushedAt        *Timestamp `json:"pushed_at,omitempty"`
  1039  	UpdatedAt       *Timestamp `json:"updated_at,omitempty"`
  1040  	Homepage        *string    `json:"homepage,omitempty"`
  1041  	PullsURL        *string    `json:"pulls_url,omitempty"`
  1042  	Size            *int       `json:"size,omitempty"`
  1043  	StargazersCount *int       `json:"stargazers_count,omitempty"`
  1044  	WatchersCount   *int       `json:"watchers_count,omitempty"`
  1045  	Language        *string    `json:"language,omitempty"`
  1046  	HasIssues       *bool      `json:"has_issues,omitempty"`
  1047  	HasDownloads    *bool      `json:"has_downloads,omitempty"`
  1048  	HasWiki         *bool      `json:"has_wiki,omitempty"`
  1049  	HasPages        *bool      `json:"has_pages,omitempty"`
  1050  	ForksCount      *int       `json:"forks_count,omitempty"`
  1051  	Archived        *bool      `json:"archived,omitempty"`
  1052  	Disabled        *bool      `json:"disabled,omitempty"`
  1053  	OpenIssuesCount *int       `json:"open_issues_count,omitempty"`
  1054  	DefaultBranch   *string    `json:"default_branch,omitempty"`
  1055  	MasterBranch    *string    `json:"master_branch,omitempty"`
  1056  	Organization    *string    `json:"organization,omitempty"`
  1057  	URL             *string    `json:"url,omitempty"`
  1058  	ArchiveURL      *string    `json:"archive_url,omitempty"`
  1059  	HTMLURL         *string    `json:"html_url,omitempty"`
  1060  	StatusesURL     *string    `json:"statuses_url,omitempty"`
  1061  	GitURL          *string    `json:"git_url,omitempty"`
  1062  	SSHURL          *string    `json:"ssh_url,omitempty"`
  1063  	CloneURL        *string    `json:"clone_url,omitempty"`
  1064  	SVNURL          *string    `json:"svn_url,omitempty"`
  1065  }
  1066  
  1067  // PushEventRepoOwner is a basic representation of user/org in a PushEvent payload.
  1068  type PushEventRepoOwner struct {
  1069  	Name  *string `json:"name,omitempty"`
  1070  	Email *string `json:"email,omitempty"`
  1071  }
  1072  
  1073  // ReleaseEvent is triggered when a release is published, unpublished, created,
  1074  // edited, deleted, or prereleased.
  1075  // The Webhook event name is "release".
  1076  //
  1077  // GitHub API docs: https://docs.github.com/en/developers/webhooks-and-events/webhook-events-and-payloads#release
  1078  type ReleaseEvent struct {
  1079  	// Action is the action that was performed. Possible values are: "published", "unpublished",
  1080  	// "created", "edited", "deleted", or "prereleased".
  1081  	Action  *string            `json:"action,omitempty"`
  1082  	Release *RepositoryRelease `json:"release,omitempty"`
  1083  
  1084  	// The following fields are only populated by Webhook events.
  1085  	Repo         *Repository   `json:"repository,omitempty"`
  1086  	Sender       *User         `json:"sender,omitempty"`
  1087  	Installation *Installation `json:"installation,omitempty"`
  1088  }
  1089  
  1090  // RepositoryEvent is triggered when a repository is created, archived, unarchived,
  1091  // renamed, edited, transferred, made public, or made private. Organization hooks are
  1092  // also trigerred when a repository is deleted.
  1093  // The Webhook event name is "repository".
  1094  //
  1095  // Events of this type are not visible in timelines, they are only used to
  1096  // trigger organization webhooks.
  1097  //
  1098  // GitHub API docs: https://docs.github.com/en/developers/webhooks-and-events/webhook-events-and-payloads#repository
  1099  type RepositoryEvent struct {
  1100  	// Action is the action that was performed. Possible values are: "created",
  1101  	// "deleted" (organization hooks only), "archived", "unarchived", "edited", "renamed",
  1102  	// "transferred", "publicized", or "privatized".
  1103  	Action *string     `json:"action,omitempty"`
  1104  	Repo   *Repository `json:"repository,omitempty"`
  1105  
  1106  	// The following fields are only populated by Webhook events.
  1107  	Changes      *EditChange   `json:"changes,omitempty"`
  1108  	Org          *Organization `json:"organization,omitempty"`
  1109  	Sender       *User         `json:"sender,omitempty"`
  1110  	Installation *Installation `json:"installation,omitempty"`
  1111  }
  1112  
  1113  // RepositoryDispatchEvent is triggered when a client sends a POST request to the repository dispatch event endpoint.
  1114  //
  1115  // GitHub API docs: https://docs.github.com/en/developers/webhooks-and-events/webhook-events-and-payloads#repository_dispatch
  1116  type RepositoryDispatchEvent struct {
  1117  	// Action is the event_type that submitted with the repository dispatch payload. Value can be any string.
  1118  	Action        *string         `json:"action,omitempty"`
  1119  	Branch        *string         `json:"branch,omitempty"`
  1120  	ClientPayload json.RawMessage `json:"client_payload,omitempty"`
  1121  	Repo          *Repository     `json:"repository,omitempty"`
  1122  
  1123  	// The following fields are only populated by Webhook events.
  1124  	Org          *Organization `json:"organization,omitempty"`
  1125  	Sender       *User         `json:"sender,omitempty"`
  1126  	Installation *Installation `json:"installation,omitempty"`
  1127  }
  1128  
  1129  // RepositoryImportEvent represents the activity related to a repository being imported to GitHub.
  1130  //
  1131  // GitHub API docs: https://docs.github.com/en/developers/webhooks-and-events/webhooks/webhook-events-and-payloads#repository_import
  1132  type RepositoryImportEvent struct {
  1133  	// Status represents the final state of the import. This can be one of "success", "cancelled", or "failure".
  1134  	Status *string       `json:"status,omitempty"`
  1135  	Repo   *Repository   `json:"repository,omitempty"`
  1136  	Org    *Organization `json:"organization,omitempty"`
  1137  	Sender *User         `json:"sender,omitempty"`
  1138  }
  1139  
  1140  // RepositoryVulnerabilityAlertEvent is triggered when a security alert is created, dismissed, or resolved.
  1141  //
  1142  // GitHub API docs: https://docs.github.com/en/developers/webhooks-and-events/webhook-events-and-payloads#repository_vulnerability_alert
  1143  type RepositoryVulnerabilityAlertEvent struct {
  1144  	// Action is the action that was performed. Possible values are: "create", "dismiss", "resolve".
  1145  	Action *string `json:"action,omitempty"`
  1146  
  1147  	// The security alert of the vulnerable dependency.
  1148  	Alert *RepositoryVulnerabilityAlert `json:"alert,omitempty"`
  1149  
  1150  	// The repository of the vulnerable dependency.
  1151  	Repository *Repository `json:"repository,omitempty"`
  1152  
  1153  	// The following fields are only populated by Webhook events.
  1154  	Installation *Installation `json:"installation,omitempty"`
  1155  
  1156  	// The user that triggered the event.
  1157  	Sender *User `json:"sender,omitempty"`
  1158  }
  1159  
  1160  // RepositoryVulnerabilityAlert represents a repository security alert.
  1161  type RepositoryVulnerabilityAlert struct {
  1162  	ID                       *int64     `json:"id,omitempty"`
  1163  	AffectedRange            *string    `json:"affected_range,omitempty"`
  1164  	AffectedPackageName      *string    `json:"affected_package_name,omitempty"`
  1165  	ExternalReference        *string    `json:"external_reference,omitempty"`
  1166  	ExternalIdentifier       *string    `json:"external_identifier,omitempty"`
  1167  	GitHubSecurityAdvisoryID *string    `json:"ghsa_id,omitempty"`
  1168  	Severity                 *string    `json:"severity,omitempty"`
  1169  	CreatedAt                *Timestamp `json:"created_at,omitempty"`
  1170  	FixedIn                  *string    `json:"fixed_in,omitempty"`
  1171  	Dismisser                *User      `json:"dismisser,omitempty"`
  1172  	DismissReason            *string    `json:"dismiss_reason,omitempty"`
  1173  	DismissedAt              *Timestamp `json:"dismissed_at,omitempty"`
  1174  }
  1175  
  1176  // SecretScanningAlertEvent is triggered when a secret scanning alert occurs in a repository.
  1177  // The Webhook name is secret_scanning_alert.
  1178  //
  1179  // GitHub API docs: https://docs.github.com/en/developers/webhooks-and-events/webhooks/webhook-events-and-payloads#secret_scanning_alert
  1180  type SecretScanningAlertEvent struct {
  1181  	// Action is the action that was performed. Possible values are: "created", "resolved", or "reopened".
  1182  	Action *string `json:"action,omitempty"`
  1183  
  1184  	// Alert is the secret scanning alert involved in the event.
  1185  	Alert *SecretScanningAlert `json:"alert,omitempty"`
  1186  
  1187  	// Only populated by the "resolved" and "reopen" actions
  1188  	Sender *User `json:"sender,omitempty"`
  1189  	// The following fields are only populated by Webhook events.
  1190  	Repo         *Repository   `json:"repository,omitempty"`
  1191  	Organization *Organization `json:"organization,omitempty"`
  1192  	Enterprise   *Enterprise   `json:"enterprise,omitempty"`
  1193  	Installation *Installation `json:"installation,omitempty"`
  1194  }
  1195  
  1196  // StarEvent is triggered when a star is added or removed from a repository.
  1197  // The Webhook event name is "star".
  1198  //
  1199  // GitHub API docs: https://docs.github.com/en/developers/webhooks-and-events/webhook-events-and-payloads#star
  1200  type StarEvent struct {
  1201  	// Action is the action that was performed. Possible values are: "created" or "deleted".
  1202  	Action *string `json:"action,omitempty"`
  1203  
  1204  	// StarredAt is the time the star was created. It will be null for the "deleted" action.
  1205  	StarredAt *Timestamp `json:"starred_at,omitempty"`
  1206  
  1207  	// The following fields are only populated by Webhook events.
  1208  	Org          *Organization `json:"organization,omitempty"`
  1209  	Repo         *Repository   `json:"repository,omitempty"`
  1210  	Sender       *User         `json:"sender,omitempty"`
  1211  	Installation *Installation `json:"installation,omitempty"`
  1212  }
  1213  
  1214  // StatusEvent is triggered when the status of a Git commit changes.
  1215  // The Webhook event name is "status".
  1216  //
  1217  // Events of this type are not visible in timelines, they are only used to
  1218  // trigger hooks.
  1219  //
  1220  // GitHub API docs: https://docs.github.com/en/developers/webhooks-and-events/webhook-events-and-payloads#status
  1221  type StatusEvent struct {
  1222  	SHA *string `json:"sha,omitempty"`
  1223  	// State is the new state. Possible values are: "pending", "success", "failure", "error".
  1224  	State       *string   `json:"state,omitempty"`
  1225  	Description *string   `json:"description,omitempty"`
  1226  	TargetURL   *string   `json:"target_url,omitempty"`
  1227  	Branches    []*Branch `json:"branches,omitempty"`
  1228  
  1229  	// The following fields are only populated by Webhook events.
  1230  	ID           *int64            `json:"id,omitempty"`
  1231  	Name         *string           `json:"name,omitempty"`
  1232  	Context      *string           `json:"context,omitempty"`
  1233  	Commit       *RepositoryCommit `json:"commit,omitempty"`
  1234  	CreatedAt    *Timestamp        `json:"created_at,omitempty"`
  1235  	UpdatedAt    *Timestamp        `json:"updated_at,omitempty"`
  1236  	Repo         *Repository       `json:"repository,omitempty"`
  1237  	Sender       *User             `json:"sender,omitempty"`
  1238  	Installation *Installation     `json:"installation,omitempty"`
  1239  }
  1240  
  1241  // TeamEvent is triggered when an organization's team is created, modified or deleted.
  1242  // The Webhook event name is "team".
  1243  //
  1244  // Events of this type are not visible in timelines. These events are only used
  1245  // to trigger hooks.
  1246  //
  1247  // GitHub API docs: https://docs.github.com/en/developers/webhooks-and-events/webhook-events-and-payloads#team
  1248  type TeamEvent struct {
  1249  	Action  *string     `json:"action,omitempty"`
  1250  	Team    *Team       `json:"team,omitempty"`
  1251  	Changes *TeamChange `json:"changes,omitempty"`
  1252  	Repo    *Repository `json:"repository,omitempty"`
  1253  
  1254  	// The following fields are only populated by Webhook events.
  1255  	Org          *Organization `json:"organization,omitempty"`
  1256  	Sender       *User         `json:"sender,omitempty"`
  1257  	Installation *Installation `json:"installation,omitempty"`
  1258  }
  1259  
  1260  // TeamAddEvent is triggered when a repository is added to a team.
  1261  // The Webhook event name is "team_add".
  1262  //
  1263  // Events of this type are not visible in timelines. These events are only used
  1264  // to trigger hooks.
  1265  //
  1266  // GitHub API docs: https://docs.github.com/en/developers/webhooks-and-events/webhook-events-and-payloads#team_add
  1267  type TeamAddEvent struct {
  1268  	Team *Team       `json:"team,omitempty"`
  1269  	Repo *Repository `json:"repository,omitempty"`
  1270  
  1271  	// The following fields are only populated by Webhook events.
  1272  	Org          *Organization `json:"organization,omitempty"`
  1273  	Sender       *User         `json:"sender,omitempty"`
  1274  	Installation *Installation `json:"installation,omitempty"`
  1275  }
  1276  
  1277  // UserEvent is triggered when a user is created or deleted.
  1278  // The Webhook event name is "user".
  1279  //
  1280  // Only global webhooks can subscribe to this event type.
  1281  //
  1282  // GitHub API docs: https://developer.github.com/enterprise/v3/activity/events/types/#userevent-enterprise
  1283  type UserEvent struct {
  1284  	User *User `json:"user,omitempty"`
  1285  	// The action performed. Possible values are: "created" or "deleted".
  1286  	Action     *string     `json:"action,omitempty"`
  1287  	Enterprise *Enterprise `json:"enterprise,omitempty"`
  1288  	Sender     *User       `json:"sender,omitempty"`
  1289  
  1290  	// The following fields are only populated by Webhook events.
  1291  	Installation *Installation `json:"installation,omitempty"`
  1292  }
  1293  
  1294  // WatchEvent is related to starring a repository, not watching. See this API
  1295  // blog post for an explanation: https://developer.github.com/changes/2012-09-05-watcher-api/
  1296  //
  1297  // The event’s actor is the user who starred a repository, and the event’s
  1298  // repository is the repository that was starred.
  1299  //
  1300  // GitHub API docs: https://docs.github.com/en/developers/webhooks-and-events/webhook-events-and-payloads#watch
  1301  type WatchEvent struct {
  1302  	// Action is the action that was performed. Possible value is: "started".
  1303  	Action *string `json:"action,omitempty"`
  1304  
  1305  	// The following fields are only populated by Webhook events.
  1306  	Repo         *Repository   `json:"repository,omitempty"`
  1307  	Sender       *User         `json:"sender,omitempty"`
  1308  	Installation *Installation `json:"installation,omitempty"`
  1309  }
  1310  
  1311  // WorkflowDispatchEvent is triggered when someone triggers a workflow run on GitHub or
  1312  // sends a POST request to the create a workflow dispatch event endpoint.
  1313  //
  1314  // GitHub API docs: https://docs.github.com/en/developers/webhooks-and-events/webhook-events-and-payloads#workflow_dispatch
  1315  type WorkflowDispatchEvent struct {
  1316  	Inputs   json.RawMessage `json:"inputs,omitempty"`
  1317  	Ref      *string         `json:"ref,omitempty"`
  1318  	Workflow *string         `json:"workflow,omitempty"`
  1319  
  1320  	// The following fields are only populated by Webhook events.
  1321  	Repo         *Repository   `json:"repository,omitempty"`
  1322  	Org          *Organization `json:"organization,omitempty"`
  1323  	Sender       *User         `json:"sender,omitempty"`
  1324  	Installation *Installation `json:"installation,omitempty"`
  1325  }
  1326  
  1327  // WorkflowJobEvent is triggered when a job is queued, started or completed.
  1328  //
  1329  // GitHub API docs: https://docs.github.com/en/developers/webhooks-and-events/webhooks/webhook-events-and-payloads#workflow_job
  1330  type WorkflowJobEvent struct {
  1331  	WorkflowJob *WorkflowJob `json:"workflow_job,omitempty"`
  1332  
  1333  	Action *string `json:"action,omitempty"`
  1334  
  1335  	// The following fields are only populated by Webhook events.
  1336  
  1337  	// Org is not nil when the webhook is configured for an organization or the event
  1338  	// occurs from activity in a repository owned by an organization.
  1339  	Org          *Organization `json:"organization,omitempty"`
  1340  	Repo         *Repository   `json:"repository,omitempty"`
  1341  	Sender       *User         `json:"sender,omitempty"`
  1342  	Installation *Installation `json:"installation,omitempty"`
  1343  }
  1344  
  1345  // WorkflowRunEvent is triggered when a GitHub Actions workflow run is requested or completed.
  1346  //
  1347  // GitHub API docs: https://docs.github.com/en/developers/webhooks-and-events/webhook-events-and-payloads#workflow_run
  1348  type WorkflowRunEvent struct {
  1349  	Action      *string      `json:"action,omitempty"`
  1350  	Workflow    *Workflow    `json:"workflow,omitempty"`
  1351  	WorkflowRun *WorkflowRun `json:"workflow_run,omitempty"`
  1352  
  1353  	// The following fields are only populated by Webhook events.
  1354  	Org          *Organization `json:"organization,omitempty"`
  1355  	Repo         *Repository   `json:"repository,omitempty"`
  1356  	Sender       *User         `json:"sender,omitempty"`
  1357  	Installation *Installation `json:"installation,omitempty"`
  1358  }
  1359  
  1360  // SecurityAdvisory represents the advisory object in SecurityAdvisoryEvent payload.
  1361  //
  1362  // GitHub API docs: https://docs.github.com/en/developers/webhooks-and-events/webhooks/webhook-events-and-payloads#security_advisory
  1363  type SecurityAdvisory struct {
  1364  	GHSAID          *string                  `json:"ghsa_id,omitempty"`
  1365  	Summary         *string                  `json:"summary,omitempty"`
  1366  	Description     *string                  `json:"description,omitempty"`
  1367  	Severity        *string                  `json:"severity,omitempty"`
  1368  	Identifiers     []*AdvisoryIdentifier    `json:"identifiers,omitempty"`
  1369  	References      []*AdvisoryReference     `json:"references,omitempty"`
  1370  	PublishedAt     *Timestamp               `json:"published_at,omitempty"`
  1371  	UpdatedAt       *Timestamp               `json:"updated_at,omitempty"`
  1372  	WithdrawnAt     *Timestamp               `json:"withdrawn_at,omitempty"`
  1373  	Vulnerabilities []*AdvisoryVulnerability `json:"vulnerabilities,omitempty"`
  1374  }
  1375  
  1376  // AdvisoryIdentifier represents the identifier for a Security Advisory.
  1377  type AdvisoryIdentifier struct {
  1378  	Value *string `json:"value,omitempty"`
  1379  	Type  *string `json:"type,omitempty"`
  1380  }
  1381  
  1382  // AdvisoryReference represents the reference url for the security advisory.
  1383  type AdvisoryReference struct {
  1384  	URL *string `json:"url,omitempty"`
  1385  }
  1386  
  1387  // AdvisoryVulnerability represents the vulnerability object for a Security Advisory.
  1388  type AdvisoryVulnerability struct {
  1389  	Package                *VulnerabilityPackage `json:"package,omitempty"`
  1390  	Severity               *string               `json:"severity,omitempty"`
  1391  	VulnerableVersionRange *string               `json:"vulnerable_version_range,omitempty"`
  1392  	FirstPatchedVersion    *FirstPatchedVersion  `json:"first_patched_version,omitempty"`
  1393  }
  1394  
  1395  // VulnerabilityPackage represents the package object for an Advisory Vulnerability.
  1396  type VulnerabilityPackage struct {
  1397  	Ecosystem *string `json:"ecosystem,omitempty"`
  1398  	Name      *string `json:"name,omitempty"`
  1399  }
  1400  
  1401  // FirstPatchedVersion represents the identifier for the first patched version of that vulnerability.
  1402  type FirstPatchedVersion struct {
  1403  	Identifier *string `json:"identifier,omitempty"`
  1404  }
  1405  
  1406  // SecurityAdvisoryEvent is triggered when a security-related vulnerability is found in software on GitHub.
  1407  //
  1408  // GitHub API docs: https://docs.github.com/en/developers/webhooks-and-events/webhooks/webhook-events-and-payloads#security_advisory
  1409  type SecurityAdvisoryEvent struct {
  1410  	Action           *string           `json:"action,omitempty"`
  1411  	SecurityAdvisory *SecurityAdvisory `json:"security_advisory,omitempty"`
  1412  }
  1413  
  1414  // CodeScanningAlertEvent is triggered when a code scanning finds a potential vulnerability or error in your code.
  1415  //
  1416  // GitHub API docs: https://docs.github.com/en/developers/webhooks-and-events/webhooks/webhook-events-and-payloads#code_scanning_alert
  1417  type CodeScanningAlertEvent struct {
  1418  	Action *string `json:"action,omitempty"`
  1419  	Alert  *Alert  `json:"alert,omitempty"`
  1420  	Ref    *string `json:"ref,omitempty"`
  1421  	// CommitOID is the commit SHA of the code scanning alert
  1422  	CommitOID *string       `json:"commit_oid,omitempty"`
  1423  	Repo      *Repository   `json:"repository,omitempty"`
  1424  	Org       *Organization `json:"organization,omitempty"`
  1425  	Sender    *User         `json:"sender,omitempty"`
  1426  
  1427  	Installation *Installation `json:"installation,omitempty"`
  1428  }