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