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