...

Source file src/github.com/google/go-github/v55/github/event_types.go

Documentation: github.com/google/go-github/v55/github

     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  // DependabotAlertEvent is triggered when there is activity relating to Dependabot alerts.
   138  // The Webhook event name is "dependabot_alert".
   139  //
   140  // GitHub API docs: https://docs.github.com/en/webhooks-and-events/webhooks/webhook-events-and-payloads#dependabot_alert
   141  type DependabotAlertEvent struct {
   142  	Action *string          `json:"action,omitempty"`
   143  	Alert  *DependabotAlert `json:"alert,omitempty"`
   144  
   145  	// The following fields are only populated by Webhook events.
   146  	Installation *Installation `json:"installation,omitempty"`
   147  	Enterprise   *Enterprise   `json:"enterprise,omitempty"`
   148  	Repo         *Repository   `json:"repository,omitempty"`
   149  	Sender       *User         `json:"sender,omitempty"`
   150  
   151  	// The following field is only present when the webhook is triggered on
   152  	// a repository belonging to an organization.
   153  	Organization *Organization `json:"organization,omitempty"`
   154  }
   155  
   156  // DeployKeyEvent is triggered when a deploy key is added or removed from a repository.
   157  // The Webhook event name is "deploy_key".
   158  //
   159  // GitHub API docs: https://docs.github.com/en/developers/webhooks-and-events/webhook-events-and-payloads#deploy_key
   160  type DeployKeyEvent struct {
   161  	// Action is the action that was performed. Possible values are:
   162  	// "created" or "deleted".
   163  	Action *string `json:"action,omitempty"`
   164  
   165  	// The deploy key resource.
   166  	Key *Key `json:"key,omitempty"`
   167  
   168  	// The Repository where the event occurred
   169  	Repo *Repository `json:"repository,omitempty"`
   170  
   171  	// The following field is only present when the webhook is triggered on
   172  	// a repository belonging to an organization.
   173  	Organization *Organization `json:"organization,omitempty"`
   174  
   175  	// The following fields are only populated by Webhook events.
   176  	Sender       *User         `json:"sender,omitempty"`
   177  	Installation *Installation `json:"installation,omitempty"`
   178  }
   179  
   180  // DeploymentEvent represents a deployment.
   181  // The Webhook event name is "deployment".
   182  //
   183  // Events of this type are not visible in timelines, they are only used to trigger hooks.
   184  //
   185  // GitHub API docs: https://docs.github.com/en/developers/webhooks-and-events/webhook-events-and-payloads#deployment
   186  type DeploymentEvent struct {
   187  	Deployment  *Deployment  `json:"deployment,omitempty"`
   188  	Repo        *Repository  `json:"repository,omitempty"`
   189  	Workflow    *Workflow    `json:"workflow,omitempty"`
   190  	WorkflowRun *WorkflowRun `json:"workflow_run,omitempty"`
   191  
   192  	// The following fields are only populated by Webhook events.
   193  	Sender       *User         `json:"sender,omitempty"`
   194  	Installation *Installation `json:"installation,omitempty"`
   195  }
   196  
   197  // DeploymentProtectionRuleEvent represents a deployment protection rule event.
   198  // The Webhook event name is "deployment_protection_rule".
   199  //
   200  // GitHub API docs: https://docs.github.com/webhooks-and-events/webhooks/webhook-events-and-payloads#deployment_protection_rule
   201  type DeploymentProtectionRuleEvent struct {
   202  	Action      *string `json:"action,omitempty"`
   203  	Environment *string `json:"environment,omitempty"`
   204  	Event       *string `json:"event,omitempty"`
   205  
   206  	// The URL Github provides for a third-party to use in order to pass/fail a deployment gate
   207  	DeploymentCallbackURL *string        `json:"deployment_callback_url,omitempty"`
   208  	Deployment            *Deployment    `json:"deployment,omitempty"`
   209  	Repo                  *Repository    `json:"repository,omitempty"`
   210  	Organization          *Organization  `json:"organization,omitempty"`
   211  	PullRequests          []*PullRequest `json:"pull_requests,omitempty"`
   212  	Sender                *User          `json:"sender,omitempty"`
   213  	Installation          *Installation  `json:"installation,omitempty"`
   214  }
   215  
   216  // DeploymentStatusEvent represents a deployment status.
   217  // The Webhook event name is "deployment_status".
   218  //
   219  // Events of this type are not visible in timelines, they are only used to trigger hooks.
   220  //
   221  // GitHub API docs: https://docs.github.com/en/developers/webhooks-and-events/webhook-events-and-payloads#deployment_status
   222  type DeploymentStatusEvent struct {
   223  	Deployment       *Deployment       `json:"deployment,omitempty"`
   224  	DeploymentStatus *DeploymentStatus `json:"deployment_status,omitempty"`
   225  	Repo             *Repository       `json:"repository,omitempty"`
   226  
   227  	// The following fields are only populated by Webhook events.
   228  	Sender       *User         `json:"sender,omitempty"`
   229  	Installation *Installation `json:"installation,omitempty"`
   230  }
   231  
   232  // DiscussionCommentEvent represents a webhook event for a comment on discussion.
   233  // The Webhook event name is "discussion_comment".
   234  //
   235  // GitHub API docs: https://docs.github.com/webhooks-and-events/webhooks/webhook-events-and-payloads#discussion_comment
   236  type DiscussionCommentEvent struct {
   237  	// Action is the action that was performed on the comment.
   238  	// Possible values are: "created", "edited", "deleted". ** check what all can be added
   239  	Action       *string            `json:"action,omitempty"`
   240  	Discussion   *Discussion        `json:"discussion,omitempty"`
   241  	Comment      *CommentDiscussion `json:"comment,omitempty"`
   242  	Repo         *Repository        `json:"repository,omitempty"`
   243  	Org          *Organization      `json:"organization,omitempty"`
   244  	Sender       *User              `json:"sender,omitempty"`
   245  	Installation *Installation      `json:"installation,omitempty"`
   246  }
   247  
   248  // CommentDiscussion represents a comment in a GitHub DiscussionCommentEvent.
   249  type CommentDiscussion struct {
   250  	AuthorAssociation *string    `json:"author_association,omitempty"`
   251  	Body              *string    `json:"body,omitempty"`
   252  	ChildCommentCount *int       `json:"child_comment_count,omitempty"`
   253  	CreatedAt         *Timestamp `json:"created_at,omitempty"`
   254  	DiscussionID      *int64     `json:"discussion_id,omitempty"`
   255  	HTMLURL           *string    `json:"html_url,omitempty"`
   256  	ID                *int64     `json:"id,omitempty"`
   257  	NodeID            *string    `json:"node_id,omitempty"`
   258  	ParentID          *int64     `json:"parent_id,omitempty"`
   259  	Reactions         *Reactions `json:"reactions,omitempty"`
   260  	RepositoryURL     *string    `json:"repository_url,omitempty"`
   261  	UpdatedAt         *Timestamp `json:"updated_at,omitempty"`
   262  	User              *User      `json:"user,omitempty"`
   263  }
   264  
   265  // DiscussionEvent represents a webhook event for a discussion.
   266  // The Webhook event name is "discussion".
   267  //
   268  // GitHub API docs: https://docs.github.com/en/developers/webhooks-and-events/webhooks/webhook-events-and-payloads#discussion
   269  type DiscussionEvent struct {
   270  	// Action is the action that was performed. Possible values are:
   271  	// created, edited, deleted, pinned, unpinned, locked, unlocked,
   272  	// transferred, category_changed, answered, or unanswered.
   273  	Action       *string       `json:"action,omitempty"`
   274  	Discussion   *Discussion   `json:"discussion,omitempty"`
   275  	Repo         *Repository   `json:"repository,omitempty"`
   276  	Org          *Organization `json:"organization,omitempty"`
   277  	Sender       *User         `json:"sender,omitempty"`
   278  	Installation *Installation `json:"installation,omitempty"`
   279  }
   280  
   281  // Discussion represents a discussion in a GitHub DiscussionEvent.
   282  type Discussion struct {
   283  	RepositoryURL      *string             `json:"repository_url,omitempty"`
   284  	DiscussionCategory *DiscussionCategory `json:"category,omitempty"`
   285  	AnswerHTMLURL      *string             `json:"answer_html_url,omitempty"`
   286  	AnswerChosenAt     *Timestamp          `json:"answer_chosen_at,omitempty"`
   287  	AnswerChosenBy     *string             `json:"answer_chosen_by,omitempty"`
   288  	HTMLURL            *string             `json:"html_url,omitempty"`
   289  	ID                 *int64              `json:"id,omitempty"`
   290  	NodeID             *string             `json:"node_id,omitempty"`
   291  	Number             *int                `json:"number,omitempty"`
   292  	Title              *string             `json:"title,omitempty"`
   293  	User               *User               `json:"user,omitempty"`
   294  	State              *string             `json:"state,omitempty"`
   295  	Locked             *bool               `json:"locked,omitempty"`
   296  	Comments           *int                `json:"comments,omitempty"`
   297  	CreatedAt          *Timestamp          `json:"created_at,omitempty"`
   298  	UpdatedAt          *Timestamp          `json:"updated_at,omitempty"`
   299  	AuthorAssociation  *string             `json:"author_association,omitempty"`
   300  	ActiveLockReason   *string             `json:"active_lock_reason,omitempty"`
   301  	Body               *string             `json:"body,omitempty"`
   302  }
   303  
   304  // DiscussionCategory represents a discussion category in a GitHub DiscussionEvent.
   305  type DiscussionCategory struct {
   306  	ID           *int64     `json:"id,omitempty"`
   307  	NodeID       *string    `json:"node_id,omitempty"`
   308  	RepositoryID *int64     `json:"repository_id,omitempty"`
   309  	Emoji        *string    `json:"emoji,omitempty"`
   310  	Name         *string    `json:"name,omitempty"`
   311  	Description  *string    `json:"description,omitempty"`
   312  	CreatedAt    *Timestamp `json:"created_at,omitempty"`
   313  	UpdatedAt    *Timestamp `json:"updated_at,omitempty"`
   314  	Slug         *string    `json:"slug,omitempty"`
   315  	IsAnswerable *bool      `json:"is_answerable,omitempty"`
   316  }
   317  
   318  // ForkEvent is triggered when a user forks a repository.
   319  // The Webhook event name is "fork".
   320  //
   321  // GitHub API docs: https://docs.github.com/en/developers/webhooks-and-events/webhook-events-and-payloads#fork
   322  type ForkEvent struct {
   323  	// Forkee is the created repository.
   324  	Forkee *Repository `json:"forkee,omitempty"`
   325  
   326  	// The following fields are only populated by Webhook events.
   327  	Repo         *Repository   `json:"repository,omitempty"`
   328  	Sender       *User         `json:"sender,omitempty"`
   329  	Installation *Installation `json:"installation,omitempty"`
   330  }
   331  
   332  // GitHubAppAuthorizationEvent is triggered when a user's authorization for a
   333  // GitHub Application is revoked.
   334  //
   335  // GitHub API docs: https://docs.github.com/en/developers/webhooks-and-events/webhook-events-and-payloads#github_app_authorization
   336  type GitHubAppAuthorizationEvent struct {
   337  	// The action performed. Possible value is: "revoked".
   338  	Action *string `json:"action,omitempty"`
   339  
   340  	// The following fields are only populated by Webhook events.
   341  	Sender       *User         `json:"sender,omitempty"`
   342  	Installation *Installation `json:"installation,omitempty"`
   343  }
   344  
   345  // Page represents a single Wiki page.
   346  type Page struct {
   347  	PageName *string `json:"page_name,omitempty"`
   348  	Title    *string `json:"title,omitempty"`
   349  	Summary  *string `json:"summary,omitempty"`
   350  	Action   *string `json:"action,omitempty"`
   351  	SHA      *string `json:"sha,omitempty"`
   352  	HTMLURL  *string `json:"html_url,omitempty"`
   353  }
   354  
   355  // GollumEvent is triggered when a Wiki page is created or updated.
   356  // The Webhook event name is "gollum".
   357  //
   358  // GitHub API docs: https://docs.github.com/en/developers/webhooks-and-events/webhook-events-and-payloads#gollum
   359  type GollumEvent struct {
   360  	Pages []*Page `json:"pages,omitempty"`
   361  
   362  	// The following fields are only populated by Webhook events.
   363  	Repo         *Repository   `json:"repository,omitempty"`
   364  	Sender       *User         `json:"sender,omitempty"`
   365  	Installation *Installation `json:"installation,omitempty"`
   366  }
   367  
   368  // EditChange represents the changes when an issue, pull request, comment,
   369  // or repository has been edited.
   370  type EditChange struct {
   371  	Title *EditTitle `json:"title,omitempty"`
   372  	Body  *EditBody  `json:"body,omitempty"`
   373  	Base  *EditBase  `json:"base,omitempty"`
   374  	Repo  *EditRepo  `json:"repository,omitempty"`
   375  	Owner *EditOwner `json:"owner,omitempty"`
   376  }
   377  
   378  // EditTitle represents a pull-request title change.
   379  type EditTitle struct {
   380  	From *string `json:"from,omitempty"`
   381  }
   382  
   383  // EditBody represents a change of pull-request body.
   384  type EditBody struct {
   385  	From *string `json:"from,omitempty"`
   386  }
   387  
   388  // EditBase represents the change of a pull-request base branch.
   389  type EditBase struct {
   390  	Ref *EditRef `json:"ref,omitempty"`
   391  	SHA *EditSHA `json:"sha,omitempty"`
   392  }
   393  
   394  // EditRef represents a ref change of a pull-request.
   395  type EditRef struct {
   396  	From *string `json:"from,omitempty"`
   397  }
   398  
   399  // EditRepo represents a change of repository name.
   400  type EditRepo struct {
   401  	Name *RepoName `json:"name,omitempty"`
   402  }
   403  
   404  // EditOwner represents a change of repository ownership.
   405  type EditOwner struct {
   406  	OwnerInfo *OwnerInfo `json:"from,omitempty"`
   407  }
   408  
   409  // OwnerInfo represents the account info of the owner of the repo (could be User or Organization but both are User structs).
   410  type OwnerInfo struct {
   411  	User *User `json:"user,omitempty"`
   412  	Org  *User `json:"organization,omitempty"`
   413  }
   414  
   415  // RepoName represents a change of repository name.
   416  type RepoName struct {
   417  	From *string `json:"from,omitempty"`
   418  }
   419  
   420  // EditSHA represents a sha change of a pull-request.
   421  type EditSHA struct {
   422  	From *string `json:"from,omitempty"`
   423  }
   424  
   425  // ProjectChange represents the changes when a project has been edited.
   426  type ProjectChange struct {
   427  	Name *ProjectName `json:"name,omitempty"`
   428  	Body *ProjectBody `json:"body,omitempty"`
   429  }
   430  
   431  // ProjectName represents a project name change.
   432  type ProjectName struct {
   433  	From *string `json:"from,omitempty"`
   434  }
   435  
   436  // ProjectBody represents a project body change.
   437  type ProjectBody struct {
   438  	From *string `json:"from,omitempty"`
   439  }
   440  
   441  // ProjectCardChange represents the changes when a project card has been edited.
   442  type ProjectCardChange struct {
   443  	Note *ProjectCardNote `json:"note,omitempty"`
   444  }
   445  
   446  // ProjectCardNote represents a change of a note of a project card.
   447  type ProjectCardNote struct {
   448  	From *string `json:"from,omitempty"`
   449  }
   450  
   451  // ProjectColumnChange represents the changes when a project column has been edited.
   452  type ProjectColumnChange struct {
   453  	Name *ProjectColumnName `json:"name,omitempty"`
   454  }
   455  
   456  // ProjectColumnName represents a project column name change.
   457  type ProjectColumnName struct {
   458  	From *string `json:"from,omitempty"`
   459  }
   460  
   461  // TeamChange represents the changes when a team has been edited.
   462  type TeamChange struct {
   463  	Description *TeamDescription `json:"description,omitempty"`
   464  	Name        *TeamName        `json:"name,omitempty"`
   465  	Privacy     *TeamPrivacy     `json:"privacy,omitempty"`
   466  	Repository  *TeamRepository  `json:"repository,omitempty"`
   467  }
   468  
   469  // TeamDescription represents a team description change.
   470  type TeamDescription struct {
   471  	From *string `json:"from,omitempty"`
   472  }
   473  
   474  // TeamName represents a team name change.
   475  type TeamName struct {
   476  	From *string `json:"from,omitempty"`
   477  }
   478  
   479  // TeamPrivacy represents a team privacy change.
   480  type TeamPrivacy struct {
   481  	From *string `json:"from,omitempty"`
   482  }
   483  
   484  // TeamRepository represents a team repository permission change.
   485  type TeamRepository struct {
   486  	Permissions *TeamPermissions `json:"permissions,omitempty"`
   487  }
   488  
   489  // TeamPermissions represents a team permission change.
   490  type TeamPermissions struct {
   491  	From *TeamPermissionsFrom `json:"from,omitempty"`
   492  }
   493  
   494  // TeamPermissionsFrom represents a team permission change.
   495  type TeamPermissionsFrom struct {
   496  	Admin *bool `json:"admin,omitempty"`
   497  	Pull  *bool `json:"pull,omitempty"`
   498  	Push  *bool `json:"push,omitempty"`
   499  }
   500  
   501  // InstallationEvent is triggered when a GitHub App has been installed, uninstalled, suspend, unsuspended
   502  // or new permissions have been accepted.
   503  // The Webhook event name is "installation".
   504  //
   505  // GitHub API docs: https://docs.github.com/en/developers/webhooks-and-events/webhook-events-and-payloads#installation
   506  type InstallationEvent struct {
   507  	// The action that was performed. Can be either "created", "deleted", "suspend", "unsuspend" or "new_permissions_accepted".
   508  	Action       *string       `json:"action,omitempty"`
   509  	Repositories []*Repository `json:"repositories,omitempty"`
   510  	Sender       *User         `json:"sender,omitempty"`
   511  	Installation *Installation `json:"installation,omitempty"`
   512  	Requester    *User         `json:"requester,omitempty"`
   513  }
   514  
   515  // InstallationRepositoriesEvent is triggered when a repository is added or
   516  // removed from an installation. The Webhook event name is "installation_repositories".
   517  //
   518  // GitHub API docs: https://docs.github.com/en/developers/webhooks-and-events/webhook-events-and-payloads#installation_repositories
   519  type InstallationRepositoriesEvent struct {
   520  	// The action that was performed. Can be either "added" or "removed".
   521  	Action              *string       `json:"action,omitempty"`
   522  	RepositoriesAdded   []*Repository `json:"repositories_added,omitempty"`
   523  	RepositoriesRemoved []*Repository `json:"repositories_removed,omitempty"`
   524  	RepositorySelection *string       `json:"repository_selection,omitempty"`
   525  	Sender              *User         `json:"sender,omitempty"`
   526  	Installation        *Installation `json:"installation,omitempty"`
   527  }
   528  
   529  // InstallationLoginChange represents a change in login on an installation.
   530  type InstallationLoginChange struct {
   531  	From *string `json:"from,omitempty"`
   532  }
   533  
   534  // InstallationSlugChange represents a change in slug on an installation.
   535  type InstallationSlugChange struct {
   536  	From *string `json:"from,omitempty"`
   537  }
   538  
   539  // InstallationChanges represents a change in slug or login on an installation.
   540  type InstallationChanges struct {
   541  	Login *InstallationLoginChange `json:"login,omitempty"`
   542  	Slug  *InstallationSlugChange  `json:"slug,omitempty"`
   543  }
   544  
   545  // InstallationTargetEvent is triggered when there is activity on an installation from a user or organization account.
   546  // The Webhook event name is "installation_target".
   547  //
   548  // GitHub API docs: https://docs.github.com/en/webhooks-and-events/webhooks/webhook-events-and-payloads#installation_target
   549  type InstallationTargetEvent struct {
   550  	Account      *User                `json:"account,omitempty"`
   551  	Action       *string              `json:"action,omitempty"`
   552  	Changes      *InstallationChanges `json:"changes,omitempty"`
   553  	Enterprise   *Enterprise          `json:"enterprise,omitempty"`
   554  	Installation *Installation        `json:"installation,omitempty"`
   555  	Organization *Organization        `json:"organization,omitempty"`
   556  	Repository   *Repository          `json:"repository,omitempty"`
   557  	Sender       *User                `json:"sender,omitempty"`
   558  	TargetType   *string              `json:"target_type,omitempty"`
   559  }
   560  
   561  // IssueCommentEvent is triggered when an issue comment is created on an issue
   562  // or pull request.
   563  // The Webhook event name is "issue_comment".
   564  //
   565  // GitHub API docs: https://docs.github.com/en/developers/webhooks-and-events/webhook-events-and-payloads#issue_comment
   566  type IssueCommentEvent struct {
   567  	// Action is the action that was performed on the comment.
   568  	// Possible values are: "created", "edited", "deleted".
   569  	Action  *string       `json:"action,omitempty"`
   570  	Issue   *Issue        `json:"issue,omitempty"`
   571  	Comment *IssueComment `json:"comment,omitempty"`
   572  
   573  	// The following fields are only populated by Webhook events.
   574  	Changes      *EditChange   `json:"changes,omitempty"`
   575  	Repo         *Repository   `json:"repository,omitempty"`
   576  	Sender       *User         `json:"sender,omitempty"`
   577  	Installation *Installation `json:"installation,omitempty"`
   578  
   579  	// The following field is only present when the webhook is triggered on
   580  	// a repository belonging to an organization.
   581  	Organization *Organization `json:"organization,omitempty"`
   582  }
   583  
   584  // IssuesEvent is triggered when an issue is opened, edited, deleted, transferred,
   585  // pinned, unpinned, closed, reopened, assigned, unassigned, labeled, unlabeled,
   586  // locked, unlocked, milestoned, or demilestoned.
   587  // The Webhook event name is "issues".
   588  //
   589  // GitHub API docs: https://docs.github.com/en/developers/webhooks-and-events/webhook-events-and-payloads#issues
   590  type IssuesEvent struct {
   591  	// Action is the action that was performed. Possible values are: "opened",
   592  	// "edited", "deleted", "transferred", "pinned", "unpinned", "closed", "reopened",
   593  	// "assigned", "unassigned", "labeled", "unlabeled", "locked", "unlocked",
   594  	// "milestoned", or "demilestoned".
   595  	Action   *string `json:"action,omitempty"`
   596  	Issue    *Issue  `json:"issue,omitempty"`
   597  	Assignee *User   `json:"assignee,omitempty"`
   598  	Label    *Label  `json:"label,omitempty"`
   599  
   600  	// The following fields are only populated by Webhook events.
   601  	Changes      *EditChange   `json:"changes,omitempty"`
   602  	Repo         *Repository   `json:"repository,omitempty"`
   603  	Sender       *User         `json:"sender,omitempty"`
   604  	Installation *Installation `json:"installation,omitempty"`
   605  	Milestone    *Milestone    `json:"milestone,omitempty"`
   606  }
   607  
   608  // LabelEvent is triggered when a repository's label is created, edited, or deleted.
   609  // The Webhook event name is "label"
   610  //
   611  // GitHub API docs: https://docs.github.com/en/developers/webhooks-and-events/webhook-events-and-payloads#label
   612  type LabelEvent struct {
   613  	// Action is the action that was performed. Possible values are:
   614  	// "created", "edited", "deleted"
   615  	Action  *string     `json:"action,omitempty"`
   616  	Label   *Label      `json:"label,omitempty"`
   617  	Changes *EditChange `json:"changes,omitempty"`
   618  
   619  	// The following fields are only populated by Webhook events.
   620  	Repo         *Repository   `json:"repository,omitempty"`
   621  	Org          *Organization `json:"organization,omitempty"`
   622  	Sender       *User         `json:"sender,omitempty"`
   623  	Installation *Installation `json:"installation,omitempty"`
   624  }
   625  
   626  // MarketplacePurchaseEvent is triggered when a user purchases, cancels, or changes
   627  // their GitHub Marketplace plan.
   628  // Webhook event name "marketplace_purchase".
   629  //
   630  // GitHub API docs: https://docs.github.com/en/developers/webhooks-and-events/webhook-events-and-payloads#marketplace_purchase
   631  type MarketplacePurchaseEvent struct {
   632  	// Action is the action that was performed. Possible values are:
   633  	// "purchased", "cancelled", "pending_change", "pending_change_cancelled", "changed".
   634  	Action *string `json:"action,omitempty"`
   635  
   636  	// The following fields are only populated by Webhook events.
   637  	EffectiveDate               *Timestamp           `json:"effective_date,omitempty"`
   638  	MarketplacePurchase         *MarketplacePurchase `json:"marketplace_purchase,omitempty"`
   639  	PreviousMarketplacePurchase *MarketplacePurchase `json:"previous_marketplace_purchase,omitempty"`
   640  	Sender                      *User                `json:"sender,omitempty"`
   641  	Installation                *Installation        `json:"installation,omitempty"`
   642  }
   643  
   644  // MemberEvent is triggered when a user is added as a collaborator to a repository.
   645  // The Webhook event name is "member".
   646  //
   647  // GitHub API docs: https://docs.github.com/en/developers/webhooks-and-events/webhook-events-and-payloads#member
   648  type MemberEvent struct {
   649  	// Action is the action that was performed. Possible value is: "added".
   650  	Action *string `json:"action,omitempty"`
   651  	Member *User   `json:"member,omitempty"`
   652  
   653  	// The following fields are only populated by Webhook events.
   654  	Repo         *Repository   `json:"repository,omitempty"`
   655  	Sender       *User         `json:"sender,omitempty"`
   656  	Installation *Installation `json:"installation,omitempty"`
   657  }
   658  
   659  // MembershipEvent is triggered when a user is added or removed from a team.
   660  // The Webhook event name is "membership".
   661  //
   662  // Events of this type are not visible in timelines, they are only used to
   663  // trigger organization webhooks.
   664  //
   665  // GitHub API docs: https://docs.github.com/en/developers/webhooks-and-events/webhook-events-and-payloads#membership
   666  type MembershipEvent struct {
   667  	// Action is the action that was performed. Possible values are: "added", "removed".
   668  	Action *string `json:"action,omitempty"`
   669  	// Scope is the scope of the membership. Possible value is: "team".
   670  	Scope  *string `json:"scope,omitempty"`
   671  	Member *User   `json:"member,omitempty"`
   672  	Team   *Team   `json:"team,omitempty"`
   673  
   674  	// The following fields are only populated by Webhook events.
   675  	Org          *Organization `json:"organization,omitempty"`
   676  	Sender       *User         `json:"sender,omitempty"`
   677  	Installation *Installation `json:"installation,omitempty"`
   678  }
   679  
   680  // MergeGroup represents the merge group in a merge queue.
   681  type MergeGroup struct {
   682  	// The SHA of the merge group.
   683  	HeadSHA *string `json:"head_sha,omitempty"`
   684  	// The full ref of the merge group.
   685  	HeadRef *string `json:"head_ref,omitempty"`
   686  	// The SHA of the merge group's parent commit.
   687  	BaseSHA *string `json:"base_sha,omitempty"`
   688  	// The full ref of the branch the merge group will be merged into.
   689  	BaseRef *string `json:"base_ref,omitempty"`
   690  	// An expanded representation of the head_sha commit.
   691  	HeadCommit *Commit `json:"head_commit,omitempty"`
   692  }
   693  
   694  // MergeGroupEvent represents activity related to merge groups in a merge queue. The type of activity is specified
   695  // in the action property of the payload object.
   696  //
   697  // GitHub API docs: https://docs.github.com/en/developers/webhooks-and-events/webhook-events-and-payloads#merge_group
   698  type MergeGroupEvent struct {
   699  	// The action that was performed. Currently, can only be checks_requested.
   700  	Action *string `json:"action,omitempty"`
   701  	// The merge group.
   702  	MergeGroup *MergeGroup `json:"merge_group,omitempty"`
   703  
   704  	// The following fields are only populated by Webhook events.
   705  	Repo         *Repository   `json:"repository,omitempty"`
   706  	Org          *Organization `json:"organization,omitempty"`
   707  	Installation *Installation `json:"installation,omitempty"`
   708  	Sender       *User         `json:"sender,omitempty"`
   709  }
   710  
   711  // MetaEvent is triggered when the webhook that this event is configured on is deleted.
   712  // This event will only listen for changes to the particular hook the event is installed on.
   713  // Therefore, it must be selected for each hook that you'd like to receive meta events for.
   714  // The Webhook event name is "meta".
   715  //
   716  // GitHub API docs: https://docs.github.com/en/developers/webhooks-and-events/webhook-events-and-payloads#meta
   717  type MetaEvent struct {
   718  	// Action is the action that was performed. Possible value is: "deleted".
   719  	Action *string `json:"action,omitempty"`
   720  	// The ID of the modified webhook.
   721  	HookID *int64 `json:"hook_id,omitempty"`
   722  	// The modified webhook.
   723  	// This will contain different keys based on the type of webhook it is: repository,
   724  	// organization, business, app, or GitHub Marketplace.
   725  	Hook *Hook `json:"hook,omitempty"`
   726  
   727  	// The following fields are only populated by Webhook events.
   728  	Repo         *Repository   `json:"repository,omitempty"`
   729  	Org          *Organization `json:"organization,omitempty"`
   730  	Sender       *User         `json:"sender,omitempty"`
   731  	Installation *Installation `json:"installation,omitempty"`
   732  }
   733  
   734  // MilestoneEvent is triggered when a milestone is created, closed, opened, edited, or deleted.
   735  // The Webhook event name is "milestone".
   736  //
   737  // GitHub API docs: https://docs.github.com/en/developers/webhooks-and-events/webhook-events-and-payloads#milestone
   738  type MilestoneEvent struct {
   739  	// Action is the action that was performed. Possible values are:
   740  	// "created", "closed", "opened", "edited", "deleted"
   741  	Action    *string    `json:"action,omitempty"`
   742  	Milestone *Milestone `json:"milestone,omitempty"`
   743  
   744  	// The following fields are only populated by Webhook events.
   745  	Changes      *EditChange   `json:"changes,omitempty"`
   746  	Repo         *Repository   `json:"repository,omitempty"`
   747  	Sender       *User         `json:"sender,omitempty"`
   748  	Org          *Organization `json:"organization,omitempty"`
   749  	Installation *Installation `json:"installation,omitempty"`
   750  }
   751  
   752  // OrganizationEvent is triggered when an organization is deleted and renamed, and when a user is added,
   753  // removed, or invited to an organization.
   754  // Events of this type are not visible in timelines. These events are only used to trigger organization hooks.
   755  // Webhook event name is "organization".
   756  //
   757  // GitHub API docs: https://docs.github.com/en/developers/webhooks-and-events/webhook-events-and-payloads#organization
   758  type OrganizationEvent struct {
   759  	// Action is the action that was performed.
   760  	// Possible values are: "deleted", "renamed", "member_added", "member_removed", or "member_invited".
   761  	Action *string `json:"action,omitempty"`
   762  
   763  	// Invitation is the invitation for the user or email if the action is "member_invited".
   764  	Invitation *Invitation `json:"invitation,omitempty"`
   765  
   766  	// Membership is the membership between the user and the organization.
   767  	// Not present when the action is "member_invited".
   768  	Membership *Membership `json:"membership,omitempty"`
   769  
   770  	Organization *Organization `json:"organization,omitempty"`
   771  	Sender       *User         `json:"sender,omitempty"`
   772  	Installation *Installation `json:"installation,omitempty"`
   773  }
   774  
   775  // OrgBlockEvent is triggered when an organization blocks or unblocks a user.
   776  // The Webhook event name is "org_block".
   777  //
   778  // GitHub API docs: https://docs.github.com/en/developers/webhooks-and-events/webhook-events-and-payloads#org_block
   779  type OrgBlockEvent struct {
   780  	// Action is the action that was performed.
   781  	// Can be "blocked" or "unblocked".
   782  	Action       *string       `json:"action,omitempty"`
   783  	BlockedUser  *User         `json:"blocked_user,omitempty"`
   784  	Organization *Organization `json:"organization,omitempty"`
   785  	Sender       *User         `json:"sender,omitempty"`
   786  
   787  	// The following fields are only populated by Webhook events.
   788  	Installation *Installation `json:"installation,omitempty"`
   789  }
   790  
   791  // PackageEvent represents activity related to GitHub Packages.
   792  // The Webhook event name is "package".
   793  //
   794  // This event is triggered when a GitHub Package is published or updated.
   795  //
   796  // GitHub API docs: https://developer.github.com/webhooks/event-payloads/#package
   797  type PackageEvent struct {
   798  	// Action is the action that was performed.
   799  	// Can be "published" or "updated".
   800  	Action  *string       `json:"action,omitempty"`
   801  	Package *Package      `json:"package,omitempty"`
   802  	Repo    *Repository   `json:"repository,omitempty"`
   803  	Org     *Organization `json:"organization,omitempty"`
   804  	Sender  *User         `json:"sender,omitempty"`
   805  
   806  	// The following fields are only populated by Webhook events.
   807  	Installation *Installation `json:"installation,omitempty"`
   808  }
   809  
   810  // PageBuildEvent represents an attempted build of a GitHub Pages site, whether
   811  // successful or not.
   812  // The Webhook event name is "page_build".
   813  //
   814  // This event is triggered on push to a GitHub Pages enabled branch (gh-pages
   815  // for project pages, master for user and organization pages).
   816  //
   817  // Events of this type are not visible in timelines, they are only used to trigger hooks.
   818  //
   819  // GitHub API docs: https://docs.github.com/en/developers/webhooks-and-events/webhook-events-and-payloads#page_build
   820  type PageBuildEvent struct {
   821  	Build *PagesBuild `json:"build,omitempty"`
   822  
   823  	// The following fields are only populated by Webhook events.
   824  	ID           *int64        `json:"id,omitempty"`
   825  	Repo         *Repository   `json:"repository,omitempty"`
   826  	Sender       *User         `json:"sender,omitempty"`
   827  	Installation *Installation `json:"installation,omitempty"`
   828  }
   829  
   830  // PersonalAccessTokenRequestEvent occurs when there is activity relating to a
   831  // request for a fine-grained personal access token to access resources that
   832  // belong to a resource owner that requires approval for token access.
   833  // The webhook event name is "personal_access_token_request".
   834  //
   835  // GitHub API docs: https://docs.github.com/en/webhooks-and-events/webhooks/webhook-events-and-payloads#personal_access_token_request
   836  type PersonalAccessTokenRequestEvent struct {
   837  	// Action is the action that was performed. Possible values are:
   838  	// "approved", "cancelled", "created" or "denied"
   839  	Action                     *string                     `json:"action,omitempty"`
   840  	PersonalAccessTokenRequest *PersonalAccessTokenRequest `json:"personal_access_token_request,omitempty"`
   841  	Org                        *Organization               `json:"organization,omitempty"`
   842  	Sender                     *User                       `json:"sender,omitempty"`
   843  	Installation               *Installation               `json:"installation,omitempty"`
   844  }
   845  
   846  // PersonalAccessTokenRequest contains the details of a PersonalAccessTokenRequestEvent.
   847  type PersonalAccessTokenRequest struct {
   848  	// Unique identifier of the request for access via fine-grained personal
   849  	// access token. Used as the pat_request_id parameter in the list and review
   850  	// API calls.
   851  	ID    *int64 `json:"id,omitempty"`
   852  	Owner *User  `json:"owner,omitempty"`
   853  
   854  	// New requested permissions, categorized by type of permission.
   855  	PermissionsAdded *PersonalAccessTokenPermissions `json:"permissions_added,omitempty"`
   856  
   857  	// Requested permissions that elevate access for a previously approved
   858  	// request for access, categorized by type of permission.
   859  	PermissionsUpgraded *PersonalAccessTokenPermissions `json:"permissions_upgraded,omitempty"`
   860  
   861  	// Permissions requested, categorized by type of permission.
   862  	// This field incorporates permissions_added and permissions_upgraded.
   863  	PermissionsResult *PersonalAccessTokenPermissions `json:"permissions_result,omitempty"`
   864  
   865  	// Type of repository selection requested. Possible values are:
   866  	// "none", "all" or "subset"
   867  	RepositorySelection *string `json:"repository_selection,omitempty"`
   868  
   869  	// The number of repositories the token is requesting access to.
   870  	// This field is only populated when repository_selection is subset.
   871  	RepositoryCount *int64 `json:"repository_count,omitempty"`
   872  
   873  	// An array of repository objects the token is requesting access to.
   874  	// This field is only populated when repository_selection is subset.
   875  	Repositories []*Repository `json:"repositories,omitempty"`
   876  
   877  	// Date and time when the request for access was created.
   878  	CreatedAt *Timestamp `json:"created_at,omitempty"`
   879  
   880  	// Whether the associated fine-grained personal access token has expired.
   881  	TokenExpired *bool `json:"token_expired,omitempty"`
   882  
   883  	// Date and time when the associated fine-grained personal access token expires.
   884  	TokenExpiresAt *Timestamp `json:"token_expires_at,omitempty"`
   885  
   886  	// Date and time when the associated fine-grained personal access token was last used for authentication.
   887  	TokenLastUsedAt *Timestamp `json:"token_last_used_at,omitempty"`
   888  }
   889  
   890  // PersonalAccessTokenPermissions represents the original or newly requested
   891  // scope of permissions for a fine-grained personal access token within a PersonalAccessTokenRequest.
   892  type PersonalAccessTokenPermissions struct {
   893  	Org   map[string]string `json:"organization,omitempty"`
   894  	Repo  map[string]string `json:"repository,omitempty"`
   895  	Other map[string]string `json:"other,omitempty"`
   896  }
   897  
   898  // PingEvent is triggered when a Webhook is added to GitHub.
   899  //
   900  // GitHub API docs: https://developer.github.com/webhooks/#ping-event
   901  type PingEvent struct {
   902  	// Random string of GitHub zen.
   903  	Zen *string `json:"zen,omitempty"`
   904  	// The ID of the webhook that triggered the ping.
   905  	HookID *int64 `json:"hook_id,omitempty"`
   906  	// The webhook configuration.
   907  	Hook *Hook `json:"hook,omitempty"`
   908  
   909  	// The following fields are only populated by Webhook events.
   910  	Repo         *Repository   `json:"repository,omitempty"`
   911  	Org          *Organization `json:"organization,omitempty"`
   912  	Sender       *User         `json:"sender,omitempty"`
   913  	Installation *Installation `json:"installation,omitempty"`
   914  }
   915  
   916  // ProjectEvent is triggered when project is created, modified or deleted.
   917  // The webhook event name is "project".
   918  //
   919  // GitHub API docs: https://docs.github.com/en/developers/webhooks-and-events/webhook-events-and-payloads#project
   920  type ProjectEvent struct {
   921  	Action  *string        `json:"action,omitempty"`
   922  	Changes *ProjectChange `json:"changes,omitempty"`
   923  	Project *Project       `json:"project,omitempty"`
   924  
   925  	// The following fields are only populated by Webhook events.
   926  	Repo         *Repository   `json:"repository,omitempty"`
   927  	Org          *Organization `json:"organization,omitempty"`
   928  	Sender       *User         `json:"sender,omitempty"`
   929  	Installation *Installation `json:"installation,omitempty"`
   930  }
   931  
   932  // ProjectCardEvent is triggered when a project card is created, updated, moved, converted to an issue, or deleted.
   933  // The webhook event name is "project_card".
   934  //
   935  // GitHub API docs: https://docs.github.com/en/developers/webhooks-and-events/webhook-events-and-payloads#project_card
   936  type ProjectCardEvent struct {
   937  	Action      *string            `json:"action,omitempty"`
   938  	Changes     *ProjectCardChange `json:"changes,omitempty"`
   939  	AfterID     *int64             `json:"after_id,omitempty"`
   940  	ProjectCard *ProjectCard       `json:"project_card,omitempty"`
   941  
   942  	// The following fields are only populated by Webhook events.
   943  	Repo         *Repository   `json:"repository,omitempty"`
   944  	Org          *Organization `json:"organization,omitempty"`
   945  	Sender       *User         `json:"sender,omitempty"`
   946  	Installation *Installation `json:"installation,omitempty"`
   947  }
   948  
   949  // ProjectColumnEvent is triggered when a project column is created, updated, moved, or deleted.
   950  // The webhook event name is "project_column".
   951  //
   952  // GitHub API docs: https://docs.github.com/en/developers/webhooks-and-events/webhook-events-and-payloads#project_column
   953  type ProjectColumnEvent struct {
   954  	Action        *string              `json:"action,omitempty"`
   955  	Changes       *ProjectColumnChange `json:"changes,omitempty"`
   956  	AfterID       *int64               `json:"after_id,omitempty"`
   957  	ProjectColumn *ProjectColumn       `json:"project_column,omitempty"`
   958  
   959  	// The following fields are only populated by Webhook events.
   960  	Repo         *Repository   `json:"repository,omitempty"`
   961  	Org          *Organization `json:"organization,omitempty"`
   962  	Sender       *User         `json:"sender,omitempty"`
   963  	Installation *Installation `json:"installation,omitempty"`
   964  }
   965  
   966  // ProjectV2Event is triggered when there is activity relating to an organization-level project.
   967  // The Webhook event name is "projects_v2".
   968  //
   969  // GitHub API docs: https://docs.github.com/en/developers/webhooks-and-events/webhooks/webhook-events-and-payloads#projects_v2
   970  type ProjectV2Event struct {
   971  	Action     *string     `json:"action,omitempty"`
   972  	ProjectsV2 *ProjectsV2 `json:"projects_v2,omitempty"`
   973  
   974  	// The following fields are only populated by Webhook events.
   975  	Installation *Installation `json:"installation,omitempty"`
   976  	Org          *Organization `json:"organization,omitempty"`
   977  	Sender       *User         `json:"sender,omitempty"`
   978  }
   979  
   980  // ProjectsV2 represents a projects v2 project.
   981  type ProjectsV2 struct {
   982  	ID               *int64     `json:"id,omitempty"`
   983  	NodeID           *string    `json:"node_id,omitempty"`
   984  	Owner            *User      `json:"owner,omitempty"`
   985  	Creator          *User      `json:"creator,omitempty"`
   986  	Title            *string    `json:"title,omitempty"`
   987  	Description      *string    `json:"description,omitempty"`
   988  	Public           *bool      `json:"public,omitempty"`
   989  	ClosedAt         *Timestamp `json:"closed_at,omitempty"`
   990  	CreatedAt        *Timestamp `json:"created_at,omitempty"`
   991  	UpdatedAt        *Timestamp `json:"updated_at,omitempty"`
   992  	DeletedAt        *Timestamp `json:"deleted_at,omitempty"`
   993  	Number           *int       `json:"number,omitempty"`
   994  	ShortDescription *string    `json:"short_description,omitempty"`
   995  	DeletedBy        *User      `json:"deleted_by,omitempty"`
   996  }
   997  
   998  // ProjectV2ItemEvent is triggered when there is activity relating to an item on an organization-level project.
   999  // The Webhook event name is "projects_v2_item".
  1000  //
  1001  // GitHub API docs: https://docs.github.com/en/developers/webhooks-and-events/webhooks/webhook-events-and-payloads#projects_v2_item
  1002  type ProjectV2ItemEvent struct {
  1003  	Action        *string              `json:"action,omitempty"`
  1004  	Changes       *ProjectV2ItemChange `json:"changes,omitempty"`
  1005  	ProjectV2Item *ProjectV2Item       `json:"projects_v2_item,omitempty"`
  1006  
  1007  	// The following fields are only populated by Webhook events.
  1008  	Installation *Installation `json:"installation,omitempty"`
  1009  	Org          *Organization `json:"organization,omitempty"`
  1010  	Sender       *User         `json:"sender,omitempty"`
  1011  }
  1012  
  1013  // ProjectV2ItemChange represents a project v2 item change.
  1014  type ProjectV2ItemChange struct {
  1015  	ArchivedAt *ArchivedAt `json:"archived_at,omitempty"`
  1016  }
  1017  
  1018  // ArchivedAt represents an archiving date change.
  1019  type ArchivedAt struct {
  1020  	From *Timestamp `json:"from,omitempty"`
  1021  	To   *Timestamp `json:"to,omitempty"`
  1022  }
  1023  
  1024  // ProjectsV2 represents an item belonging to a project.
  1025  type ProjectV2Item struct {
  1026  	ID            *int64     `json:"id,omitempty"`
  1027  	NodeID        *string    `json:"node_id,omitempty"`
  1028  	ProjectNodeID *string    `json:"project_node_id,omitempty"`
  1029  	ContentNodeID *string    `json:"content_node_id,omitempty"`
  1030  	ContentType   *string    `json:"content_type,omitempty"`
  1031  	Creator       *User      `json:"creator,omitempty"`
  1032  	CreatedAt     *Timestamp `json:"created_at,omitempty"`
  1033  	UpdatedAt     *Timestamp `json:"updated_at,omitempty"`
  1034  	ArchivedAt    *Timestamp `json:"archived_at,omitempty"`
  1035  }
  1036  
  1037  // PublicEvent is triggered when a private repository is open sourced.
  1038  // According to GitHub: "Without a doubt: the best GitHub event."
  1039  // The Webhook event name is "public".
  1040  //
  1041  // GitHub API docs: https://docs.github.com/en/developers/webhooks-and-events/webhook-events-and-payloads#public
  1042  type PublicEvent struct {
  1043  	// The following fields are only populated by Webhook events.
  1044  	Repo         *Repository   `json:"repository,omitempty"`
  1045  	Sender       *User         `json:"sender,omitempty"`
  1046  	Installation *Installation `json:"installation,omitempty"`
  1047  }
  1048  
  1049  // PullRequestEvent is triggered when a pull request is assigned, unassigned, labeled,
  1050  // unlabeled, opened, edited, closed, reopened, synchronize, ready_for_review,
  1051  // locked, unlocked, a pull request review is requested, or a review request is removed.
  1052  // The Webhook event name is "pull_request".
  1053  //
  1054  // GitHub API docs: https://docs.github.com/en/developers/webhooks-and-events/github-event-types#pullrequestevent
  1055  type PullRequestEvent struct {
  1056  	// Action is the action that was performed. Possible values are:
  1057  	// "assigned", "unassigned", "review_requested", "review_request_removed", "labeled", "unlabeled",
  1058  	// "opened", "edited", "closed", "ready_for_review", "locked", "unlocked", or "reopened".
  1059  	// If the action is "closed" and the "merged" key is "false", the pull request was closed with unmerged commits.
  1060  	// If the action is "closed" and the "merged" key is "true", the pull request was merged.
  1061  	// While webhooks are also triggered when a pull request is synchronized, Events API timelines
  1062  	// don't include pull request events with the "synchronize" action.
  1063  	Action      *string      `json:"action,omitempty"`
  1064  	Assignee    *User        `json:"assignee,omitempty"`
  1065  	Number      *int         `json:"number,omitempty"`
  1066  	PullRequest *PullRequest `json:"pull_request,omitempty"`
  1067  
  1068  	// The following fields are only populated by Webhook events.
  1069  	Changes *EditChange `json:"changes,omitempty"`
  1070  	// RequestedReviewer is populated in "review_requested", "review_request_removed" event deliveries.
  1071  	// A request affecting multiple reviewers at once is split into multiple
  1072  	// such event deliveries, each with a single, different RequestedReviewer.
  1073  	RequestedReviewer *User `json:"requested_reviewer,omitempty"`
  1074  	// In the event that a team is requested instead of a user, "requested_team" gets sent in place of
  1075  	// "requested_user" with the same delivery behavior.
  1076  	RequestedTeam *Team         `json:"requested_team,omitempty"`
  1077  	Repo          *Repository   `json:"repository,omitempty"`
  1078  	Sender        *User         `json:"sender,omitempty"`
  1079  	Installation  *Installation `json:"installation,omitempty"`
  1080  	Label         *Label        `json:"label,omitempty"` // Populated in "labeled" event deliveries.
  1081  
  1082  	// The following field is only present when the webhook is triggered on
  1083  	// a repository belonging to an organization.
  1084  	Organization *Organization `json:"organization,omitempty"`
  1085  
  1086  	// The following fields are only populated when the Action is "synchronize".
  1087  	Before *string `json:"before,omitempty"`
  1088  	After  *string `json:"after,omitempty"`
  1089  }
  1090  
  1091  // PullRequestReviewEvent is triggered when a review is submitted on a pull
  1092  // request.
  1093  // The Webhook event name is "pull_request_review".
  1094  //
  1095  // GitHub API docs: https://docs.github.com/en/developers/webhooks-and-events/webhook-events-and-payloads#pull_request_review
  1096  type PullRequestReviewEvent struct {
  1097  	// Action is always "submitted".
  1098  	Action      *string            `json:"action,omitempty"`
  1099  	Review      *PullRequestReview `json:"review,omitempty"`
  1100  	PullRequest *PullRequest       `json:"pull_request,omitempty"`
  1101  
  1102  	// The following fields are only populated by Webhook events.
  1103  	Repo         *Repository   `json:"repository,omitempty"`
  1104  	Sender       *User         `json:"sender,omitempty"`
  1105  	Installation *Installation `json:"installation,omitempty"`
  1106  
  1107  	// The following field is only present when the webhook is triggered on
  1108  	// a repository belonging to an organization.
  1109  	Organization *Organization `json:"organization,omitempty"`
  1110  }
  1111  
  1112  // PullRequestReviewCommentEvent is triggered when a comment is created on a
  1113  // portion of the unified diff of a pull request.
  1114  // The Webhook event name is "pull_request_review_comment".
  1115  //
  1116  // GitHub API docs: https://docs.github.com/en/developers/webhooks-and-events/webhook-events-and-payloads#pull_request_review_comment
  1117  type PullRequestReviewCommentEvent struct {
  1118  	// Action is the action that was performed on the comment.
  1119  	// Possible values are: "created", "edited", "deleted".
  1120  	Action      *string             `json:"action,omitempty"`
  1121  	PullRequest *PullRequest        `json:"pull_request,omitempty"`
  1122  	Comment     *PullRequestComment `json:"comment,omitempty"`
  1123  
  1124  	// The following fields are only populated by Webhook events.
  1125  	Changes      *EditChange   `json:"changes,omitempty"`
  1126  	Repo         *Repository   `json:"repository,omitempty"`
  1127  	Sender       *User         `json:"sender,omitempty"`
  1128  	Installation *Installation `json:"installation,omitempty"`
  1129  }
  1130  
  1131  // PullRequestReviewThreadEvent is triggered when a comment made as part of a
  1132  // review of a pull request is marked resolved or unresolved.
  1133  // The Webhook event name is "pull_request_review_thread".
  1134  //
  1135  // GitHub API docs: https://docs.github.com/en/developers/webhooks-and-events/webhook-events-and-payloads#pull_request_review_thread
  1136  type PullRequestReviewThreadEvent struct {
  1137  	// Action is the action that was performed on the comment.
  1138  	// Possible values are: "resolved", "unresolved".
  1139  	Action      *string            `json:"action,omitempty"`
  1140  	Thread      *PullRequestThread `json:"thread,omitempty"`
  1141  	PullRequest *PullRequest       `json:"pull_request,omitempty"`
  1142  
  1143  	// The following fields are only populated by Webhook events.
  1144  	Repo         *Repository   `json:"repository,omitempty"`
  1145  	Sender       *User         `json:"sender,omitempty"`
  1146  	Installation *Installation `json:"installation,omitempty"`
  1147  }
  1148  
  1149  // PullRequestTargetEvent is triggered when a pull request is assigned, unassigned, labeled,
  1150  // unlabeled, opened, edited, closed, reopened, synchronize, ready_for_review,
  1151  // locked, unlocked, a pull request review is requested, or a review request is removed.
  1152  // The Webhook event name is "pull_request_target".
  1153  //
  1154  // GitHub API docs: https://docs.github.com/en/actions/events-that-trigger-workflows#pull_request_target
  1155  type PullRequestTargetEvent struct {
  1156  	// Action is the action that was performed. Possible values are:
  1157  	// "assigned", "unassigned", "labeled", "unlabeled", "opened", "edited", "closed", "reopened",
  1158  	// "ready_for_review", "locked", "unlocked", "review_requested" or "review_request_removed".
  1159  	// If the action is "closed" and the "merged" key is "false", the pull request was closed with unmerged commits.
  1160  	// If the action is "closed" and the "merged" key is "true", the pull request was merged.
  1161  	// While webhooks are also triggered when a pull request is synchronized, Events API timelines
  1162  	// don't include pull request events with the "synchronize" action.
  1163  	Action      *string      `json:"action,omitempty"`
  1164  	Assignee    *User        `json:"assignee,omitempty"`
  1165  	Number      *int         `json:"number,omitempty"`
  1166  	PullRequest *PullRequest `json:"pull_request,omitempty"`
  1167  
  1168  	// The following fields are only populated by Webhook events.
  1169  	Changes *EditChange `json:"changes,omitempty"`
  1170  	// RequestedReviewer is populated in "review_requested", "review_request_removed" event deliveries.
  1171  	// A request affecting multiple reviewers at once is split into multiple
  1172  	// such event deliveries, each with a single, different RequestedReviewer.
  1173  	RequestedReviewer *User `json:"requested_reviewer,omitempty"`
  1174  	// In the event that a team is requested instead of a user, "requested_team" gets sent in place of
  1175  	// "requested_user" with the same delivery behavior.
  1176  	RequestedTeam *Team         `json:"requested_team,omitempty"`
  1177  	Repo          *Repository   `json:"repository,omitempty"`
  1178  	Sender        *User         `json:"sender,omitempty"`
  1179  	Installation  *Installation `json:"installation,omitempty"`
  1180  	Label         *Label        `json:"label,omitempty"` // Populated in "labeled" event deliveries.
  1181  
  1182  	// The following field is only present when the webhook is triggered on
  1183  	// a repository belonging to an organization.
  1184  	Organization *Organization `json:"organization,omitempty"`
  1185  
  1186  	// The following fields are only populated when the Action is "synchronize".
  1187  	Before *string `json:"before,omitempty"`
  1188  	After  *string `json:"after,omitempty"`
  1189  }
  1190  
  1191  // PushEvent represents a git push to a GitHub repository.
  1192  //
  1193  // GitHub API docs: https://docs.github.com/en/developers/webhooks-and-events/webhook-events-and-payloads#push
  1194  type PushEvent struct {
  1195  	PushID       *int64        `json:"push_id,omitempty"`
  1196  	Head         *string       `json:"head,omitempty"`
  1197  	Ref          *string       `json:"ref,omitempty"`
  1198  	Size         *int          `json:"size,omitempty"`
  1199  	Commits      []*HeadCommit `json:"commits,omitempty"`
  1200  	Before       *string       `json:"before,omitempty"`
  1201  	DistinctSize *int          `json:"distinct_size,omitempty"`
  1202  
  1203  	// The following fields are only populated by Webhook events.
  1204  	Action       *string              `json:"action,omitempty"`
  1205  	After        *string              `json:"after,omitempty"`
  1206  	Created      *bool                `json:"created,omitempty"`
  1207  	Deleted      *bool                `json:"deleted,omitempty"`
  1208  	Forced       *bool                `json:"forced,omitempty"`
  1209  	BaseRef      *string              `json:"base_ref,omitempty"`
  1210  	Compare      *string              `json:"compare,omitempty"`
  1211  	Repo         *PushEventRepository `json:"repository,omitempty"`
  1212  	HeadCommit   *HeadCommit          `json:"head_commit,omitempty"`
  1213  	Pusher       *User                `json:"pusher,omitempty"`
  1214  	Sender       *User                `json:"sender,omitempty"`
  1215  	Installation *Installation        `json:"installation,omitempty"`
  1216  
  1217  	// The following field is only present when the webhook is triggered on
  1218  	// a repository belonging to an organization.
  1219  	Organization *Organization `json:"organization,omitempty"`
  1220  }
  1221  
  1222  func (p PushEvent) String() string {
  1223  	return Stringify(p)
  1224  }
  1225  
  1226  // HeadCommit represents a git commit in a GitHub PushEvent.
  1227  type HeadCommit struct {
  1228  	Message  *string       `json:"message,omitempty"`
  1229  	Author   *CommitAuthor `json:"author,omitempty"`
  1230  	URL      *string       `json:"url,omitempty"`
  1231  	Distinct *bool         `json:"distinct,omitempty"`
  1232  
  1233  	// The following fields are only populated by Events API.
  1234  	SHA *string `json:"sha,omitempty"`
  1235  
  1236  	// The following fields are only populated by Webhook events.
  1237  	ID        *string       `json:"id,omitempty"`
  1238  	TreeID    *string       `json:"tree_id,omitempty"`
  1239  	Timestamp *Timestamp    `json:"timestamp,omitempty"`
  1240  	Committer *CommitAuthor `json:"committer,omitempty"`
  1241  	Added     []string      `json:"added,omitempty"`
  1242  	Removed   []string      `json:"removed,omitempty"`
  1243  	Modified  []string      `json:"modified,omitempty"`
  1244  }
  1245  
  1246  func (h HeadCommit) String() string {
  1247  	return Stringify(h)
  1248  }
  1249  
  1250  // PushEventRepository represents the repo object in a PushEvent payload.
  1251  type PushEventRepository struct {
  1252  	ID              *int64     `json:"id,omitempty"`
  1253  	NodeID          *string    `json:"node_id,omitempty"`
  1254  	Name            *string    `json:"name,omitempty"`
  1255  	FullName        *string    `json:"full_name,omitempty"`
  1256  	Owner           *User      `json:"owner,omitempty"`
  1257  	Private         *bool      `json:"private,omitempty"`
  1258  	Description     *string    `json:"description,omitempty"`
  1259  	Fork            *bool      `json:"fork,omitempty"`
  1260  	CreatedAt       *Timestamp `json:"created_at,omitempty"`
  1261  	PushedAt        *Timestamp `json:"pushed_at,omitempty"`
  1262  	UpdatedAt       *Timestamp `json:"updated_at,omitempty"`
  1263  	Homepage        *string    `json:"homepage,omitempty"`
  1264  	PullsURL        *string    `json:"pulls_url,omitempty"`
  1265  	Size            *int       `json:"size,omitempty"`
  1266  	StargazersCount *int       `json:"stargazers_count,omitempty"`
  1267  	WatchersCount   *int       `json:"watchers_count,omitempty"`
  1268  	Language        *string    `json:"language,omitempty"`
  1269  	HasIssues       *bool      `json:"has_issues,omitempty"`
  1270  	HasDownloads    *bool      `json:"has_downloads,omitempty"`
  1271  	HasWiki         *bool      `json:"has_wiki,omitempty"`
  1272  	HasPages        *bool      `json:"has_pages,omitempty"`
  1273  	ForksCount      *int       `json:"forks_count,omitempty"`
  1274  	Archived        *bool      `json:"archived,omitempty"`
  1275  	Disabled        *bool      `json:"disabled,omitempty"`
  1276  	OpenIssuesCount *int       `json:"open_issues_count,omitempty"`
  1277  	DefaultBranch   *string    `json:"default_branch,omitempty"`
  1278  	MasterBranch    *string    `json:"master_branch,omitempty"`
  1279  	Organization    *string    `json:"organization,omitempty"`
  1280  	URL             *string    `json:"url,omitempty"`
  1281  	ArchiveURL      *string    `json:"archive_url,omitempty"`
  1282  	HTMLURL         *string    `json:"html_url,omitempty"`
  1283  	StatusesURL     *string    `json:"statuses_url,omitempty"`
  1284  	GitURL          *string    `json:"git_url,omitempty"`
  1285  	SSHURL          *string    `json:"ssh_url,omitempty"`
  1286  	CloneURL        *string    `json:"clone_url,omitempty"`
  1287  	SVNURL          *string    `json:"svn_url,omitempty"`
  1288  	Topics          []string   `json:"topics,omitempty"`
  1289  }
  1290  
  1291  // PushEventRepoOwner is a basic representation of user/org in a PushEvent payload.
  1292  type PushEventRepoOwner struct {
  1293  	Name  *string `json:"name,omitempty"`
  1294  	Email *string `json:"email,omitempty"`
  1295  }
  1296  
  1297  // ReleaseEvent is triggered when a release is published, unpublished, created,
  1298  // edited, deleted, or prereleased.
  1299  // The Webhook event name is "release".
  1300  //
  1301  // GitHub API docs: https://docs.github.com/en/developers/webhooks-and-events/webhook-events-and-payloads#release
  1302  type ReleaseEvent struct {
  1303  	// Action is the action that was performed. Possible values are: "published", "unpublished",
  1304  	// "created", "edited", "deleted", or "prereleased".
  1305  	Action  *string            `json:"action,omitempty"`
  1306  	Release *RepositoryRelease `json:"release,omitempty"`
  1307  
  1308  	// The following fields are only populated by Webhook events.
  1309  	Repo         *Repository   `json:"repository,omitempty"`
  1310  	Sender       *User         `json:"sender,omitempty"`
  1311  	Installation *Installation `json:"installation,omitempty"`
  1312  }
  1313  
  1314  // RepositoryEvent is triggered when a repository is created, archived, unarchived,
  1315  // renamed, edited, transferred, made public, or made private. Organization hooks are
  1316  // also trigerred when a repository is deleted.
  1317  // The Webhook event name is "repository".
  1318  //
  1319  // Events of this type are not visible in timelines, they are only used to
  1320  // trigger organization webhooks.
  1321  //
  1322  // GitHub API docs: https://docs.github.com/en/developers/webhooks-and-events/webhook-events-and-payloads#repository
  1323  type RepositoryEvent struct {
  1324  	// Action is the action that was performed. Possible values are: "created",
  1325  	// "deleted" (organization hooks only), "archived", "unarchived", "edited", "renamed",
  1326  	// "transferred", "publicized", or "privatized".
  1327  	Action *string     `json:"action,omitempty"`
  1328  	Repo   *Repository `json:"repository,omitempty"`
  1329  
  1330  	// The following fields are only populated by Webhook events.
  1331  	Changes      *EditChange   `json:"changes,omitempty"`
  1332  	Org          *Organization `json:"organization,omitempty"`
  1333  	Sender       *User         `json:"sender,omitempty"`
  1334  	Installation *Installation `json:"installation,omitempty"`
  1335  }
  1336  
  1337  // RepositoryDispatchEvent is triggered when a client sends a POST request to the repository dispatch event endpoint.
  1338  //
  1339  // GitHub API docs: https://docs.github.com/en/developers/webhooks-and-events/webhook-events-and-payloads#repository_dispatch
  1340  type RepositoryDispatchEvent struct {
  1341  	// Action is the event_type that submitted with the repository dispatch payload. Value can be any string.
  1342  	Action        *string         `json:"action,omitempty"`
  1343  	Branch        *string         `json:"branch,omitempty"`
  1344  	ClientPayload json.RawMessage `json:"client_payload,omitempty"`
  1345  	Repo          *Repository     `json:"repository,omitempty"`
  1346  
  1347  	// The following fields are only populated by Webhook events.
  1348  	Org          *Organization `json:"organization,omitempty"`
  1349  	Sender       *User         `json:"sender,omitempty"`
  1350  	Installation *Installation `json:"installation,omitempty"`
  1351  }
  1352  
  1353  // RepositoryImportEvent represents the activity related to a repository being imported to GitHub.
  1354  //
  1355  // GitHub API docs: https://docs.github.com/en/developers/webhooks-and-events/webhooks/webhook-events-and-payloads#repository_import
  1356  type RepositoryImportEvent struct {
  1357  	// Status represents the final state of the import. This can be one of "success", "cancelled", or "failure".
  1358  	Status *string       `json:"status,omitempty"`
  1359  	Repo   *Repository   `json:"repository,omitempty"`
  1360  	Org    *Organization `json:"organization,omitempty"`
  1361  	Sender *User         `json:"sender,omitempty"`
  1362  }
  1363  
  1364  // RepositoryVulnerabilityAlertEvent is triggered when a security alert is created, dismissed, or resolved.
  1365  //
  1366  // GitHub API docs: https://docs.github.com/en/developers/webhooks-and-events/webhook-events-and-payloads#repository_vulnerability_alert
  1367  type RepositoryVulnerabilityAlertEvent struct {
  1368  	// Action is the action that was performed. Possible values are: "create", "dismiss", "resolve".
  1369  	Action *string `json:"action,omitempty"`
  1370  
  1371  	// The security alert of the vulnerable dependency.
  1372  	Alert *RepositoryVulnerabilityAlert `json:"alert,omitempty"`
  1373  
  1374  	// The repository of the vulnerable dependency.
  1375  	Repository *Repository `json:"repository,omitempty"`
  1376  
  1377  	// The following fields are only populated by Webhook events.
  1378  	Installation *Installation `json:"installation,omitempty"`
  1379  
  1380  	// The user that triggered the event.
  1381  	Sender *User `json:"sender,omitempty"`
  1382  }
  1383  
  1384  // RepositoryVulnerabilityAlert represents a repository security alert.
  1385  type RepositoryVulnerabilityAlert struct {
  1386  	ID                       *int64     `json:"id,omitempty"`
  1387  	AffectedRange            *string    `json:"affected_range,omitempty"`
  1388  	AffectedPackageName      *string    `json:"affected_package_name,omitempty"`
  1389  	ExternalReference        *string    `json:"external_reference,omitempty"`
  1390  	ExternalIdentifier       *string    `json:"external_identifier,omitempty"`
  1391  	GitHubSecurityAdvisoryID *string    `json:"ghsa_id,omitempty"`
  1392  	Severity                 *string    `json:"severity,omitempty"`
  1393  	CreatedAt                *Timestamp `json:"created_at,omitempty"`
  1394  	FixedIn                  *string    `json:"fixed_in,omitempty"`
  1395  	Dismisser                *User      `json:"dismisser,omitempty"`
  1396  	DismissReason            *string    `json:"dismiss_reason,omitempty"`
  1397  	DismissedAt              *Timestamp `json:"dismissed_at,omitempty"`
  1398  }
  1399  
  1400  // SecretScanningAlertEvent is triggered when a secret scanning alert occurs in a repository.
  1401  // The Webhook name is secret_scanning_alert.
  1402  //
  1403  // GitHub API docs: https://docs.github.com/en/developers/webhooks-and-events/webhooks/webhook-events-and-payloads#secret_scanning_alert
  1404  type SecretScanningAlertEvent struct {
  1405  	// Action is the action that was performed. Possible values are: "created", "resolved", or "reopened".
  1406  	Action *string `json:"action,omitempty"`
  1407  
  1408  	// Alert is the secret scanning alert involved in the event.
  1409  	Alert *SecretScanningAlert `json:"alert,omitempty"`
  1410  
  1411  	// Only populated by the "resolved" and "reopen" actions
  1412  	Sender *User `json:"sender,omitempty"`
  1413  	// The following fields are only populated by Webhook events.
  1414  	Repo         *Repository   `json:"repository,omitempty"`
  1415  	Organization *Organization `json:"organization,omitempty"`
  1416  	Enterprise   *Enterprise   `json:"enterprise,omitempty"`
  1417  	Installation *Installation `json:"installation,omitempty"`
  1418  }
  1419  
  1420  // SecurityAndAnalysisEvent is triggered when code security and analysis features
  1421  // are enabled or disabled for a repository.
  1422  //
  1423  // GitHub API docs: https://docs.github.com/en/webhooks-and-events/webhooks/webhook-events-and-payloads#security_and_analysis
  1424  type SecurityAndAnalysisEvent struct {
  1425  	Changes      *SecurityAndAnalysisChange `json:"changes,omitempty"`
  1426  	Enterprise   *Enterprise                `json:"enterprise,omitempty"`
  1427  	Installation *Installation              `json:"installation,omitempty"`
  1428  	Organization *Organization              `json:"organization,omitempty"`
  1429  	Repository   *Repository                `json:"repository,omitempty"`
  1430  	Sender       *User                      `json:"sender,omitempty"`
  1431  }
  1432  
  1433  // SecurityAndAnalysisChange represents the changes when security and analysis
  1434  // features are enabled or disabled for a repository.
  1435  type SecurityAndAnalysisChange struct {
  1436  	From *SecurityAndAnalysisChangeFrom `json:"from,omitempty"`
  1437  }
  1438  
  1439  // SecurityAndAnalysisChangeFrom represents which change was made when security
  1440  // and analysis features are enabled or disabled for a repository.
  1441  type SecurityAndAnalysisChangeFrom struct {
  1442  	SecurityAndAnalysis *SecurityAndAnalysis `json:"security_and_analysis,omitempty"`
  1443  }
  1444  
  1445  // StarEvent is triggered when a star is added or removed from a repository.
  1446  // The Webhook event name is "star".
  1447  //
  1448  // GitHub API docs: https://docs.github.com/en/developers/webhooks-and-events/webhook-events-and-payloads#star
  1449  type StarEvent struct {
  1450  	// Action is the action that was performed. Possible values are: "created" or "deleted".
  1451  	Action *string `json:"action,omitempty"`
  1452  
  1453  	// StarredAt is the time the star was created. It will be null for the "deleted" action.
  1454  	StarredAt *Timestamp `json:"starred_at,omitempty"`
  1455  
  1456  	// The following fields are only populated by Webhook events.
  1457  	Org          *Organization `json:"organization,omitempty"`
  1458  	Repo         *Repository   `json:"repository,omitempty"`
  1459  	Sender       *User         `json:"sender,omitempty"`
  1460  	Installation *Installation `json:"installation,omitempty"`
  1461  }
  1462  
  1463  // StatusEvent is triggered when the status of a Git commit changes.
  1464  // The Webhook event name is "status".
  1465  //
  1466  // Events of this type are not visible in timelines, they are only used to
  1467  // trigger hooks.
  1468  //
  1469  // GitHub API docs: https://docs.github.com/en/developers/webhooks-and-events/webhook-events-and-payloads#status
  1470  type StatusEvent struct {
  1471  	SHA *string `json:"sha,omitempty"`
  1472  	// State is the new state. Possible values are: "pending", "success", "failure", "error".
  1473  	State       *string   `json:"state,omitempty"`
  1474  	Description *string   `json:"description,omitempty"`
  1475  	TargetURL   *string   `json:"target_url,omitempty"`
  1476  	Branches    []*Branch `json:"branches,omitempty"`
  1477  
  1478  	// The following fields are only populated by Webhook events.
  1479  	ID           *int64            `json:"id,omitempty"`
  1480  	Name         *string           `json:"name,omitempty"`
  1481  	Context      *string           `json:"context,omitempty"`
  1482  	Commit       *RepositoryCommit `json:"commit,omitempty"`
  1483  	CreatedAt    *Timestamp        `json:"created_at,omitempty"`
  1484  	UpdatedAt    *Timestamp        `json:"updated_at,omitempty"`
  1485  	Repo         *Repository       `json:"repository,omitempty"`
  1486  	Sender       *User             `json:"sender,omitempty"`
  1487  	Installation *Installation     `json:"installation,omitempty"`
  1488  }
  1489  
  1490  // TeamEvent is triggered when an organization's team is created, modified or deleted.
  1491  // The Webhook event name is "team".
  1492  //
  1493  // Events of this type are not visible in timelines. These events are only used
  1494  // to trigger hooks.
  1495  //
  1496  // GitHub API docs: https://docs.github.com/en/developers/webhooks-and-events/webhook-events-and-payloads#team
  1497  type TeamEvent struct {
  1498  	Action  *string     `json:"action,omitempty"`
  1499  	Team    *Team       `json:"team,omitempty"`
  1500  	Changes *TeamChange `json:"changes,omitempty"`
  1501  	Repo    *Repository `json:"repository,omitempty"`
  1502  
  1503  	// The following fields are only populated by Webhook events.
  1504  	Org          *Organization `json:"organization,omitempty"`
  1505  	Sender       *User         `json:"sender,omitempty"`
  1506  	Installation *Installation `json:"installation,omitempty"`
  1507  }
  1508  
  1509  // TeamAddEvent is triggered when a repository is added to a team.
  1510  // The Webhook event name is "team_add".
  1511  //
  1512  // Events of this type are not visible in timelines. These events are only used
  1513  // to trigger hooks.
  1514  //
  1515  // GitHub API docs: https://docs.github.com/en/developers/webhooks-and-events/webhook-events-and-payloads#team_add
  1516  type TeamAddEvent struct {
  1517  	Team *Team       `json:"team,omitempty"`
  1518  	Repo *Repository `json:"repository,omitempty"`
  1519  
  1520  	// The following fields are only populated by Webhook events.
  1521  	Org          *Organization `json:"organization,omitempty"`
  1522  	Sender       *User         `json:"sender,omitempty"`
  1523  	Installation *Installation `json:"installation,omitempty"`
  1524  }
  1525  
  1526  // UserEvent is triggered when a user is created or deleted.
  1527  // The Webhook event name is "user".
  1528  //
  1529  // Only global webhooks can subscribe to this event type.
  1530  //
  1531  // GitHub API docs: https://developer.github.com/enterprise/v3/activity/events/types/#userevent-enterprise
  1532  type UserEvent struct {
  1533  	User *User `json:"user,omitempty"`
  1534  	// The action performed. Possible values are: "created" or "deleted".
  1535  	Action     *string     `json:"action,omitempty"`
  1536  	Enterprise *Enterprise `json:"enterprise,omitempty"`
  1537  	Sender     *User       `json:"sender,omitempty"`
  1538  
  1539  	// The following fields are only populated by Webhook events.
  1540  	Installation *Installation `json:"installation,omitempty"`
  1541  }
  1542  
  1543  // WatchEvent is related to starring a repository, not watching. See this API
  1544  // blog post for an explanation: https://developer.github.com/changes/2012-09-05-watcher-api/
  1545  //
  1546  // The event’s actor is the user who starred a repository, and the event’s
  1547  // repository is the repository that was starred.
  1548  //
  1549  // GitHub API docs: https://docs.github.com/en/developers/webhooks-and-events/webhook-events-and-payloads#watch
  1550  type WatchEvent struct {
  1551  	// Action is the action that was performed. Possible value is: "started".
  1552  	Action *string `json:"action,omitempty"`
  1553  
  1554  	// The following fields are only populated by Webhook events.
  1555  	Repo         *Repository   `json:"repository,omitempty"`
  1556  	Sender       *User         `json:"sender,omitempty"`
  1557  	Installation *Installation `json:"installation,omitempty"`
  1558  }
  1559  
  1560  // WorkflowDispatchEvent is triggered when someone triggers a workflow run on GitHub or
  1561  // sends a POST request to the create a workflow dispatch event endpoint.
  1562  //
  1563  // GitHub API docs: https://docs.github.com/en/developers/webhooks-and-events/webhook-events-and-payloads#workflow_dispatch
  1564  type WorkflowDispatchEvent struct {
  1565  	Inputs   json.RawMessage `json:"inputs,omitempty"`
  1566  	Ref      *string         `json:"ref,omitempty"`
  1567  	Workflow *string         `json:"workflow,omitempty"`
  1568  
  1569  	// The following fields are only populated by Webhook events.
  1570  	Repo         *Repository   `json:"repository,omitempty"`
  1571  	Org          *Organization `json:"organization,omitempty"`
  1572  	Sender       *User         `json:"sender,omitempty"`
  1573  	Installation *Installation `json:"installation,omitempty"`
  1574  }
  1575  
  1576  // WorkflowJobEvent is triggered when a job is queued, started or completed.
  1577  //
  1578  // GitHub API docs: https://docs.github.com/en/developers/webhooks-and-events/webhooks/webhook-events-and-payloads#workflow_job
  1579  type WorkflowJobEvent struct {
  1580  	WorkflowJob *WorkflowJob `json:"workflow_job,omitempty"`
  1581  
  1582  	Action *string `json:"action,omitempty"`
  1583  
  1584  	// The following fields are only populated by Webhook events.
  1585  
  1586  	// Org is not nil when the webhook is configured for an organization or the event
  1587  	// occurs from activity in a repository owned by an organization.
  1588  	Org          *Organization `json:"organization,omitempty"`
  1589  	Repo         *Repository   `json:"repository,omitempty"`
  1590  	Sender       *User         `json:"sender,omitempty"`
  1591  	Installation *Installation `json:"installation,omitempty"`
  1592  }
  1593  
  1594  // WorkflowRunEvent is triggered when a GitHub Actions workflow run is requested or completed.
  1595  //
  1596  // GitHub API docs: https://docs.github.com/en/developers/webhooks-and-events/webhook-events-and-payloads#workflow_run
  1597  type WorkflowRunEvent struct {
  1598  	Action      *string      `json:"action,omitempty"`
  1599  	Workflow    *Workflow    `json:"workflow,omitempty"`
  1600  	WorkflowRun *WorkflowRun `json:"workflow_run,omitempty"`
  1601  
  1602  	// The following fields are only populated by Webhook events.
  1603  	Org          *Organization `json:"organization,omitempty"`
  1604  	Repo         *Repository   `json:"repository,omitempty"`
  1605  	Sender       *User         `json:"sender,omitempty"`
  1606  	Installation *Installation `json:"installation,omitempty"`
  1607  }
  1608  
  1609  // SecurityAdvisory represents the advisory object in SecurityAdvisoryEvent payload.
  1610  //
  1611  // GitHub API docs: https://docs.github.com/en/developers/webhooks-and-events/webhooks/webhook-events-and-payloads#security_advisory
  1612  type SecurityAdvisory struct {
  1613  	CVSS            *AdvisoryCVSS            `json:"cvss,omitempty"`
  1614  	CWEs            []*AdvisoryCWEs          `json:"cwes,omitempty"`
  1615  	GHSAID          *string                  `json:"ghsa_id,omitempty"`
  1616  	Summary         *string                  `json:"summary,omitempty"`
  1617  	Description     *string                  `json:"description,omitempty"`
  1618  	Severity        *string                  `json:"severity,omitempty"`
  1619  	Identifiers     []*AdvisoryIdentifier    `json:"identifiers,omitempty"`
  1620  	References      []*AdvisoryReference     `json:"references,omitempty"`
  1621  	PublishedAt     *Timestamp               `json:"published_at,omitempty"`
  1622  	UpdatedAt       *Timestamp               `json:"updated_at,omitempty"`
  1623  	WithdrawnAt     *Timestamp               `json:"withdrawn_at,omitempty"`
  1624  	Vulnerabilities []*AdvisoryVulnerability `json:"vulnerabilities,omitempty"`
  1625  }
  1626  
  1627  // AdvisoryIdentifier represents the identifier for a Security Advisory.
  1628  type AdvisoryIdentifier struct {
  1629  	Value *string `json:"value,omitempty"`
  1630  	Type  *string `json:"type,omitempty"`
  1631  }
  1632  
  1633  // AdvisoryReference represents the reference url for the security advisory.
  1634  type AdvisoryReference struct {
  1635  	URL *string `json:"url,omitempty"`
  1636  }
  1637  
  1638  // AdvisoryVulnerability represents the vulnerability object for a Security Advisory.
  1639  type AdvisoryVulnerability struct {
  1640  	Package                *VulnerabilityPackage `json:"package,omitempty"`
  1641  	Severity               *string               `json:"severity,omitempty"`
  1642  	VulnerableVersionRange *string               `json:"vulnerable_version_range,omitempty"`
  1643  	FirstPatchedVersion    *FirstPatchedVersion  `json:"first_patched_version,omitempty"`
  1644  }
  1645  
  1646  // VulnerabilityPackage represents the package object for an Advisory Vulnerability.
  1647  type VulnerabilityPackage struct {
  1648  	Ecosystem *string `json:"ecosystem,omitempty"`
  1649  	Name      *string `json:"name,omitempty"`
  1650  }
  1651  
  1652  // FirstPatchedVersion represents the identifier for the first patched version of that vulnerability.
  1653  type FirstPatchedVersion struct {
  1654  	Identifier *string `json:"identifier,omitempty"`
  1655  }
  1656  
  1657  // SecurityAdvisoryEvent is triggered when a security-related vulnerability is found in software on GitHub.
  1658  //
  1659  // GitHub API docs: https://docs.github.com/en/developers/webhooks-and-events/webhooks/webhook-events-and-payloads#security_advisory
  1660  type SecurityAdvisoryEvent struct {
  1661  	Action           *string           `json:"action,omitempty"`
  1662  	SecurityAdvisory *SecurityAdvisory `json:"security_advisory,omitempty"`
  1663  
  1664  	// The following fields are only populated by Webhook events.
  1665  	Enterprise   *Enterprise   `json:"enterprise,omitempty"`
  1666  	Installation *Installation `json:"installation,omitempty"`
  1667  	Organization *Organization `json:"organization,omitempty"`
  1668  	Repository   *Repository   `json:"repository,omitempty"`
  1669  	Sender       *User         `json:"sender,omitempty"`
  1670  }
  1671  
  1672  // CodeScanningAlertEvent is triggered when a code scanning finds a potential vulnerability or error in your code.
  1673  //
  1674  // GitHub API docs: https://docs.github.com/en/developers/webhooks-and-events/webhooks/webhook-events-and-payloads#code_scanning_alert
  1675  type CodeScanningAlertEvent struct {
  1676  	Action *string `json:"action,omitempty"`
  1677  	Alert  *Alert  `json:"alert,omitempty"`
  1678  	Ref    *string `json:"ref,omitempty"`
  1679  	// CommitOID is the commit SHA of the code scanning alert
  1680  	CommitOID *string       `json:"commit_oid,omitempty"`
  1681  	Repo      *Repository   `json:"repository,omitempty"`
  1682  	Org       *Organization `json:"organization,omitempty"`
  1683  	Sender    *User         `json:"sender,omitempty"`
  1684  
  1685  	Installation *Installation `json:"installation,omitempty"`
  1686  }
  1687  

View as plain text