github.com/google/go-github/v52@v52.0.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 Owner *EditOwner `json:"owner,omitempty"` 336 } 337 338 // EditTitle represents a pull-request title change. 339 type EditTitle struct { 340 From *string `json:"from,omitempty"` 341 } 342 343 // EditBody represents a change of pull-request body. 344 type EditBody struct { 345 From *string `json:"from,omitempty"` 346 } 347 348 // EditBase represents the change of a pull-request base branch. 349 type EditBase struct { 350 Ref *EditRef `json:"ref,omitempty"` 351 SHA *EditSHA `json:"sha,omitempty"` 352 } 353 354 // EditRef represents a ref change of a pull-request. 355 type EditRef struct { 356 From *string `json:"from,omitempty"` 357 } 358 359 // EditRepo represents a change of repository name. 360 type EditRepo struct { 361 Name *RepoName `json:"name,omitempty"` 362 } 363 364 // EditOwner represents a change of repository ownership. 365 type EditOwner struct { 366 OwnerInfo *OwnerInfo `json:"from,omitempty"` 367 } 368 369 // OwnerInfo represents the account info of the owner of the repo (could be User or Organization but both are User structs). 370 type OwnerInfo struct { 371 User *User `json:"user,omitempty"` 372 Org *User `json:"organization,omitempty"` 373 } 374 375 // RepoName represents a change of repository name. 376 type RepoName struct { 377 From *string `json:"from,omitempty"` 378 } 379 380 // EditSHA represents a sha change of a pull-request. 381 type EditSHA struct { 382 From *string `json:"from,omitempty"` 383 } 384 385 // ProjectChange represents the changes when a project has been edited. 386 type ProjectChange struct { 387 Name *ProjectName `json:"name,omitempty"` 388 Body *ProjectBody `json:"body,omitempty"` 389 } 390 391 // ProjectName represents a project name change. 392 type ProjectName struct { 393 From *string `json:"from,omitempty"` 394 } 395 396 // ProjectBody represents a project body change. 397 type ProjectBody struct { 398 From *string `json:"from,omitempty"` 399 } 400 401 // ProjectCardChange represents the changes when a project card has been edited. 402 type ProjectCardChange struct { 403 Note *ProjectCardNote `json:"note,omitempty"` 404 } 405 406 // ProjectCardNote represents a change of a note of a project card. 407 type ProjectCardNote struct { 408 From *string `json:"from,omitempty"` 409 } 410 411 // ProjectColumnChange represents the changes when a project column has been edited. 412 type ProjectColumnChange struct { 413 Name *ProjectColumnName `json:"name,omitempty"` 414 } 415 416 // ProjectColumnName represents a project column name change. 417 type ProjectColumnName struct { 418 From *string `json:"from,omitempty"` 419 } 420 421 // TeamChange represents the changes when a team has been edited. 422 type TeamChange struct { 423 Description *TeamDescription `json:"description,omitempty"` 424 Name *TeamName `json:"name,omitempty"` 425 Privacy *TeamPrivacy `json:"privacy,omitempty"` 426 Repository *TeamRepository `json:"repository,omitempty"` 427 } 428 429 // TeamDescription represents a team description change. 430 type TeamDescription struct { 431 From *string `json:"from,omitempty"` 432 } 433 434 // TeamName represents a team name change. 435 type TeamName struct { 436 From *string `json:"from,omitempty"` 437 } 438 439 // TeamPrivacy represents a team privacy change. 440 type TeamPrivacy struct { 441 From *string `json:"from,omitempty"` 442 } 443 444 // TeamRepository represents a team repository permission change. 445 type TeamRepository struct { 446 Permissions *TeamPermissions `json:"permissions,omitempty"` 447 } 448 449 // TeamPermissions represents a team permission change. 450 type TeamPermissions struct { 451 From *TeamPermissionsFrom `json:"from,omitempty"` 452 } 453 454 // TeamPermissionsFrom represents a team permission change. 455 type TeamPermissionsFrom struct { 456 Admin *bool `json:"admin,omitempty"` 457 Pull *bool `json:"pull,omitempty"` 458 Push *bool `json:"push,omitempty"` 459 } 460 461 // InstallationEvent is triggered when a GitHub App has been installed, uninstalled, suspend, unsuspended 462 // or new permissions have been accepted. 463 // The Webhook event name is "installation". 464 // 465 // GitHub API docs: https://docs.github.com/en/developers/webhooks-and-events/webhook-events-and-payloads#installation 466 type InstallationEvent struct { 467 // The action that was performed. Can be either "created", "deleted", "suspend", "unsuspend" or "new_permissions_accepted". 468 Action *string `json:"action,omitempty"` 469 Repositories []*Repository `json:"repositories,omitempty"` 470 Sender *User `json:"sender,omitempty"` 471 Installation *Installation `json:"installation,omitempty"` 472 Requester *User `json:"requester,omitempty"` 473 } 474 475 // InstallationRepositoriesEvent is triggered when a repository is added or 476 // removed from an installation. The Webhook event name is "installation_repositories". 477 // 478 // GitHub API docs: https://docs.github.com/en/developers/webhooks-and-events/webhook-events-and-payloads#installation_repositories 479 type InstallationRepositoriesEvent struct { 480 // The action that was performed. Can be either "added" or "removed". 481 Action *string `json:"action,omitempty"` 482 RepositoriesAdded []*Repository `json:"repositories_added,omitempty"` 483 RepositoriesRemoved []*Repository `json:"repositories_removed,omitempty"` 484 RepositorySelection *string `json:"repository_selection,omitempty"` 485 Sender *User `json:"sender,omitempty"` 486 Installation *Installation `json:"installation,omitempty"` 487 } 488 489 // IssueCommentEvent is triggered when an issue comment is created on an issue 490 // or pull request. 491 // The Webhook event name is "issue_comment". 492 // 493 // GitHub API docs: https://docs.github.com/en/developers/webhooks-and-events/webhook-events-and-payloads#issue_comment 494 type IssueCommentEvent struct { 495 // Action is the action that was performed on the comment. 496 // Possible values are: "created", "edited", "deleted". 497 Action *string `json:"action,omitempty"` 498 Issue *Issue `json:"issue,omitempty"` 499 Comment *IssueComment `json:"comment,omitempty"` 500 501 // The following fields are only populated by Webhook events. 502 Changes *EditChange `json:"changes,omitempty"` 503 Repo *Repository `json:"repository,omitempty"` 504 Sender *User `json:"sender,omitempty"` 505 Installation *Installation `json:"installation,omitempty"` 506 507 // The following field is only present when the webhook is triggered on 508 // a repository belonging to an organization. 509 Organization *Organization `json:"organization,omitempty"` 510 } 511 512 // IssuesEvent is triggered when an issue is opened, edited, deleted, transferred, 513 // pinned, unpinned, closed, reopened, assigned, unassigned, labeled, unlabeled, 514 // locked, unlocked, milestoned, or demilestoned. 515 // The Webhook event name is "issues". 516 // 517 // GitHub API docs: https://docs.github.com/en/developers/webhooks-and-events/webhook-events-and-payloads#issues 518 type IssuesEvent struct { 519 // Action is the action that was performed. Possible values are: "opened", 520 // "edited", "deleted", "transferred", "pinned", "unpinned", "closed", "reopened", 521 // "assigned", "unassigned", "labeled", "unlabeled", "locked", "unlocked", 522 // "milestoned", or "demilestoned". 523 Action *string `json:"action,omitempty"` 524 Issue *Issue `json:"issue,omitempty"` 525 Assignee *User `json:"assignee,omitempty"` 526 Label *Label `json:"label,omitempty"` 527 528 // The following fields are only populated by Webhook events. 529 Changes *EditChange `json:"changes,omitempty"` 530 Repo *Repository `json:"repository,omitempty"` 531 Sender *User `json:"sender,omitempty"` 532 Installation *Installation `json:"installation,omitempty"` 533 Milestone *Milestone `json:"milestone,omitempty"` 534 } 535 536 // LabelEvent is triggered when a repository's label is created, edited, or deleted. 537 // The Webhook event name is "label" 538 // 539 // GitHub API docs: https://docs.github.com/en/developers/webhooks-and-events/webhook-events-and-payloads#label 540 type LabelEvent struct { 541 // Action is the action that was performed. Possible values are: 542 // "created", "edited", "deleted" 543 Action *string `json:"action,omitempty"` 544 Label *Label `json:"label,omitempty"` 545 Changes *EditChange `json:"changes,omitempty"` 546 547 // The following fields are only populated by Webhook events. 548 Repo *Repository `json:"repository,omitempty"` 549 Org *Organization `json:"organization,omitempty"` 550 Sender *User `json:"sender,omitempty"` 551 Installation *Installation `json:"installation,omitempty"` 552 } 553 554 // MarketplacePurchaseEvent is triggered when a user purchases, cancels, or changes 555 // their GitHub Marketplace plan. 556 // Webhook event name "marketplace_purchase". 557 // 558 // GitHub API docs: https://docs.github.com/en/developers/webhooks-and-events/webhook-events-and-payloads#marketplace_purchase 559 type MarketplacePurchaseEvent struct { 560 // Action is the action that was performed. Possible values are: 561 // "purchased", "cancelled", "pending_change", "pending_change_cancelled", "changed". 562 Action *string `json:"action,omitempty"` 563 564 // The following fields are only populated by Webhook events. 565 EffectiveDate *Timestamp `json:"effective_date,omitempty"` 566 MarketplacePurchase *MarketplacePurchase `json:"marketplace_purchase,omitempty"` 567 PreviousMarketplacePurchase *MarketplacePurchase `json:"previous_marketplace_purchase,omitempty"` 568 Sender *User `json:"sender,omitempty"` 569 Installation *Installation `json:"installation,omitempty"` 570 } 571 572 // MemberEvent is triggered when a user is added as a collaborator to a repository. 573 // The Webhook event name is "member". 574 // 575 // GitHub API docs: https://docs.github.com/en/developers/webhooks-and-events/webhook-events-and-payloads#member 576 type MemberEvent struct { 577 // Action is the action that was performed. Possible value is: "added". 578 Action *string `json:"action,omitempty"` 579 Member *User `json:"member,omitempty"` 580 581 // The following fields are only populated by Webhook events. 582 Repo *Repository `json:"repository,omitempty"` 583 Sender *User `json:"sender,omitempty"` 584 Installation *Installation `json:"installation,omitempty"` 585 } 586 587 // MembershipEvent is triggered when a user is added or removed from a team. 588 // The Webhook event name is "membership". 589 // 590 // Events of this type are not visible in timelines, they are only used to 591 // trigger organization webhooks. 592 // 593 // GitHub API docs: https://docs.github.com/en/developers/webhooks-and-events/webhook-events-and-payloads#membership 594 type MembershipEvent struct { 595 // Action is the action that was performed. Possible values are: "added", "removed". 596 Action *string `json:"action,omitempty"` 597 // Scope is the scope of the membership. Possible value is: "team". 598 Scope *string `json:"scope,omitempty"` 599 Member *User `json:"member,omitempty"` 600 Team *Team `json:"team,omitempty"` 601 602 // The following fields are only populated by Webhook events. 603 Org *Organization `json:"organization,omitempty"` 604 Sender *User `json:"sender,omitempty"` 605 Installation *Installation `json:"installation,omitempty"` 606 } 607 608 // MergeGroup represents the merge group in a merge queue. 609 type MergeGroup struct { 610 // The SHA of the merge group. 611 HeadSHA *string `json:"head_sha,omitempty"` 612 // The full ref of the merge group. 613 HeadRef *string `json:"head_ref,omitempty"` 614 // The SHA of the merge group's parent commit. 615 BaseSHA *string `json:"base_sha,omitempty"` 616 // The full ref of the branch the merge group will be merged into. 617 BaseRef *string `json:"base_ref,omitempty"` 618 // An expanded representation of the head_sha commit. 619 HeadCommit *Commit `json:"head_commit,omitempty"` 620 } 621 622 // MergeGroupEvent represents activity related to merge groups in a merge queue. The type of activity is specified 623 // in the action property of the payload object. 624 // 625 // GitHub API docs: https://docs.github.com/en/developers/webhooks-and-events/webhook-events-and-payloads#merge_group 626 type MergeGroupEvent struct { 627 // The action that was performed. Currently, can only be checks_requested. 628 Action *string `json:"action,omitempty"` 629 // The merge group. 630 MergeGroup *MergeGroup `json:"merge_group,omitempty"` 631 632 // The following fields are only populated by Webhook events. 633 Repo *Repository `json:"repository,omitempty"` 634 Org *Organization `json:"organization,omitempty"` 635 Installation *Installation `json:"installation,omitempty"` 636 Sender *User `json:"sender,omitempty"` 637 } 638 639 // MetaEvent is triggered when the webhook that this event is configured on is deleted. 640 // This event will only listen for changes to the particular hook the event is installed on. 641 // Therefore, it must be selected for each hook that you'd like to receive meta events for. 642 // The Webhook event name is "meta". 643 // 644 // GitHub API docs: https://docs.github.com/en/developers/webhooks-and-events/webhook-events-and-payloads#meta 645 type MetaEvent struct { 646 // Action is the action that was performed. Possible value is: "deleted". 647 Action *string `json:"action,omitempty"` 648 // The ID of the modified webhook. 649 HookID *int64 `json:"hook_id,omitempty"` 650 // The modified webhook. 651 // This will contain different keys based on the type of webhook it is: repository, 652 // organization, business, app, or GitHub Marketplace. 653 Hook *Hook `json:"hook,omitempty"` 654 655 // The following fields are only populated by Webhook events. 656 Repo *Repository `json:"repository,omitempty"` 657 Org *Organization `json:"organization,omitempty"` 658 Sender *User `json:"sender,omitempty"` 659 Installation *Installation `json:"installation,omitempty"` 660 } 661 662 // MilestoneEvent is triggered when a milestone is created, closed, opened, edited, or deleted. 663 // The Webhook event name is "milestone". 664 // 665 // GitHub API docs: https://docs.github.com/en/developers/webhooks-and-events/webhook-events-and-payloads#milestone 666 type MilestoneEvent struct { 667 // Action is the action that was performed. Possible values are: 668 // "created", "closed", "opened", "edited", "deleted" 669 Action *string `json:"action,omitempty"` 670 Milestone *Milestone `json:"milestone,omitempty"` 671 672 // The following fields are only populated by Webhook events. 673 Changes *EditChange `json:"changes,omitempty"` 674 Repo *Repository `json:"repository,omitempty"` 675 Sender *User `json:"sender,omitempty"` 676 Org *Organization `json:"organization,omitempty"` 677 Installation *Installation `json:"installation,omitempty"` 678 } 679 680 // OrganizationEvent is triggered when an organization is deleted and renamed, and when a user is added, 681 // removed, or invited to an organization. 682 // Events of this type are not visible in timelines. These events are only used to trigger organization hooks. 683 // Webhook event name is "organization". 684 // 685 // GitHub API docs: https://docs.github.com/en/developers/webhooks-and-events/webhook-events-and-payloads#organization 686 type OrganizationEvent struct { 687 // Action is the action that was performed. 688 // Possible values are: "deleted", "renamed", "member_added", "member_removed", or "member_invited". 689 Action *string `json:"action,omitempty"` 690 691 // Invitation is the invitation for the user or email if the action is "member_invited". 692 Invitation *Invitation `json:"invitation,omitempty"` 693 694 // Membership is the membership between the user and the organization. 695 // Not present when the action is "member_invited". 696 Membership *Membership `json:"membership,omitempty"` 697 698 Organization *Organization `json:"organization,omitempty"` 699 Sender *User `json:"sender,omitempty"` 700 Installation *Installation `json:"installation,omitempty"` 701 } 702 703 // OrgBlockEvent is triggered when an organization blocks or unblocks a user. 704 // The Webhook event name is "org_block". 705 // 706 // GitHub API docs: https://docs.github.com/en/developers/webhooks-and-events/webhook-events-and-payloads#org_block 707 type OrgBlockEvent struct { 708 // Action is the action that was performed. 709 // Can be "blocked" or "unblocked". 710 Action *string `json:"action,omitempty"` 711 BlockedUser *User `json:"blocked_user,omitempty"` 712 Organization *Organization `json:"organization,omitempty"` 713 Sender *User `json:"sender,omitempty"` 714 715 // The following fields are only populated by Webhook events. 716 Installation *Installation `json:"installation,omitempty"` 717 } 718 719 // PackageEvent represents activity related to GitHub Packages. 720 // The Webhook event name is "package". 721 // 722 // This event is triggered when a GitHub Package is published or updated. 723 // 724 // GitHub API docs: https://developer.github.com/webhooks/event-payloads/#package 725 type PackageEvent struct { 726 // Action is the action that was performed. 727 // Can be "published" or "updated". 728 Action *string `json:"action,omitempty"` 729 Package *Package `json:"package,omitempty"` 730 Repo *Repository `json:"repository,omitempty"` 731 Org *Organization `json:"organization,omitempty"` 732 Sender *User `json:"sender,omitempty"` 733 734 // The following fields are only populated by Webhook events. 735 Installation *Installation `json:"installation,omitempty"` 736 } 737 738 // PageBuildEvent represents an attempted build of a GitHub Pages site, whether 739 // successful or not. 740 // The Webhook event name is "page_build". 741 // 742 // This event is triggered on push to a GitHub Pages enabled branch (gh-pages 743 // for project pages, master for user and organization pages). 744 // 745 // Events of this type are not visible in timelines, they are only used to trigger hooks. 746 // 747 // GitHub API docs: https://docs.github.com/en/developers/webhooks-and-events/webhook-events-and-payloads#page_build 748 type PageBuildEvent struct { 749 Build *PagesBuild `json:"build,omitempty"` 750 751 // The following fields are only populated by Webhook events. 752 ID *int64 `json:"id,omitempty"` 753 Repo *Repository `json:"repository,omitempty"` 754 Sender *User `json:"sender,omitempty"` 755 Installation *Installation `json:"installation,omitempty"` 756 } 757 758 // PingEvent is triggered when a Webhook is added to GitHub. 759 // 760 // GitHub API docs: https://developer.github.com/webhooks/#ping-event 761 type PingEvent struct { 762 // Random string of GitHub zen. 763 Zen *string `json:"zen,omitempty"` 764 // The ID of the webhook that triggered the ping. 765 HookID *int64 `json:"hook_id,omitempty"` 766 // The webhook configuration. 767 Hook *Hook `json:"hook,omitempty"` 768 769 // The following fields are only populated by Webhook events. 770 Repo *Repository `json:"repository,omitempty"` 771 Org *Organization `json:"organization,omitempty"` 772 Sender *User `json:"sender,omitempty"` 773 Installation *Installation `json:"installation,omitempty"` 774 } 775 776 // ProjectEvent is triggered when project is created, modified or deleted. 777 // The webhook event name is "project". 778 // 779 // GitHub API docs: https://docs.github.com/en/developers/webhooks-and-events/webhook-events-and-payloads#project 780 type ProjectEvent struct { 781 Action *string `json:"action,omitempty"` 782 Changes *ProjectChange `json:"changes,omitempty"` 783 Project *Project `json:"project,omitempty"` 784 785 // The following fields are only populated by Webhook events. 786 Repo *Repository `json:"repository,omitempty"` 787 Org *Organization `json:"organization,omitempty"` 788 Sender *User `json:"sender,omitempty"` 789 Installation *Installation `json:"installation,omitempty"` 790 } 791 792 // ProjectCardEvent is triggered when a project card is created, updated, moved, converted to an issue, or deleted. 793 // The webhook event name is "project_card". 794 // 795 // GitHub API docs: https://docs.github.com/en/developers/webhooks-and-events/webhook-events-and-payloads#project_card 796 type ProjectCardEvent struct { 797 Action *string `json:"action,omitempty"` 798 Changes *ProjectCardChange `json:"changes,omitempty"` 799 AfterID *int64 `json:"after_id,omitempty"` 800 ProjectCard *ProjectCard `json:"project_card,omitempty"` 801 802 // The following fields are only populated by Webhook events. 803 Repo *Repository `json:"repository,omitempty"` 804 Org *Organization `json:"organization,omitempty"` 805 Sender *User `json:"sender,omitempty"` 806 Installation *Installation `json:"installation,omitempty"` 807 } 808 809 // ProjectColumnEvent is triggered when a project column is created, updated, moved, or deleted. 810 // The webhook event name is "project_column". 811 // 812 // GitHub API docs: https://docs.github.com/en/developers/webhooks-and-events/webhook-events-and-payloads#project_column 813 type ProjectColumnEvent struct { 814 Action *string `json:"action,omitempty"` 815 Changes *ProjectColumnChange `json:"changes,omitempty"` 816 AfterID *int64 `json:"after_id,omitempty"` 817 ProjectColumn *ProjectColumn `json:"project_column,omitempty"` 818 819 // The following fields are only populated by Webhook events. 820 Repo *Repository `json:"repository,omitempty"` 821 Org *Organization `json:"organization,omitempty"` 822 Sender *User `json:"sender,omitempty"` 823 Installation *Installation `json:"installation,omitempty"` 824 } 825 826 // PublicEvent is triggered when a private repository is open sourced. 827 // According to GitHub: "Without a doubt: the best GitHub event." 828 // The Webhook event name is "public". 829 // 830 // GitHub API docs: https://docs.github.com/en/developers/webhooks-and-events/webhook-events-and-payloads#public 831 type PublicEvent struct { 832 // The following fields are only populated by Webhook events. 833 Repo *Repository `json:"repository,omitempty"` 834 Sender *User `json:"sender,omitempty"` 835 Installation *Installation `json:"installation,omitempty"` 836 } 837 838 // PullRequestEvent is triggered when a pull request is assigned, unassigned, labeled, 839 // unlabeled, opened, edited, closed, reopened, synchronize, ready_for_review, 840 // locked, unlocked, a pull request review is requested, or a review request is removed. 841 // The Webhook event name is "pull_request". 842 // 843 // GitHub API docs: https://docs.github.com/en/developers/webhooks-and-events/github-event-types#pullrequestevent 844 type PullRequestEvent struct { 845 // Action is the action that was performed. Possible values are: 846 // "assigned", "unassigned", "review_requested", "review_request_removed", "labeled", "unlabeled", 847 // "opened", "edited", "closed", "ready_for_review", "locked", "unlocked", or "reopened". 848 // If the action is "closed" and the "merged" key is "false", the pull request was closed with unmerged commits. 849 // If the action is "closed" and the "merged" key is "true", the pull request was merged. 850 // While webhooks are also triggered when a pull request is synchronized, Events API timelines 851 // don't include pull request events with the "synchronize" action. 852 Action *string `json:"action,omitempty"` 853 Assignee *User `json:"assignee,omitempty"` 854 Number *int `json:"number,omitempty"` 855 PullRequest *PullRequest `json:"pull_request,omitempty"` 856 857 // The following fields are only populated by Webhook events. 858 Changes *EditChange `json:"changes,omitempty"` 859 // RequestedReviewer is populated in "review_requested", "review_request_removed" event deliveries. 860 // A request affecting multiple reviewers at once is split into multiple 861 // such event deliveries, each with a single, different RequestedReviewer. 862 RequestedReviewer *User `json:"requested_reviewer,omitempty"` 863 // In the event that a team is requested instead of a user, "requested_team" gets sent in place of 864 // "requested_user" with the same delivery behavior. 865 RequestedTeam *Team `json:"requested_team,omitempty"` 866 Repo *Repository `json:"repository,omitempty"` 867 Sender *User `json:"sender,omitempty"` 868 Installation *Installation `json:"installation,omitempty"` 869 Label *Label `json:"label,omitempty"` // Populated in "labeled" event deliveries. 870 871 // The following field is only present when the webhook is triggered on 872 // a repository belonging to an organization. 873 Organization *Organization `json:"organization,omitempty"` 874 875 // The following fields are only populated when the Action is "synchronize". 876 Before *string `json:"before,omitempty"` 877 After *string `json:"after,omitempty"` 878 } 879 880 // PullRequestReviewEvent is triggered when a review is submitted on a pull 881 // request. 882 // The Webhook event name is "pull_request_review". 883 // 884 // GitHub API docs: https://docs.github.com/en/developers/webhooks-and-events/webhook-events-and-payloads#pull_request_review 885 type PullRequestReviewEvent struct { 886 // Action is always "submitted". 887 Action *string `json:"action,omitempty"` 888 Review *PullRequestReview `json:"review,omitempty"` 889 PullRequest *PullRequest `json:"pull_request,omitempty"` 890 891 // The following fields are only populated by Webhook events. 892 Repo *Repository `json:"repository,omitempty"` 893 Sender *User `json:"sender,omitempty"` 894 Installation *Installation `json:"installation,omitempty"` 895 896 // The following field is only present when the webhook is triggered on 897 // a repository belonging to an organization. 898 Organization *Organization `json:"organization,omitempty"` 899 } 900 901 // PullRequestReviewCommentEvent is triggered when a comment is created on a 902 // portion of the unified diff of a pull request. 903 // The Webhook event name is "pull_request_review_comment". 904 // 905 // GitHub API docs: https://docs.github.com/en/developers/webhooks-and-events/webhook-events-and-payloads#pull_request_review_comment 906 type PullRequestReviewCommentEvent struct { 907 // Action is the action that was performed on the comment. 908 // Possible values are: "created", "edited", "deleted". 909 Action *string `json:"action,omitempty"` 910 PullRequest *PullRequest `json:"pull_request,omitempty"` 911 Comment *PullRequestComment `json:"comment,omitempty"` 912 913 // The following fields are only populated by Webhook events. 914 Changes *EditChange `json:"changes,omitempty"` 915 Repo *Repository `json:"repository,omitempty"` 916 Sender *User `json:"sender,omitempty"` 917 Installation *Installation `json:"installation,omitempty"` 918 } 919 920 // PullRequestReviewThreadEvent is triggered when a comment made as part of a 921 // review of a pull request is marked resolved or unresolved. 922 // The Webhook event name is "pull_request_review_thread". 923 // 924 // GitHub API docs: https://docs.github.com/en/developers/webhooks-and-events/webhook-events-and-payloads#pull_request_review_thread 925 type PullRequestReviewThreadEvent struct { 926 // Action is the action that was performed on the comment. 927 // Possible values are: "resolved", "unresolved". 928 Action *string `json:"action,omitempty"` 929 Thread *PullRequestThread `json:"thread,omitempty"` 930 PullRequest *PullRequest `json:"pull_request,omitempty"` 931 932 // The following fields are only populated by Webhook events. 933 Repo *Repository `json:"repository,omitempty"` 934 Sender *User `json:"sender,omitempty"` 935 Installation *Installation `json:"installation,omitempty"` 936 } 937 938 // PullRequestTargetEvent is triggered when a pull request is assigned, unassigned, labeled, 939 // unlabeled, opened, edited, closed, reopened, synchronize, ready_for_review, 940 // locked, unlocked, a pull request review is requested, or a review request is removed. 941 // The Webhook event name is "pull_request_target". 942 // 943 // GitHub API docs: https://docs.github.com/en/actions/events-that-trigger-workflows#pull_request_target 944 type PullRequestTargetEvent struct { 945 // Action is the action that was performed. Possible values are: 946 // "assigned", "unassigned", "labeled", "unlabeled", "opened", "edited", "closed", "reopened", 947 // "ready_for_review", "locked", "unlocked", "review_requested" or "review_request_removed". 948 // If the action is "closed" and the "merged" key is "false", the pull request was closed with unmerged commits. 949 // If the action is "closed" and the "merged" key is "true", the pull request was merged. 950 // While webhooks are also triggered when a pull request is synchronized, Events API timelines 951 // don't include pull request events with the "synchronize" action. 952 Action *string `json:"action,omitempty"` 953 Assignee *User `json:"assignee,omitempty"` 954 Number *int `json:"number,omitempty"` 955 PullRequest *PullRequest `json:"pull_request,omitempty"` 956 957 // The following fields are only populated by Webhook events. 958 Changes *EditChange `json:"changes,omitempty"` 959 // RequestedReviewer is populated in "review_requested", "review_request_removed" event deliveries. 960 // A request affecting multiple reviewers at once is split into multiple 961 // such event deliveries, each with a single, different RequestedReviewer. 962 RequestedReviewer *User `json:"requested_reviewer,omitempty"` 963 // In the event that a team is requested instead of a user, "requested_team" gets sent in place of 964 // "requested_user" with the same delivery behavior. 965 RequestedTeam *Team `json:"requested_team,omitempty"` 966 Repo *Repository `json:"repository,omitempty"` 967 Sender *User `json:"sender,omitempty"` 968 Installation *Installation `json:"installation,omitempty"` 969 Label *Label `json:"label,omitempty"` // Populated in "labeled" event deliveries. 970 971 // The following field is only present when the webhook is triggered on 972 // a repository belonging to an organization. 973 Organization *Organization `json:"organization,omitempty"` 974 975 // The following fields are only populated when the Action is "synchronize". 976 Before *string `json:"before,omitempty"` 977 After *string `json:"after,omitempty"` 978 } 979 980 // PushEvent represents a git push to a GitHub repository. 981 // 982 // GitHub API docs: https://docs.github.com/en/developers/webhooks-and-events/webhook-events-and-payloads#push 983 type PushEvent struct { 984 PushID *int64 `json:"push_id,omitempty"` 985 Head *string `json:"head,omitempty"` 986 Ref *string `json:"ref,omitempty"` 987 Size *int `json:"size,omitempty"` 988 Commits []*HeadCommit `json:"commits,omitempty"` 989 Before *string `json:"before,omitempty"` 990 DistinctSize *int `json:"distinct_size,omitempty"` 991 992 // The following fields are only populated by Webhook events. 993 Action *string `json:"action,omitempty"` 994 After *string `json:"after,omitempty"` 995 Created *bool `json:"created,omitempty"` 996 Deleted *bool `json:"deleted,omitempty"` 997 Forced *bool `json:"forced,omitempty"` 998 BaseRef *string `json:"base_ref,omitempty"` 999 Compare *string `json:"compare,omitempty"` 1000 Repo *PushEventRepository `json:"repository,omitempty"` 1001 HeadCommit *HeadCommit `json:"head_commit,omitempty"` 1002 Pusher *User `json:"pusher,omitempty"` 1003 Sender *User `json:"sender,omitempty"` 1004 Installation *Installation `json:"installation,omitempty"` 1005 1006 // The following field is only present when the webhook is triggered on 1007 // a repository belonging to an organization. 1008 Organization *Organization `json:"organization,omitempty"` 1009 } 1010 1011 func (p PushEvent) String() string { 1012 return Stringify(p) 1013 } 1014 1015 // HeadCommit represents a git commit in a GitHub PushEvent. 1016 type HeadCommit struct { 1017 Message *string `json:"message,omitempty"` 1018 Author *CommitAuthor `json:"author,omitempty"` 1019 URL *string `json:"url,omitempty"` 1020 Distinct *bool `json:"distinct,omitempty"` 1021 1022 // The following fields are only populated by Events API. 1023 SHA *string `json:"sha,omitempty"` 1024 1025 // The following fields are only populated by Webhook events. 1026 ID *string `json:"id,omitempty"` 1027 TreeID *string `json:"tree_id,omitempty"` 1028 Timestamp *Timestamp `json:"timestamp,omitempty"` 1029 Committer *CommitAuthor `json:"committer,omitempty"` 1030 Added []string `json:"added,omitempty"` 1031 Removed []string `json:"removed,omitempty"` 1032 Modified []string `json:"modified,omitempty"` 1033 } 1034 1035 func (h HeadCommit) String() string { 1036 return Stringify(h) 1037 } 1038 1039 // PushEventRepository represents the repo object in a PushEvent payload. 1040 type PushEventRepository struct { 1041 ID *int64 `json:"id,omitempty"` 1042 NodeID *string `json:"node_id,omitempty"` 1043 Name *string `json:"name,omitempty"` 1044 FullName *string `json:"full_name,omitempty"` 1045 Owner *User `json:"owner,omitempty"` 1046 Private *bool `json:"private,omitempty"` 1047 Description *string `json:"description,omitempty"` 1048 Fork *bool `json:"fork,omitempty"` 1049 CreatedAt *Timestamp `json:"created_at,omitempty"` 1050 PushedAt *Timestamp `json:"pushed_at,omitempty"` 1051 UpdatedAt *Timestamp `json:"updated_at,omitempty"` 1052 Homepage *string `json:"homepage,omitempty"` 1053 PullsURL *string `json:"pulls_url,omitempty"` 1054 Size *int `json:"size,omitempty"` 1055 StargazersCount *int `json:"stargazers_count,omitempty"` 1056 WatchersCount *int `json:"watchers_count,omitempty"` 1057 Language *string `json:"language,omitempty"` 1058 HasIssues *bool `json:"has_issues,omitempty"` 1059 HasDownloads *bool `json:"has_downloads,omitempty"` 1060 HasWiki *bool `json:"has_wiki,omitempty"` 1061 HasPages *bool `json:"has_pages,omitempty"` 1062 ForksCount *int `json:"forks_count,omitempty"` 1063 Archived *bool `json:"archived,omitempty"` 1064 Disabled *bool `json:"disabled,omitempty"` 1065 OpenIssuesCount *int `json:"open_issues_count,omitempty"` 1066 DefaultBranch *string `json:"default_branch,omitempty"` 1067 MasterBranch *string `json:"master_branch,omitempty"` 1068 Organization *string `json:"organization,omitempty"` 1069 URL *string `json:"url,omitempty"` 1070 ArchiveURL *string `json:"archive_url,omitempty"` 1071 HTMLURL *string `json:"html_url,omitempty"` 1072 StatusesURL *string `json:"statuses_url,omitempty"` 1073 GitURL *string `json:"git_url,omitempty"` 1074 SSHURL *string `json:"ssh_url,omitempty"` 1075 CloneURL *string `json:"clone_url,omitempty"` 1076 SVNURL *string `json:"svn_url,omitempty"` 1077 Topics []string `json:"topics,omitempty"` 1078 } 1079 1080 // PushEventRepoOwner is a basic representation of user/org in a PushEvent payload. 1081 type PushEventRepoOwner struct { 1082 Name *string `json:"name,omitempty"` 1083 Email *string `json:"email,omitempty"` 1084 } 1085 1086 // ReleaseEvent is triggered when a release is published, unpublished, created, 1087 // edited, deleted, or prereleased. 1088 // The Webhook event name is "release". 1089 // 1090 // GitHub API docs: https://docs.github.com/en/developers/webhooks-and-events/webhook-events-and-payloads#release 1091 type ReleaseEvent struct { 1092 // Action is the action that was performed. Possible values are: "published", "unpublished", 1093 // "created", "edited", "deleted", or "prereleased". 1094 Action *string `json:"action,omitempty"` 1095 Release *RepositoryRelease `json:"release,omitempty"` 1096 1097 // The following fields are only populated by Webhook events. 1098 Repo *Repository `json:"repository,omitempty"` 1099 Sender *User `json:"sender,omitempty"` 1100 Installation *Installation `json:"installation,omitempty"` 1101 } 1102 1103 // RepositoryEvent is triggered when a repository is created, archived, unarchived, 1104 // renamed, edited, transferred, made public, or made private. Organization hooks are 1105 // also trigerred when a repository is deleted. 1106 // The Webhook event name is "repository". 1107 // 1108 // Events of this type are not visible in timelines, they are only used to 1109 // trigger organization webhooks. 1110 // 1111 // GitHub API docs: https://docs.github.com/en/developers/webhooks-and-events/webhook-events-and-payloads#repository 1112 type RepositoryEvent struct { 1113 // Action is the action that was performed. Possible values are: "created", 1114 // "deleted" (organization hooks only), "archived", "unarchived", "edited", "renamed", 1115 // "transferred", "publicized", or "privatized". 1116 Action *string `json:"action,omitempty"` 1117 Repo *Repository `json:"repository,omitempty"` 1118 1119 // The following fields are only populated by Webhook events. 1120 Changes *EditChange `json:"changes,omitempty"` 1121 Org *Organization `json:"organization,omitempty"` 1122 Sender *User `json:"sender,omitempty"` 1123 Installation *Installation `json:"installation,omitempty"` 1124 } 1125 1126 // RepositoryDispatchEvent is triggered when a client sends a POST request to the repository dispatch event endpoint. 1127 // 1128 // GitHub API docs: https://docs.github.com/en/developers/webhooks-and-events/webhook-events-and-payloads#repository_dispatch 1129 type RepositoryDispatchEvent struct { 1130 // Action is the event_type that submitted with the repository dispatch payload. Value can be any string. 1131 Action *string `json:"action,omitempty"` 1132 Branch *string `json:"branch,omitempty"` 1133 ClientPayload json.RawMessage `json:"client_payload,omitempty"` 1134 Repo *Repository `json:"repository,omitempty"` 1135 1136 // The following fields are only populated by Webhook events. 1137 Org *Organization `json:"organization,omitempty"` 1138 Sender *User `json:"sender,omitempty"` 1139 Installation *Installation `json:"installation,omitempty"` 1140 } 1141 1142 // RepositoryImportEvent represents the activity related to a repository being imported to GitHub. 1143 // 1144 // GitHub API docs: https://docs.github.com/en/developers/webhooks-and-events/webhooks/webhook-events-and-payloads#repository_import 1145 type RepositoryImportEvent struct { 1146 // Status represents the final state of the import. This can be one of "success", "cancelled", or "failure". 1147 Status *string `json:"status,omitempty"` 1148 Repo *Repository `json:"repository,omitempty"` 1149 Org *Organization `json:"organization,omitempty"` 1150 Sender *User `json:"sender,omitempty"` 1151 } 1152 1153 // RepositoryVulnerabilityAlertEvent is triggered when a security alert is created, dismissed, or resolved. 1154 // 1155 // GitHub API docs: https://docs.github.com/en/developers/webhooks-and-events/webhook-events-and-payloads#repository_vulnerability_alert 1156 type RepositoryVulnerabilityAlertEvent struct { 1157 // Action is the action that was performed. Possible values are: "create", "dismiss", "resolve". 1158 Action *string `json:"action,omitempty"` 1159 1160 // The security alert of the vulnerable dependency. 1161 Alert *RepositoryVulnerabilityAlert `json:"alert,omitempty"` 1162 1163 // The repository of the vulnerable dependency. 1164 Repository *Repository `json:"repository,omitempty"` 1165 1166 // The following fields are only populated by Webhook events. 1167 Installation *Installation `json:"installation,omitempty"` 1168 1169 // The user that triggered the event. 1170 Sender *User `json:"sender,omitempty"` 1171 } 1172 1173 // RepositoryVulnerabilityAlert represents a repository security alert. 1174 type RepositoryVulnerabilityAlert struct { 1175 ID *int64 `json:"id,omitempty"` 1176 AffectedRange *string `json:"affected_range,omitempty"` 1177 AffectedPackageName *string `json:"affected_package_name,omitempty"` 1178 ExternalReference *string `json:"external_reference,omitempty"` 1179 ExternalIdentifier *string `json:"external_identifier,omitempty"` 1180 GitHubSecurityAdvisoryID *string `json:"ghsa_id,omitempty"` 1181 Severity *string `json:"severity,omitempty"` 1182 CreatedAt *Timestamp `json:"created_at,omitempty"` 1183 FixedIn *string `json:"fixed_in,omitempty"` 1184 Dismisser *User `json:"dismisser,omitempty"` 1185 DismissReason *string `json:"dismiss_reason,omitempty"` 1186 DismissedAt *Timestamp `json:"dismissed_at,omitempty"` 1187 } 1188 1189 // SecretScanningAlertEvent is triggered when a secret scanning alert occurs in a repository. 1190 // The Webhook name is secret_scanning_alert. 1191 // 1192 // GitHub API docs: https://docs.github.com/en/developers/webhooks-and-events/webhooks/webhook-events-and-payloads#secret_scanning_alert 1193 type SecretScanningAlertEvent struct { 1194 // Action is the action that was performed. Possible values are: "created", "resolved", or "reopened". 1195 Action *string `json:"action,omitempty"` 1196 1197 // Alert is the secret scanning alert involved in the event. 1198 Alert *SecretScanningAlert `json:"alert,omitempty"` 1199 1200 // Only populated by the "resolved" and "reopen" actions 1201 Sender *User `json:"sender,omitempty"` 1202 // The following fields are only populated by Webhook events. 1203 Repo *Repository `json:"repository,omitempty"` 1204 Organization *Organization `json:"organization,omitempty"` 1205 Enterprise *Enterprise `json:"enterprise,omitempty"` 1206 Installation *Installation `json:"installation,omitempty"` 1207 } 1208 1209 // StarEvent is triggered when a star is added or removed from a repository. 1210 // The Webhook event name is "star". 1211 // 1212 // GitHub API docs: https://docs.github.com/en/developers/webhooks-and-events/webhook-events-and-payloads#star 1213 type StarEvent struct { 1214 // Action is the action that was performed. Possible values are: "created" or "deleted". 1215 Action *string `json:"action,omitempty"` 1216 1217 // StarredAt is the time the star was created. It will be null for the "deleted" action. 1218 StarredAt *Timestamp `json:"starred_at,omitempty"` 1219 1220 // The following fields are only populated by Webhook events. 1221 Org *Organization `json:"organization,omitempty"` 1222 Repo *Repository `json:"repository,omitempty"` 1223 Sender *User `json:"sender,omitempty"` 1224 Installation *Installation `json:"installation,omitempty"` 1225 } 1226 1227 // StatusEvent is triggered when the status of a Git commit changes. 1228 // The Webhook event name is "status". 1229 // 1230 // Events of this type are not visible in timelines, they are only used to 1231 // trigger hooks. 1232 // 1233 // GitHub API docs: https://docs.github.com/en/developers/webhooks-and-events/webhook-events-and-payloads#status 1234 type StatusEvent struct { 1235 SHA *string `json:"sha,omitempty"` 1236 // State is the new state. Possible values are: "pending", "success", "failure", "error". 1237 State *string `json:"state,omitempty"` 1238 Description *string `json:"description,omitempty"` 1239 TargetURL *string `json:"target_url,omitempty"` 1240 Branches []*Branch `json:"branches,omitempty"` 1241 1242 // The following fields are only populated by Webhook events. 1243 ID *int64 `json:"id,omitempty"` 1244 Name *string `json:"name,omitempty"` 1245 Context *string `json:"context,omitempty"` 1246 Commit *RepositoryCommit `json:"commit,omitempty"` 1247 CreatedAt *Timestamp `json:"created_at,omitempty"` 1248 UpdatedAt *Timestamp `json:"updated_at,omitempty"` 1249 Repo *Repository `json:"repository,omitempty"` 1250 Sender *User `json:"sender,omitempty"` 1251 Installation *Installation `json:"installation,omitempty"` 1252 } 1253 1254 // TeamEvent is triggered when an organization's team is created, modified or deleted. 1255 // The Webhook event name is "team". 1256 // 1257 // Events of this type are not visible in timelines. These events are only used 1258 // to trigger hooks. 1259 // 1260 // GitHub API docs: https://docs.github.com/en/developers/webhooks-and-events/webhook-events-and-payloads#team 1261 type TeamEvent struct { 1262 Action *string `json:"action,omitempty"` 1263 Team *Team `json:"team,omitempty"` 1264 Changes *TeamChange `json:"changes,omitempty"` 1265 Repo *Repository `json:"repository,omitempty"` 1266 1267 // The following fields are only populated by Webhook events. 1268 Org *Organization `json:"organization,omitempty"` 1269 Sender *User `json:"sender,omitempty"` 1270 Installation *Installation `json:"installation,omitempty"` 1271 } 1272 1273 // TeamAddEvent is triggered when a repository is added to a team. 1274 // The Webhook event name is "team_add". 1275 // 1276 // Events of this type are not visible in timelines. These events are only used 1277 // to trigger hooks. 1278 // 1279 // GitHub API docs: https://docs.github.com/en/developers/webhooks-and-events/webhook-events-and-payloads#team_add 1280 type TeamAddEvent struct { 1281 Team *Team `json:"team,omitempty"` 1282 Repo *Repository `json:"repository,omitempty"` 1283 1284 // The following fields are only populated by Webhook events. 1285 Org *Organization `json:"organization,omitempty"` 1286 Sender *User `json:"sender,omitempty"` 1287 Installation *Installation `json:"installation,omitempty"` 1288 } 1289 1290 // UserEvent is triggered when a user is created or deleted. 1291 // The Webhook event name is "user". 1292 // 1293 // Only global webhooks can subscribe to this event type. 1294 // 1295 // GitHub API docs: https://developer.github.com/enterprise/v3/activity/events/types/#userevent-enterprise 1296 type UserEvent struct { 1297 User *User `json:"user,omitempty"` 1298 // The action performed. Possible values are: "created" or "deleted". 1299 Action *string `json:"action,omitempty"` 1300 Enterprise *Enterprise `json:"enterprise,omitempty"` 1301 Sender *User `json:"sender,omitempty"` 1302 1303 // The following fields are only populated by Webhook events. 1304 Installation *Installation `json:"installation,omitempty"` 1305 } 1306 1307 // WatchEvent is related to starring a repository, not watching. See this API 1308 // blog post for an explanation: https://developer.github.com/changes/2012-09-05-watcher-api/ 1309 // 1310 // The event’s actor is the user who starred a repository, and the event’s 1311 // repository is the repository that was starred. 1312 // 1313 // GitHub API docs: https://docs.github.com/en/developers/webhooks-and-events/webhook-events-and-payloads#watch 1314 type WatchEvent struct { 1315 // Action is the action that was performed. Possible value is: "started". 1316 Action *string `json:"action,omitempty"` 1317 1318 // The following fields are only populated by Webhook events. 1319 Repo *Repository `json:"repository,omitempty"` 1320 Sender *User `json:"sender,omitempty"` 1321 Installation *Installation `json:"installation,omitempty"` 1322 } 1323 1324 // WorkflowDispatchEvent is triggered when someone triggers a workflow run on GitHub or 1325 // sends a POST request to the create a workflow dispatch event endpoint. 1326 // 1327 // GitHub API docs: https://docs.github.com/en/developers/webhooks-and-events/webhook-events-and-payloads#workflow_dispatch 1328 type WorkflowDispatchEvent struct { 1329 Inputs json.RawMessage `json:"inputs,omitempty"` 1330 Ref *string `json:"ref,omitempty"` 1331 Workflow *string `json:"workflow,omitempty"` 1332 1333 // The following fields are only populated by Webhook events. 1334 Repo *Repository `json:"repository,omitempty"` 1335 Org *Organization `json:"organization,omitempty"` 1336 Sender *User `json:"sender,omitempty"` 1337 Installation *Installation `json:"installation,omitempty"` 1338 } 1339 1340 // WorkflowJobEvent is triggered when a job is queued, started or completed. 1341 // 1342 // GitHub API docs: https://docs.github.com/en/developers/webhooks-and-events/webhooks/webhook-events-and-payloads#workflow_job 1343 type WorkflowJobEvent struct { 1344 WorkflowJob *WorkflowJob `json:"workflow_job,omitempty"` 1345 1346 Action *string `json:"action,omitempty"` 1347 1348 // The following fields are only populated by Webhook events. 1349 1350 // Org is not nil when the webhook is configured for an organization or the event 1351 // occurs from activity in a repository owned by an organization. 1352 Org *Organization `json:"organization,omitempty"` 1353 Repo *Repository `json:"repository,omitempty"` 1354 Sender *User `json:"sender,omitempty"` 1355 Installation *Installation `json:"installation,omitempty"` 1356 } 1357 1358 // WorkflowRunEvent is triggered when a GitHub Actions workflow run is requested or completed. 1359 // 1360 // GitHub API docs: https://docs.github.com/en/developers/webhooks-and-events/webhook-events-and-payloads#workflow_run 1361 type WorkflowRunEvent struct { 1362 Action *string `json:"action,omitempty"` 1363 Workflow *Workflow `json:"workflow,omitempty"` 1364 WorkflowRun *WorkflowRun `json:"workflow_run,omitempty"` 1365 1366 // The following fields are only populated by Webhook events. 1367 Org *Organization `json:"organization,omitempty"` 1368 Repo *Repository `json:"repository,omitempty"` 1369 Sender *User `json:"sender,omitempty"` 1370 Installation *Installation `json:"installation,omitempty"` 1371 } 1372 1373 // SecurityAdvisory represents the advisory object in SecurityAdvisoryEvent payload. 1374 // 1375 // GitHub API docs: https://docs.github.com/en/developers/webhooks-and-events/webhooks/webhook-events-and-payloads#security_advisory 1376 type SecurityAdvisory struct { 1377 GHSAID *string `json:"ghsa_id,omitempty"` 1378 Summary *string `json:"summary,omitempty"` 1379 Description *string `json:"description,omitempty"` 1380 Severity *string `json:"severity,omitempty"` 1381 Identifiers []*AdvisoryIdentifier `json:"identifiers,omitempty"` 1382 References []*AdvisoryReference `json:"references,omitempty"` 1383 PublishedAt *Timestamp `json:"published_at,omitempty"` 1384 UpdatedAt *Timestamp `json:"updated_at,omitempty"` 1385 WithdrawnAt *Timestamp `json:"withdrawn_at,omitempty"` 1386 Vulnerabilities []*AdvisoryVulnerability `json:"vulnerabilities,omitempty"` 1387 } 1388 1389 // AdvisoryIdentifier represents the identifier for a Security Advisory. 1390 type AdvisoryIdentifier struct { 1391 Value *string `json:"value,omitempty"` 1392 Type *string `json:"type,omitempty"` 1393 } 1394 1395 // AdvisoryReference represents the reference url for the security advisory. 1396 type AdvisoryReference struct { 1397 URL *string `json:"url,omitempty"` 1398 } 1399 1400 // AdvisoryVulnerability represents the vulnerability object for a Security Advisory. 1401 type AdvisoryVulnerability struct { 1402 Package *VulnerabilityPackage `json:"package,omitempty"` 1403 Severity *string `json:"severity,omitempty"` 1404 VulnerableVersionRange *string `json:"vulnerable_version_range,omitempty"` 1405 FirstPatchedVersion *FirstPatchedVersion `json:"first_patched_version,omitempty"` 1406 } 1407 1408 // VulnerabilityPackage represents the package object for an Advisory Vulnerability. 1409 type VulnerabilityPackage struct { 1410 Ecosystem *string `json:"ecosystem,omitempty"` 1411 Name *string `json:"name,omitempty"` 1412 } 1413 1414 // FirstPatchedVersion represents the identifier for the first patched version of that vulnerability. 1415 type FirstPatchedVersion struct { 1416 Identifier *string `json:"identifier,omitempty"` 1417 } 1418 1419 // SecurityAdvisoryEvent is triggered when a security-related vulnerability is found in software on GitHub. 1420 // 1421 // GitHub API docs: https://docs.github.com/en/developers/webhooks-and-events/webhooks/webhook-events-and-payloads#security_advisory 1422 type SecurityAdvisoryEvent struct { 1423 Action *string `json:"action,omitempty"` 1424 SecurityAdvisory *SecurityAdvisory `json:"security_advisory,omitempty"` 1425 } 1426 1427 // CodeScanningAlertEvent is triggered when a code scanning finds a potential vulnerability or error in your code. 1428 // 1429 // GitHub API docs: https://docs.github.com/en/developers/webhooks-and-events/webhooks/webhook-events-and-payloads#code_scanning_alert 1430 type CodeScanningAlertEvent struct { 1431 Action *string `json:"action,omitempty"` 1432 Alert *Alert `json:"alert,omitempty"` 1433 Ref *string `json:"ref,omitempty"` 1434 // CommitOID is the commit SHA of the code scanning alert 1435 CommitOID *string `json:"commit_oid,omitempty"` 1436 Repo *Repository `json:"repository,omitempty"` 1437 Org *Organization `json:"organization,omitempty"` 1438 Sender *User `json:"sender,omitempty"` 1439 1440 Installation *Installation `json:"installation,omitempty"` 1441 }