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