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