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