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 8package github 9 10import "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". 14type RequestedAction struct { 15 Identifier string `json:"identifier"` // The integrator reference of the action requested by the user. 16} 17 18// CheckRunEvent is triggered when a check run is "created", "updated", or "rerequested". 19// The Webhook event name is "check_run". 20// 21// GitHub API docs: https://docs.github.com/en/free-pro-team@latest/rest/reference/activity/events/types/#checkrunevent 22type CheckRunEvent struct { 23 CheckRun *CheckRun `json:"check_run,omitempty"` 24 // The action performed. Possible values are: "created", "updated", "rerequested" or "requested_action". 25 Action *string `json:"action,omitempty"` 26 27 // The following fields are only populated by Webhook events. 28 Repo *Repository `json:"repository,omitempty"` 29 Org *Organization `json:"organization,omitempty"` 30 Sender *User `json:"sender,omitempty"` 31 Installation *Installation `json:"installation,omitempty"` 32 33 // The action requested by the user. Populated when the Action is "requested_action". 34 RequestedAction *RequestedAction `json:"requested_action,omitempty"` // 35} 36 37// CheckSuiteEvent is triggered when a check suite is "completed", "requested", or "rerequested". 38// The Webhook event name is "check_suite". 39// 40// GitHub API docs: https://docs.github.com/en/free-pro-team@latest/rest/reference/activity/events/types/#checksuiteevent 41type CheckSuiteEvent struct { 42 CheckSuite *CheckSuite `json:"check_suite,omitempty"` 43 // The action performed. Possible values are: "completed", "requested" or "rerequested". 44 Action *string `json:"action,omitempty"` 45 46 // The following fields are only populated by Webhook events. 47 Repo *Repository `json:"repository,omitempty"` 48 Org *Organization `json:"organization,omitempty"` 49 Sender *User `json:"sender,omitempty"` 50 Installation *Installation `json:"installation,omitempty"` 51} 52 53// CommitCommentEvent is triggered when a commit comment is created. 54// The Webhook event name is "commit_comment". 55// 56// GitHub API docs: https://docs.github.com/en/free-pro-team@latest/rest/reference/activity/events/types/#commitcommentevent 57type CommitCommentEvent struct { 58 Comment *RepositoryComment `json:"comment,omitempty"` 59 60 // The following fields are only populated by Webhook events. 61 Action *string `json:"action,omitempty"` 62 Repo *Repository `json:"repository,omitempty"` 63 Sender *User `json:"sender,omitempty"` 64 Installation *Installation `json:"installation,omitempty"` 65} 66 67// ContentReferenceEvent is triggered when the body or comment of an issue or 68// pull request includes a URL that matches a configured content reference 69// domain. 70// The Webhook event name is "content_reference". 71// 72// GitHub API docs: https://developer.github.com/webhooks/event-payloads/#content_reference 73type ContentReferenceEvent struct { 74 Action *string `json:"action,omitempty"` 75 ContentReference *ContentReference `json:"content_reference,omitempty"` 76 Repo *Repository `json:"repository,omitempty"` 77 Sender *User `json:"sender,omitempty"` 78 Installation *Installation `json:"installation,omitempty"` 79} 80 81// CreateEvent represents a created repository, branch, or tag. 82// The Webhook event name is "create". 83// 84// Note: webhooks will not receive this event for created repositories. 85// Additionally, webhooks will not receive this event for tags if more 86// than three tags are pushed at once. 87// 88// GitHub API docs: https://docs.github.com/en/free-pro-team@latest/rest/reference/activity/events/types/#createevent 89type CreateEvent struct { 90 Ref *string `json:"ref,omitempty"` 91 // RefType is the object that was created. Possible values are: "repository", "branch", "tag". 92 RefType *string `json:"ref_type,omitempty"` 93 MasterBranch *string `json:"master_branch,omitempty"` 94 Description *string `json:"description,omitempty"` 95 96 // The following fields are only populated by Webhook events. 97 PusherType *string `json:"pusher_type,omitempty"` 98 Repo *Repository `json:"repository,omitempty"` 99 Sender *User `json:"sender,omitempty"` 100 Installation *Installation `json:"installation,omitempty"` 101} 102 103// DeleteEvent represents a deleted branch or tag. 104// The Webhook event name is "delete". 105// 106// Note: webhooks will not receive this event for tags if more than three tags 107// are deleted at once. 108// 109// GitHub API docs: https://docs.github.com/en/free-pro-team@latest/rest/reference/activity/events/types/#deleteevent 110type DeleteEvent struct { 111 Ref *string `json:"ref,omitempty"` 112 // RefType is the object that was deleted. Possible values are: "branch", "tag". 113 RefType *string `json:"ref_type,omitempty"` 114 115 // The following fields are only populated by Webhook events. 116 PusherType *string `json:"pusher_type,omitempty"` 117 Repo *Repository `json:"repository,omitempty"` 118 Sender *User `json:"sender,omitempty"` 119 Installation *Installation `json:"installation,omitempty"` 120} 121 122// DeployKeyEvent is triggered when a deploy key is added or removed from a repository. 123// The Webhook event name is "deploy_key". 124// 125// GitHub API docs: https://docs.github.com/en/free-pro-team@latest/rest/reference/activity/events/types/#deploykeyevent 126type DeployKeyEvent struct { 127 // Action is the action that was performed. Possible values are: 128 // "created" or "deleted". 129 Action *string `json:"action,omitempty"` 130 131 // The deploy key resource. 132 Key *Key `json:"key,omitempty"` 133} 134 135// DeploymentEvent represents a deployment. 136// The Webhook event name is "deployment". 137// 138// Events of this type are not visible in timelines, they are only used to trigger hooks. 139// 140// GitHub API docs: https://docs.github.com/en/free-pro-team@latest/rest/reference/activity/events/types/#deploymentevent 141type DeploymentEvent struct { 142 Deployment *Deployment `json:"deployment,omitempty"` 143 Repo *Repository `json:"repository,omitempty"` 144 145 // The following fields are only populated by Webhook events. 146 Sender *User `json:"sender,omitempty"` 147 Installation *Installation `json:"installation,omitempty"` 148} 149 150// DeploymentStatusEvent represents a deployment status. 151// The Webhook event name is "deployment_status". 152// 153// Events of this type are not visible in timelines, they are only used to trigger hooks. 154// 155// GitHub API docs: https://docs.github.com/en/free-pro-team@latest/rest/reference/activity/events/types/#deploymentstatusevent 156type DeploymentStatusEvent struct { 157 Deployment *Deployment `json:"deployment,omitempty"` 158 DeploymentStatus *DeploymentStatus `json:"deployment_status,omitempty"` 159 Repo *Repository `json:"repository,omitempty"` 160 161 // The following fields are only populated by Webhook events. 162 Sender *User `json:"sender,omitempty"` 163 Installation *Installation `json:"installation,omitempty"` 164} 165 166// ForkEvent is triggered when a user forks a repository. 167// The Webhook event name is "fork". 168// 169// GitHub API docs: https://docs.github.com/en/free-pro-team@latest/rest/reference/activity/events/types/#forkevent 170type ForkEvent struct { 171 // Forkee is the created repository. 172 Forkee *Repository `json:"forkee,omitempty"` 173 174 // The following fields are only populated by Webhook events. 175 Repo *Repository `json:"repository,omitempty"` 176 Sender *User `json:"sender,omitempty"` 177 Installation *Installation `json:"installation,omitempty"` 178} 179 180// GitHubAppAuthorizationEvent is triggered when a user's authorization for a 181// GitHub Application is revoked. 182// 183// GitHub API docs: https://docs.github.com/en/free-pro-team@latest/rest/reference/activity/events/types/#githubappauthorizationevent 184type GitHubAppAuthorizationEvent struct { 185 // The action performed. Possible value is: "revoked". 186 Action *string `json:"action,omitempty"` 187 188 // The following fields are only populated by Webhook events. 189 Sender *User `json:"sender,omitempty"` 190} 191 192// Page represents a single Wiki page. 193type Page struct { 194 PageName *string `json:"page_name,omitempty"` 195 Title *string `json:"title,omitempty"` 196 Summary *string `json:"summary,omitempty"` 197 Action *string `json:"action,omitempty"` 198 SHA *string `json:"sha,omitempty"` 199 HTMLURL *string `json:"html_url,omitempty"` 200} 201 202// GollumEvent is triggered when a Wiki page is created or updated. 203// The Webhook event name is "gollum". 204// 205// GitHub API docs: https://docs.github.com/en/free-pro-team@latest/rest/reference/activity/events/types/#gollumevent 206type GollumEvent struct { 207 Pages []*Page `json:"pages,omitempty"` 208 209 // The following fields are only populated by Webhook events. 210 Repo *Repository `json:"repository,omitempty"` 211 Sender *User `json:"sender,omitempty"` 212 Installation *Installation `json:"installation,omitempty"` 213} 214 215// EditChange represents the changes when an issue, pull request, or comment has 216// been edited. 217type EditChange struct { 218 Title *struct { 219 From *string `json:"from,omitempty"` 220 } `json:"title,omitempty"` 221 Body *struct { 222 From *string `json:"from,omitempty"` 223 } `json:"body,omitempty"` 224 Base *struct { 225 Ref *struct { 226 From *string `json:"from,omitempty"` 227 } `json:"ref,omitempty"` 228 SHA *struct { 229 From *string `json:"from,omitempty"` 230 } `json:"sha,omitempty"` 231 } `json:"base,omitempty"` 232} 233 234// ProjectChange represents the changes when a project has been edited. 235type ProjectChange struct { 236 Name *struct { 237 From *string `json:"from,omitempty"` 238 } `json:"name,omitempty"` 239 Body *struct { 240 From *string `json:"from,omitempty"` 241 } `json:"body,omitempty"` 242} 243 244// ProjectCardChange represents the changes when a project card has been edited. 245type ProjectCardChange struct { 246 Note *struct { 247 From *string `json:"from,omitempty"` 248 } `json:"note,omitempty"` 249} 250 251// ProjectColumnChange represents the changes when a project column has been edited. 252type ProjectColumnChange struct { 253 Name *struct { 254 From *string `json:"from,omitempty"` 255 } `json:"name,omitempty"` 256} 257 258// TeamChange represents the changes when a team has been edited. 259type TeamChange struct { 260 Description *struct { 261 From *string `json:"from,omitempty"` 262 } `json:"description,omitempty"` 263 Name *struct { 264 From *string `json:"from,omitempty"` 265 } `json:"name,omitempty"` 266 Privacy *struct { 267 From *string `json:"from,omitempty"` 268 } `json:"privacy,omitempty"` 269 Repository *struct { 270 Permissions *struct { 271 From *struct { 272 Admin *bool `json:"admin,omitempty"` 273 Pull *bool `json:"pull,omitempty"` 274 Push *bool `json:"push,omitempty"` 275 } `json:"from,omitempty"` 276 } `json:"permissions,omitempty"` 277 } `json:"repository,omitempty"` 278} 279 280// InstallationEvent is triggered when a GitHub App has been installed or uninstalled. 281// The Webhook event name is "installation". 282// 283// GitHub API docs: https://docs.github.com/en/free-pro-team@latest/rest/reference/activity/events/types/#installationevent 284type InstallationEvent struct { 285 // The action that was performed. Can be either "created" or "deleted". 286 Action *string `json:"action,omitempty"` 287 Repositories []*Repository `json:"repositories,omitempty"` 288 Sender *User `json:"sender,omitempty"` 289 Installation *Installation `json:"installation,omitempty"` 290} 291 292// InstallationRepositoriesEvent is triggered when a repository is added or 293// removed from an installation. The Webhook event name is "installation_repositories". 294// 295// GitHub API docs: https://docs.github.com/en/free-pro-team@latest/rest/reference/activity/events/types/#installationrepositoriesevent 296type InstallationRepositoriesEvent struct { 297 // The action that was performed. Can be either "added" or "removed". 298 Action *string `json:"action,omitempty"` 299 RepositoriesAdded []*Repository `json:"repositories_added,omitempty"` 300 RepositoriesRemoved []*Repository `json:"repositories_removed,omitempty"` 301 RepositorySelection *string `json:"repository_selection,omitempty"` 302 Sender *User `json:"sender,omitempty"` 303 Installation *Installation `json:"installation,omitempty"` 304} 305 306// IssueCommentEvent is triggered when an issue comment is created on an issue 307// or pull request. 308// The Webhook event name is "issue_comment". 309// 310// GitHub API docs: https://docs.github.com/en/free-pro-team@latest/rest/reference/activity/events/types/#issuecommentevent 311type IssueCommentEvent struct { 312 // Action is the action that was performed on the comment. 313 // Possible values are: "created", "edited", "deleted". 314 Action *string `json:"action,omitempty"` 315 Issue *Issue `json:"issue,omitempty"` 316 Comment *IssueComment `json:"comment,omitempty"` 317 318 // The following fields are only populated by Webhook events. 319 Changes *EditChange `json:"changes,omitempty"` 320 Repo *Repository `json:"repository,omitempty"` 321 Sender *User `json:"sender,omitempty"` 322 Installation *Installation `json:"installation,omitempty"` 323} 324 325// IssuesEvent is triggered when an issue is opened, edited, deleted, transferred, 326// pinned, unpinned, closed, reopened, assigned, unassigned, labeled, unlabeled, 327// locked, unlocked, milestoned, or demilestoned. 328// The Webhook event name is "issues". 329// 330// GitHub API docs: https://docs.github.com/en/free-pro-team@latest/rest/reference/activity/events/types/#issuesevent 331type IssuesEvent struct { 332 // Action is the action that was performed. Possible values are: "opened", 333 // "edited", "deleted", "transferred", "pinned", "unpinned", "closed", "reopened", 334 // "assigned", "unassigned", "labeled", "unlabeled", "locked", "unlocked", 335 // "milestoned", or "demilestoned". 336 Action *string `json:"action,omitempty"` 337 Issue *Issue `json:"issue,omitempty"` 338 Assignee *User `json:"assignee,omitempty"` 339 Label *Label `json:"label,omitempty"` 340 341 // The following fields are only populated by Webhook events. 342 Changes *EditChange `json:"changes,omitempty"` 343 Repo *Repository `json:"repository,omitempty"` 344 Sender *User `json:"sender,omitempty"` 345 Installation *Installation `json:"installation,omitempty"` 346} 347 348// LabelEvent is triggered when a repository's label is created, edited, or deleted. 349// The Webhook event name is "label" 350// 351// GitHub API docs: https://docs.github.com/en/free-pro-team@latest/rest/reference/activity/events/types/#labelevent 352type LabelEvent struct { 353 // Action is the action that was performed. Possible values are: 354 // "created", "edited", "deleted" 355 Action *string `json:"action,omitempty"` 356 Label *Label `json:"label,omitempty"` 357 358 // The following fields are only populated by Webhook events. 359 Changes *EditChange `json:"changes,omitempty"` 360 Repo *Repository `json:"repository,omitempty"` 361 Org *Organization `json:"organization,omitempty"` 362 Installation *Installation `json:"installation,omitempty"` 363} 364 365// MarketplacePurchaseEvent is triggered when a user purchases, cancels, or changes 366// their GitHub Marketplace plan. 367// Webhook event name "marketplace_purchase". 368// 369// GitHub API docs: https://docs.github.com/en/free-pro-team@latest/rest/reference/activity/events/types/#marketplacepurchaseevent 370type MarketplacePurchaseEvent struct { 371 // Action is the action that was performed. Possible values are: 372 // "purchased", "cancelled", "pending_change", "pending_change_cancelled", "changed". 373 Action *string `json:"action,omitempty"` 374 375 // The following fields are only populated by Webhook events. 376 EffectiveDate *Timestamp `json:"effective_date,omitempty"` 377 MarketplacePurchase *MarketplacePurchase `json:"marketplace_purchase,omitempty"` 378 PreviousMarketplacePurchase *MarketplacePurchase `json:"previous_marketplace_purchase,omitempty"` 379 Sender *User `json:"sender,omitempty"` 380 Installation *Installation `json:"installation,omitempty"` 381} 382 383// MemberEvent is triggered when a user is added as a collaborator to a repository. 384// The Webhook event name is "member". 385// 386// GitHub API docs: https://docs.github.com/en/free-pro-team@latest/rest/reference/activity/events/types/#memberevent 387type MemberEvent struct { 388 // Action is the action that was performed. Possible value is: "added". 389 Action *string `json:"action,omitempty"` 390 Member *User `json:"member,omitempty"` 391 392 // The following fields are only populated by Webhook events. 393 Repo *Repository `json:"repository,omitempty"` 394 Sender *User `json:"sender,omitempty"` 395 Installation *Installation `json:"installation,omitempty"` 396} 397 398// MembershipEvent is triggered when a user is added or removed from a team. 399// The Webhook event name is "membership". 400// 401// Events of this type are not visible in timelines, they are only used to 402// trigger organization webhooks. 403// 404// GitHub API docs: https://docs.github.com/en/free-pro-team@latest/rest/reference/activity/events/types/#membershipevent 405type MembershipEvent struct { 406 // Action is the action that was performed. Possible values are: "added", "removed". 407 Action *string `json:"action,omitempty"` 408 // Scope is the scope of the membership. Possible value is: "team". 409 Scope *string `json:"scope,omitempty"` 410 Member *User `json:"member,omitempty"` 411 Team *Team `json:"team,omitempty"` 412 413 // The following fields are only populated by Webhook events. 414 Org *Organization `json:"organization,omitempty"` 415 Sender *User `json:"sender,omitempty"` 416 Installation *Installation `json:"installation,omitempty"` 417} 418 419// MetaEvent is triggered when the webhook that this event is configured on is deleted. 420// This event will only listen for changes to the particular hook the event is installed on. 421// Therefore, it must be selected for each hook that you'd like to receive meta events for. 422// The Webhook event name is "meta". 423// 424// GitHub API docs: https://docs.github.com/en/free-pro-team@latest/rest/reference/activity/events/types/#metaevent 425type MetaEvent struct { 426 // Action is the action that was performed. Possible value is: "deleted". 427 Action *string `json:"action,omitempty"` 428 // The ID of the modified webhook. 429 HookID *int64 `json:"hook_id,omitempty"` 430 // The modified webhook. 431 // This will contain different keys based on the type of webhook it is: repository, 432 // organization, business, app, or GitHub Marketplace. 433 Hook *Hook `json:"hook,omitempty"` 434} 435 436// MilestoneEvent is triggered when a milestone is created, closed, opened, edited, or deleted. 437// The Webhook event name is "milestone". 438// 439// GitHub API docs: https://docs.github.com/en/free-pro-team@latest/rest/reference/activity/events/types/#milestoneevent 440type MilestoneEvent struct { 441 // Action is the action that was performed. Possible values are: 442 // "created", "closed", "opened", "edited", "deleted" 443 Action *string `json:"action,omitempty"` 444 Milestone *Milestone `json:"milestone,omitempty"` 445 446 // The following fields are only populated by Webhook events. 447 Changes *EditChange `json:"changes,omitempty"` 448 Repo *Repository `json:"repository,omitempty"` 449 Sender *User `json:"sender,omitempty"` 450 Org *Organization `json:"organization,omitempty"` 451 Installation *Installation `json:"installation,omitempty"` 452} 453 454// OrganizationEvent is triggered when an organization is deleted and renamed, and when a user is added, 455// removed, or invited to an organization. 456// Events of this type are not visible in timelines. These events are only used to trigger organization hooks. 457// Webhook event name is "organization". 458// 459// GitHub API docs: https://docs.github.com/en/free-pro-team@latest/rest/reference/activity/events/types/#organizationevent 460type OrganizationEvent struct { 461 // Action is the action that was performed. 462 // Possible values are: "deleted", "renamed", "member_added", "member_removed", or "member_invited". 463 Action *string `json:"action,omitempty"` 464 465 // Invitation is the invitation for the user or email if the action is "member_invited". 466 Invitation *Invitation `json:"invitation,omitempty"` 467 468 // Membership is the membership between the user and the organization. 469 // Not present when the action is "member_invited". 470 Membership *Membership `json:"membership,omitempty"` 471 472 Organization *Organization `json:"organization,omitempty"` 473 Sender *User `json:"sender,omitempty"` 474 Installation *Installation `json:"installation,omitempty"` 475} 476 477// OrgBlockEvent is triggered when an organization blocks or unblocks a user. 478// The Webhook event name is "org_block". 479// 480// GitHub API docs: https://docs.github.com/en/free-pro-team@latest/rest/reference/activity/events/types/#orgblockevent 481type OrgBlockEvent struct { 482 // Action is the action that was performed. 483 // Can be "blocked" or "unblocked". 484 Action *string `json:"action,omitempty"` 485 BlockedUser *User `json:"blocked_user,omitempty"` 486 Organization *Organization `json:"organization,omitempty"` 487 Sender *User `json:"sender,omitempty"` 488 489 // The following fields are only populated by Webhook events. 490 Installation *Installation `json:"installation,omitempty"` 491} 492 493// PackageEvent represents activity related to GitHub Packages. 494// The Webhook event name is "package". 495// 496// This event is triggered when a GitHub Package is published or updated. 497// 498// GitHub API docs: https://developer.github.com/webhooks/event-payloads/#package 499type PackageEvent struct { 500 // Action is the action that was performed. 501 // Can be "published" or "updated". 502 Action *string `json:"action,omitempty"` 503 Package *Package `json:"package,omitempty"` 504 Repo *Repository `json:"repository,omitempty"` 505 Org *Organization `json:"organization,omitempty"` 506 Sender *User `json:"sender,omitempty"` 507} 508 509// PageBuildEvent represents an attempted build of a GitHub Pages site, whether 510// successful or not. 511// The Webhook event name is "page_build". 512// 513// This event is triggered on push to a GitHub Pages enabled branch (gh-pages 514// for project pages, master for user and organization pages). 515// 516// Events of this type are not visible in timelines, they are only used to trigger hooks. 517// 518// GitHub API docs: https://docs.github.com/en/free-pro-team@latest/rest/reference/activity/events/types/#pagebuildevent 519type PageBuildEvent struct { 520 Build *PagesBuild `json:"build,omitempty"` 521 522 // The following fields are only populated by Webhook events. 523 ID *int64 `json:"id,omitempty"` 524 Repo *Repository `json:"repository,omitempty"` 525 Sender *User `json:"sender,omitempty"` 526 Installation *Installation `json:"installation,omitempty"` 527} 528 529// PingEvent is triggered when a Webhook is added to GitHub. 530// 531// GitHub API docs: https://developer.github.com/webhooks/#ping-event 532type PingEvent struct { 533 // Random string of GitHub zen. 534 Zen *string `json:"zen,omitempty"` 535 // The ID of the webhook that triggered the ping. 536 HookID *int64 `json:"hook_id,omitempty"` 537 // The webhook configuration. 538 Hook *Hook `json:"hook,omitempty"` 539 Installation *Installation `json:"installation,omitempty"` 540} 541 542// ProjectEvent is triggered when project is created, modified or deleted. 543// The webhook event name is "project". 544// 545// GitHub API docs: https://docs.github.com/en/free-pro-team@latest/rest/reference/activity/events/types/#projectevent 546type ProjectEvent struct { 547 Action *string `json:"action,omitempty"` 548 Changes *ProjectChange `json:"changes,omitempty"` 549 Project *Project `json:"project,omitempty"` 550 551 // The following fields are only populated by Webhook events. 552 Repo *Repository `json:"repository,omitempty"` 553 Org *Organization `json:"organization,omitempty"` 554 Sender *User `json:"sender,omitempty"` 555 Installation *Installation `json:"installation,omitempty"` 556} 557 558// ProjectCardEvent is triggered when a project card is created, updated, moved, converted to an issue, or deleted. 559// The webhook event name is "project_card". 560// 561// GitHub API docs: https://docs.github.com/en/free-pro-team@latest/rest/reference/activity/events/types/#projectcardevent 562type ProjectCardEvent struct { 563 Action *string `json:"action,omitempty"` 564 Changes *ProjectCardChange `json:"changes,omitempty"` 565 AfterID *int64 `json:"after_id,omitempty"` 566 ProjectCard *ProjectCard `json:"project_card,omitempty"` 567 568 // The following fields are only populated by Webhook events. 569 Repo *Repository `json:"repository,omitempty"` 570 Org *Organization `json:"organization,omitempty"` 571 Sender *User `json:"sender,omitempty"` 572 Installation *Installation `json:"installation,omitempty"` 573} 574 575// ProjectColumnEvent is triggered when a project column is created, updated, moved, or deleted. 576// The webhook event name is "project_column". 577// 578// GitHub API docs: https://docs.github.com/en/free-pro-team@latest/rest/reference/activity/events/types/#projectcolumnevent 579type ProjectColumnEvent struct { 580 Action *string `json:"action,omitempty"` 581 Changes *ProjectColumnChange `json:"changes,omitempty"` 582 AfterID *int64 `json:"after_id,omitempty"` 583 ProjectColumn *ProjectColumn `json:"project_column,omitempty"` 584 585 // The following fields are only populated by Webhook events. 586 Repo *Repository `json:"repository,omitempty"` 587 Org *Organization `json:"organization,omitempty"` 588 Sender *User `json:"sender,omitempty"` 589 Installation *Installation `json:"installation,omitempty"` 590} 591 592// PublicEvent is triggered when a private repository is open sourced. 593// According to GitHub: "Without a doubt: the best GitHub event." 594// The Webhook event name is "public". 595// 596// GitHub API docs: https://docs.github.com/en/free-pro-team@latest/rest/reference/activity/events/types/#publicevent 597type PublicEvent struct { 598 // The following fields are only populated by Webhook events. 599 Repo *Repository `json:"repository,omitempty"` 600 Sender *User `json:"sender,omitempty"` 601 Installation *Installation `json:"installation,omitempty"` 602} 603 604// PullRequestEvent is triggered when a pull request is assigned, unassigned, labeled, 605// unlabeled, opened, edited, closed, reopened, synchronize, ready_for_review, 606// locked, unlocked, a pull request review is requested, or a review request is removed. 607// The Webhook event name is "pull_request". 608// 609// GitHub API docs: https://docs.github.com/en/free-pro-team@latest/rest/reference/activity/events/types/#pullrequestevent 610type PullRequestEvent struct { 611 // Action is the action that was performed. Possible values are: 612 // "assigned", "unassigned", "review_requested", "review_request_removed", "labeled", "unlabeled", 613 // "opened", "edited", "closed", "ready_for_review", "locked", "unlocked", or "reopened". 614 // If the action is "closed" and the "merged" key is "false", the pull request was closed with unmerged commits. 615 // If the action is "closed" and the "merged" key is "true", the pull request was merged. 616 // While webhooks are also triggered when a pull request is synchronized, Events API timelines 617 // don't include pull request events with the "synchronize" action. 618 Action *string `json:"action,omitempty"` 619 Assignee *User `json:"assignee,omitempty"` 620 Number *int `json:"number,omitempty"` 621 PullRequest *PullRequest `json:"pull_request,omitempty"` 622 623 // The following fields are only populated by Webhook events. 624 Changes *EditChange `json:"changes,omitempty"` 625 // RequestedReviewer is populated in "review_requested", "review_request_removed" event deliveries. 626 // A request affecting multiple reviewers at once is split into multiple 627 // such event deliveries, each with a single, different RequestedReviewer. 628 RequestedReviewer *User `json:"requested_reviewer,omitempty"` 629 // In the event that a team is requested instead of a user, "requested_team" gets sent in place of 630 // "requested_user" with the same delivery behavior. 631 RequestedTeam *Team `json:"requested_team,omitempty"` 632 Repo *Repository `json:"repository,omitempty"` 633 Sender *User `json:"sender,omitempty"` 634 Installation *Installation `json:"installation,omitempty"` 635 Label *Label `json:"label,omitempty"` // Populated in "labeled" event deliveries. 636 637 // The following field is only present when the webhook is triggered on 638 // a repository belonging to an organization. 639 Organization *Organization `json:"organization,omitempty"` 640 641 // The following fields are only populated when the Action is "synchronize". 642 Before *string `json:"before,omitempty"` 643 After *string `json:"after,omitempty"` 644} 645 646// PullRequestReviewEvent is triggered when a review is submitted on a pull 647// request. 648// The Webhook event name is "pull_request_review". 649// 650// GitHub API docs: https://docs.github.com/en/free-pro-team@latest/rest/reference/activity/events/types/#pullrequestreviewevent 651type PullRequestReviewEvent struct { 652 // Action is always "submitted". 653 Action *string `json:"action,omitempty"` 654 Review *PullRequestReview `json:"review,omitempty"` 655 PullRequest *PullRequest `json:"pull_request,omitempty"` 656 657 // The following fields are only populated by Webhook events. 658 Repo *Repository `json:"repository,omitempty"` 659 Sender *User `json:"sender,omitempty"` 660 Installation *Installation `json:"installation,omitempty"` 661 662 // The following field is only present when the webhook is triggered on 663 // a repository belonging to an organization. 664 Organization *Organization `json:"organization,omitempty"` 665} 666 667// PullRequestReviewCommentEvent is triggered when a comment is created on a 668// portion of the unified diff of a pull request. 669// The Webhook event name is "pull_request_review_comment". 670// 671// GitHub API docs: https://docs.github.com/en/free-pro-team@latest/rest/reference/activity/events/types/#pullrequestreviewcommentevent 672type PullRequestReviewCommentEvent struct { 673 // Action is the action that was performed on the comment. 674 // Possible values are: "created", "edited", "deleted". 675 Action *string `json:"action,omitempty"` 676 PullRequest *PullRequest `json:"pull_request,omitempty"` 677 Comment *PullRequestComment `json:"comment,omitempty"` 678 679 // The following fields are only populated by Webhook events. 680 Changes *EditChange `json:"changes,omitempty"` 681 Repo *Repository `json:"repository,omitempty"` 682 Sender *User `json:"sender,omitempty"` 683 Installation *Installation `json:"installation,omitempty"` 684} 685 686// PushEvent represents a git push to a GitHub repository. 687// 688// GitHub API docs: https://docs.github.com/en/free-pro-team@latest/rest/reference/activity/events/types/#pushevent 689type PushEvent struct { 690 PushID *int64 `json:"push_id,omitempty"` 691 Head *string `json:"head,omitempty"` 692 Ref *string `json:"ref,omitempty"` 693 Size *int `json:"size,omitempty"` 694 Commits []*HeadCommit `json:"commits,omitempty"` 695 Before *string `json:"before,omitempty"` 696 DistinctSize *int `json:"distinct_size,omitempty"` 697 698 // The following fields are only populated by Webhook events. 699 After *string `json:"after,omitempty"` 700 Created *bool `json:"created,omitempty"` 701 Deleted *bool `json:"deleted,omitempty"` 702 Forced *bool `json:"forced,omitempty"` 703 BaseRef *string `json:"base_ref,omitempty"` 704 Compare *string `json:"compare,omitempty"` 705 Repo *PushEventRepository `json:"repository,omitempty"` 706 HeadCommit *HeadCommit `json:"head_commit,omitempty"` 707 Pusher *User `json:"pusher,omitempty"` 708 Sender *User `json:"sender,omitempty"` 709 Installation *Installation `json:"installation,omitempty"` 710} 711 712func (p PushEvent) String() string { 713 return Stringify(p) 714} 715 716// HeadCommit represents a git commit in a GitHub PushEvent. 717type HeadCommit struct { 718 Message *string `json:"message,omitempty"` 719 Author *CommitAuthor `json:"author,omitempty"` 720 URL *string `json:"url,omitempty"` 721 Distinct *bool `json:"distinct,omitempty"` 722 723 // The following fields are only populated by Events API. 724 SHA *string `json:"sha,omitempty"` 725 726 // The following fields are only populated by Webhook events. 727 ID *string `json:"id,omitempty"` 728 TreeID *string `json:"tree_id,omitempty"` 729 Timestamp *Timestamp `json:"timestamp,omitempty"` 730 Committer *CommitAuthor `json:"committer,omitempty"` 731 Added []string `json:"added,omitempty"` 732 Removed []string `json:"removed,omitempty"` 733 Modified []string `json:"modified,omitempty"` 734} 735 736func (p HeadCommit) String() string { 737 return Stringify(p) 738} 739 740// PushEventRepository represents the repo object in a PushEvent payload. 741type PushEventRepository struct { 742 ID *int64 `json:"id,omitempty"` 743 NodeID *string `json:"node_id,omitempty"` 744 Name *string `json:"name,omitempty"` 745 FullName *string `json:"full_name,omitempty"` 746 Owner *User `json:"owner,omitempty"` 747 Private *bool `json:"private,omitempty"` 748 Description *string `json:"description,omitempty"` 749 Fork *bool `json:"fork,omitempty"` 750 CreatedAt *Timestamp `json:"created_at,omitempty"` 751 PushedAt *Timestamp `json:"pushed_at,omitempty"` 752 UpdatedAt *Timestamp `json:"updated_at,omitempty"` 753 Homepage *string `json:"homepage,omitempty"` 754 PullsURL *string `json:"pulls_url,omitempty"` 755 Size *int `json:"size,omitempty"` 756 StargazersCount *int `json:"stargazers_count,omitempty"` 757 WatchersCount *int `json:"watchers_count,omitempty"` 758 Language *string `json:"language,omitempty"` 759 HasIssues *bool `json:"has_issues,omitempty"` 760 HasDownloads *bool `json:"has_downloads,omitempty"` 761 HasWiki *bool `json:"has_wiki,omitempty"` 762 HasPages *bool `json:"has_pages,omitempty"` 763 ForksCount *int `json:"forks_count,omitempty"` 764 Archived *bool `json:"archived,omitempty"` 765 Disabled *bool `json:"disabled,omitempty"` 766 OpenIssuesCount *int `json:"open_issues_count,omitempty"` 767 DefaultBranch *string `json:"default_branch,omitempty"` 768 MasterBranch *string `json:"master_branch,omitempty"` 769 Organization *string `json:"organization,omitempty"` 770 URL *string `json:"url,omitempty"` 771 ArchiveURL *string `json:"archive_url,omitempty"` 772 HTMLURL *string `json:"html_url,omitempty"` 773 StatusesURL *string `json:"statuses_url,omitempty"` 774 GitURL *string `json:"git_url,omitempty"` 775 SSHURL *string `json:"ssh_url,omitempty"` 776 CloneURL *string `json:"clone_url,omitempty"` 777 SVNURL *string `json:"svn_url,omitempty"` 778} 779 780// PushEventRepoOwner is a basic representation of user/org in a PushEvent payload. 781type PushEventRepoOwner struct { 782 Name *string `json:"name,omitempty"` 783 Email *string `json:"email,omitempty"` 784} 785 786// ReleaseEvent is triggered when a release is published, unpublished, created, 787// edited, deleted, or prereleased. 788// The Webhook event name is "release". 789// 790// GitHub API docs: https://docs.github.com/en/free-pro-team@latest/rest/reference/activity/events/types/#releaseevent 791type ReleaseEvent struct { 792 // Action is the action that was performed. Possible values are: "published", "unpublished", 793 // "created", "edited", "deleted", or "prereleased". 794 Action *string `json:"action,omitempty"` 795 Release *RepositoryRelease `json:"release,omitempty"` 796 797 // The following fields are only populated by Webhook events. 798 Repo *Repository `json:"repository,omitempty"` 799 Sender *User `json:"sender,omitempty"` 800 Installation *Installation `json:"installation,omitempty"` 801} 802 803// RepositoryEvent is triggered when a repository is created, archived, unarchived, 804// renamed, edited, transferred, made public, or made private. Organization hooks are 805// also trigerred when a repository is deleted. 806// The Webhook event name is "repository". 807// 808// Events of this type are not visible in timelines, they are only used to 809// trigger organization webhooks. 810// 811// GitHub API docs: https://docs.github.com/en/free-pro-team@latest/rest/reference/activity/events/types/#repositoryevent 812type RepositoryEvent struct { 813 // Action is the action that was performed. Possible values are: "created", 814 // "deleted" (organization hooks only), "archived", "unarchived", "edited", "renamed", 815 // "transferred", "publicized", or "privatized". 816 Action *string `json:"action,omitempty"` 817 Repo *Repository `json:"repository,omitempty"` 818 819 // The following fields are only populated by Webhook events. 820 Org *Organization `json:"organization,omitempty"` 821 Sender *User `json:"sender,omitempty"` 822 Installation *Installation `json:"installation,omitempty"` 823} 824 825// RepositoryDispatchEvent is triggered when a client sends a POST request to the repository dispatch event endpoint. 826// 827// GitHub API docs: https://docs.github.com/en/free-pro-team@latest/rest/reference/activity/events/types/#repositorydispatchevent 828type RepositoryDispatchEvent struct { 829 // Action is the event_type that submitted with the repository dispatch payload. Value can be any string. 830 Action *string `json:"action,omitempty"` 831 Branch *string `json:"branch,omitempty"` 832 ClientPayload json.RawMessage `json:"client_payload,omitempty"` 833 Repo *Repository `json:"repository,omitempty"` 834 835 // The following fields are only populated by Webhook events. 836 Org *Organization `json:"organization,omitempty"` 837 Sender *User `json:"sender,omitempty"` 838 Installation *Installation `json:"installation,omitempty"` 839} 840 841// RepositoryVulnerabilityAlertEvent is triggered when a security alert is created, dismissed, or resolved. 842// 843// GitHub API docs: https://docs.github.com/en/free-pro-team@latest/rest/reference/activity/events/types/#repositoryvulnerabilityalertevent 844type RepositoryVulnerabilityAlertEvent struct { 845 // Action is the action that was performed. Possible values are: "create", "dismiss", "resolve". 846 Action *string `json:"action,omitempty"` 847 848 //The security alert of the vulnerable dependency. 849 Alert *struct { 850 ID *int64 `json:"id,omitempty"` 851 AffectedRange *string `json:"affected_range,omitempty"` 852 AffectedPackageName *string `json:"affected_package_name,omitempty"` 853 ExternalReference *string `json:"external_reference,omitempty"` 854 ExternalIdentifier *string `json:"external_identifier,omitempty"` 855 FixedIn *string `json:"fixed_in,omitempty"` 856 Dismisser *User `json:"dismisser,omitempty"` 857 DismissReason *string `json:"dismiss_reason,omitempty"` 858 DismissedAt *Timestamp `json:"dismissed_at,omitempty"` 859 } `json:"alert,omitempty"` 860 861 //The repository of the vulnerable dependency. 862 Repository *Repository `json:"repository,omitempty"` 863} 864 865// StarEvent is triggered when a star is added or removed from a repository. 866// The Webhook event name is "star". 867// 868// GitHub API docs: https://docs.github.com/en/free-pro-team@latest/rest/reference/activity/events/types/#starevent 869type StarEvent struct { 870 // Action is the action that was performed. Possible values are: "created" or "deleted". 871 Action *string `json:"action,omitempty"` 872 873 // StarredAt is the time the star was created. It will be null for the "deleted" action. 874 StarredAt *Timestamp `json:"starred_at,omitempty"` 875} 876 877// StatusEvent is triggered when the status of a Git commit changes. 878// The Webhook event name is "status". 879// 880// Events of this type are not visible in timelines, they are only used to 881// trigger hooks. 882// 883// GitHub API docs: https://docs.github.com/en/free-pro-team@latest/rest/reference/activity/events/types/#statusevent 884type StatusEvent struct { 885 SHA *string `json:"sha,omitempty"` 886 // State is the new state. Possible values are: "pending", "success", "failure", "error". 887 State *string `json:"state,omitempty"` 888 Description *string `json:"description,omitempty"` 889 TargetURL *string `json:"target_url,omitempty"` 890 Branches []*Branch `json:"branches,omitempty"` 891 892 // The following fields are only populated by Webhook events. 893 ID *int64 `json:"id,omitempty"` 894 Name *string `json:"name,omitempty"` 895 Context *string `json:"context,omitempty"` 896 Commit *RepositoryCommit `json:"commit,omitempty"` 897 CreatedAt *Timestamp `json:"created_at,omitempty"` 898 UpdatedAt *Timestamp `json:"updated_at,omitempty"` 899 Repo *Repository `json:"repository,omitempty"` 900 Sender *User `json:"sender,omitempty"` 901 Installation *Installation `json:"installation,omitempty"` 902} 903 904// TeamEvent is triggered when an organization's team is created, modified or deleted. 905// The Webhook event name is "team". 906// 907// Events of this type are not visible in timelines. These events are only used 908// to trigger hooks. 909// 910// GitHub API docs: https://docs.github.com/en/free-pro-team@latest/rest/reference/activity/events/types/#teamevent 911type TeamEvent struct { 912 Action *string `json:"action,omitempty"` 913 Team *Team `json:"team,omitempty"` 914 Changes *TeamChange `json:"changes,omitempty"` 915 Repo *Repository `json:"repository,omitempty"` 916 917 // The following fields are only populated by Webhook events. 918 Org *Organization `json:"organization,omitempty"` 919 Sender *User `json:"sender,omitempty"` 920 Installation *Installation `json:"installation,omitempty"` 921} 922 923// TeamAddEvent is triggered when a repository is added to a team. 924// The Webhook event name is "team_add". 925// 926// Events of this type are not visible in timelines. These events are only used 927// to trigger hooks. 928// 929// GitHub API docs: https://docs.github.com/en/free-pro-team@latest/rest/reference/activity/events/types/#teamaddevent 930type TeamAddEvent struct { 931 Team *Team `json:"team,omitempty"` 932 Repo *Repository `json:"repository,omitempty"` 933 934 // The following fields are only populated by Webhook events. 935 Org *Organization `json:"organization,omitempty"` 936 Sender *User `json:"sender,omitempty"` 937 Installation *Installation `json:"installation,omitempty"` 938} 939 940// UserEvent is triggered when a user is created or deleted. 941// The Webhook event name is "user". 942// 943// Only global webhooks can subscribe to this event type. 944// 945// GitHub API docs: https://developer.github.com/enterprise/v3/activity/events/types/#userevent-enterprise 946type UserEvent struct { 947 User *User `json:"user,omitempty"` 948 // The action performed. Possible values are: "created" or "deleted". 949 Action *string `json:"action,omitempty"` 950 Enterprise *Enterprise `json:"enterprise,omitempty"` 951 Sender *User `json:"sender,omitempty"` 952} 953 954// WatchEvent is related to starring a repository, not watching. See this API 955// blog post for an explanation: https://developer.github.com/changes/2012-09-05-watcher-api/ 956// 957// The event’s actor is the user who starred a repository, and the event’s 958// repository is the repository that was starred. 959// 960// GitHub API docs: https://docs.github.com/en/free-pro-team@latest/rest/reference/activity/events/types/#watchevent 961type WatchEvent struct { 962 // Action is the action that was performed. Possible value is: "started". 963 Action *string `json:"action,omitempty"` 964 965 // The following fields are only populated by Webhook events. 966 Repo *Repository `json:"repository,omitempty"` 967 Sender *User `json:"sender,omitempty"` 968 Installation *Installation `json:"installation,omitempty"` 969} 970 971// WorkflowDispatchEvent is triggered when someone triggers a workflow run on GitHub or 972// sends a POST request to the create a workflow dispatch event endpoint. 973// 974// GitHub API docs: https://docs.github.com/en/developers/webhooks-and-events/webhook-events-and-payloads#workflow_dispatch 975type WorkflowDispatchEvent struct { 976 Inputs json.RawMessage `json:"inputs,omitempty"` 977 Ref *string `json:"ref,omitempty"` 978 Workflow *string `json:"workflow,omitempty"` 979 980 // The following fields are only populated by Webhook events. 981 Repo *Repository `json:"repository,omitempty"` 982 Org *Organization `json:"organization,omitempty"` 983 Sender *User `json:"sender,omitempty"` 984} 985 986// WorkflowRunEvent is triggered when a GitHub Actions workflow run is requested or completed. 987// 988// GitHub API docs: https://docs.github.com/en/developers/webhooks-and-events/webhook-events-and-payloads#workflow_run 989type WorkflowRunEvent struct { 990 Action *string `json:"action,omitempty"` 991 992 // The following fields are only populated by Webhook events. 993 Org *Organization `json:"organization,omitempty"` 994 Repo *Repository `json:"repository,omitempty"` 995 Sender *User `json:"sender,omitempty"` 996} 997