-
Notifications
You must be signed in to change notification settings - Fork 2.1k
/
event_types.go
1847 lines (1609 loc) · 84.4 KB
/
event_types.go
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
// Copyright 2016 The go-github AUTHORS. All rights reserved.
//
// Use of this source code is governed by a BSD-style
// license that can be found in the LICENSE file.
// These event types are shared between the Events API and used as Webhook payloads.
package github
import "encoding/json"
// RequestedAction is included in a CheckRunEvent when a user has invoked an action,
// i.e. when the CheckRunEvent's Action field is "requested_action".
type RequestedAction struct {
Identifier string `json:"identifier"` // The integrator reference of the action requested by the user.
}
// BranchProtectionRuleEvent triggered when a check suite is "created", "edited", or "deleted".
// The Webhook event name is "branch_protection_rule".
//
// GitHub API docs: https://docs.github.com/developers/webhooks-and-events/webhooks/webhook-events-and-payloads#branch_protection_rule
type BranchProtectionRuleEvent struct {
Action *string `json:"action,omitempty"`
Rule *BranchProtectionRule `json:"rule,omitempty"`
Changes *ProtectionChanges `json:"changes,omitempty"`
Repo *Repository `json:"repository,omitempty"`
Org *Organization `json:"organization,omitempty"`
Sender *User `json:"sender,omitempty"`
Installation *Installation `json:"installation,omitempty"`
}
// CheckRunEvent is triggered when a check run is "created", "completed", or "rerequested".
// The Webhook event name is "check_run".
//
// GitHub API docs: https://docs.github.com/developers/webhooks-and-events/webhook-events-and-payloads#check_run
type CheckRunEvent struct {
CheckRun *CheckRun `json:"check_run,omitempty"`
// The action performed. Possible values are: "created", "completed", "rerequested" or "requested_action".
Action *string `json:"action,omitempty"`
// The following fields are only populated by Webhook events.
Repo *Repository `json:"repository,omitempty"`
Org *Organization `json:"organization,omitempty"`
Sender *User `json:"sender,omitempty"`
Installation *Installation `json:"installation,omitempty"`
// The action requested by the user. Populated when the Action is "requested_action".
RequestedAction *RequestedAction `json:"requested_action,omitempty"` //
}
// CheckSuiteEvent is triggered when a check suite is "completed", "requested", or "rerequested".
// The Webhook event name is "check_suite".
//
// GitHub API docs: https://docs.github.com/developers/webhooks-and-events/webhook-events-and-payloads#check_suite
type CheckSuiteEvent struct {
CheckSuite *CheckSuite `json:"check_suite,omitempty"`
// The action performed. Possible values are: "completed", "requested" or "rerequested".
Action *string `json:"action,omitempty"`
// The following fields are only populated by Webhook events.
Repo *Repository `json:"repository,omitempty"`
Org *Organization `json:"organization,omitempty"`
Sender *User `json:"sender,omitempty"`
Installation *Installation `json:"installation,omitempty"`
}
// CommitCommentEvent is triggered when a commit comment is created.
// The Webhook event name is "commit_comment".
//
// GitHub API docs: https://docs.github.com/developers/webhooks-and-events/webhook-events-and-payloads#commit_comment
type CommitCommentEvent struct {
Comment *RepositoryComment `json:"comment,omitempty"`
// The following fields are only populated by Webhook events.
Action *string `json:"action,omitempty"`
Repo *Repository `json:"repository,omitempty"`
Sender *User `json:"sender,omitempty"`
Installation *Installation `json:"installation,omitempty"`
// The following field is only present when the webhook is triggered on
// a repository belonging to an organization.
Org *Organization `json:"organization,omitempty"`
}
// ContentReferenceEvent is triggered when the body or comment of an issue or
// pull request includes a URL that matches a configured content reference
// domain.
// The Webhook event name is "content_reference".
//
// GitHub API docs: https://developer.github.com/webhooks/event-payloads/#content_reference
type ContentReferenceEvent struct {
Action *string `json:"action,omitempty"`
ContentReference *ContentReference `json:"content_reference,omitempty"`
Repo *Repository `json:"repository,omitempty"`
Sender *User `json:"sender,omitempty"`
Installation *Installation `json:"installation,omitempty"`
}
// CreateEvent represents a created repository, branch, or tag.
// The Webhook event name is "create".
//
// Note: webhooks will not receive this event for created repositories.
// Additionally, webhooks will not receive this event for tags if more
// than three tags are pushed at once.
//
// GitHub API docs: https://docs.github.com/developers/webhooks-and-events/github-event-types#createevent
type CreateEvent struct {
Ref *string `json:"ref,omitempty"`
// RefType is the object that was created. Possible values are: "repository", "branch", "tag".
RefType *string `json:"ref_type,omitempty"`
MasterBranch *string `json:"master_branch,omitempty"`
Description *string `json:"description,omitempty"`
PusherType *string `json:"pusher_type,omitempty"`
// The following fields are only populated by Webhook events.
Repo *Repository `json:"repository,omitempty"`
Org *Organization `json:"organization,omitempty"`
Sender *User `json:"sender,omitempty"`
Installation *Installation `json:"installation,omitempty"`
}
// DeleteEvent represents a deleted branch or tag.
// The Webhook event name is "delete".
//
// Note: webhooks will not receive this event for tags if more than three tags
// are deleted at once.
//
// GitHub API docs: https://docs.github.com/developers/webhooks-and-events/github-event-types#deleteevent
type DeleteEvent struct {
Ref *string `json:"ref,omitempty"`
// RefType is the object that was deleted. Possible values are: "branch", "tag".
RefType *string `json:"ref_type,omitempty"`
// The following fields are only populated by Webhook events.
PusherType *string `json:"pusher_type,omitempty"`
Repo *Repository `json:"repository,omitempty"`
Sender *User `json:"sender,omitempty"`
Installation *Installation `json:"installation,omitempty"`
// The following field is only present when the webhook is triggered on
// a repository belonging to an organization.
Org *Organization `json:"organization,omitempty"`
}
// DependabotAlertEvent is triggered when there is activity relating to Dependabot alerts.
// The Webhook event name is "dependabot_alert".
//
// GitHub API docs: https://docs.github.com/webhooks-and-events/webhooks/webhook-events-and-payloads#dependabot_alert
type DependabotAlertEvent struct {
Action *string `json:"action,omitempty"`
Alert *DependabotAlert `json:"alert,omitempty"`
// The following fields are only populated by Webhook events.
Installation *Installation `json:"installation,omitempty"`
Enterprise *Enterprise `json:"enterprise,omitempty"`
Repo *Repository `json:"repository,omitempty"`
Sender *User `json:"sender,omitempty"`
// The following field is only present when the webhook is triggered on
// a repository belonging to an organization.
Organization *Organization `json:"organization,omitempty"`
}
// DeployKeyEvent is triggered when a deploy key is added or removed from a repository.
// The Webhook event name is "deploy_key".
//
// GitHub API docs: https://docs.github.com/developers/webhooks-and-events/webhook-events-and-payloads#deploy_key
type DeployKeyEvent struct {
// Action is the action that was performed. Possible values are:
// "created" or "deleted".
Action *string `json:"action,omitempty"`
// The deploy key resource.
Key *Key `json:"key,omitempty"`
// The Repository where the event occurred
Repo *Repository `json:"repository,omitempty"`
// The following field is only present when the webhook is triggered on
// a repository belonging to an organization.
Organization *Organization `json:"organization,omitempty"`
// The following fields are only populated by Webhook events.
Sender *User `json:"sender,omitempty"`
Installation *Installation `json:"installation,omitempty"`
}
// DeploymentEvent represents a deployment.
// The Webhook event name is "deployment".
//
// Events of this type are not visible in timelines, they are only used to trigger hooks.
//
// GitHub API docs: https://docs.github.com/developers/webhooks-and-events/webhook-events-and-payloads#deployment
type DeploymentEvent struct {
Deployment *Deployment `json:"deployment,omitempty"`
Repo *Repository `json:"repository,omitempty"`
Workflow *Workflow `json:"workflow,omitempty"`
WorkflowRun *WorkflowRun `json:"workflow_run,omitempty"`
// The following fields are only populated by Webhook events.
Sender *User `json:"sender,omitempty"`
Installation *Installation `json:"installation,omitempty"`
// The following field is only present when the webhook is triggered on
// a repository belonging to an organization.
Org *Organization `json:"organization,omitempty"`
}
// DeploymentProtectionRuleEvent represents a deployment protection rule event.
// The Webhook event name is "deployment_protection_rule".
//
// GitHub API docs: https://docs.github.com/webhooks-and-events/webhooks/webhook-events-and-payloads#deployment_protection_rule
type DeploymentProtectionRuleEvent struct {
Action *string `json:"action,omitempty"`
Environment *string `json:"environment,omitempty"`
Event *string `json:"event,omitempty"`
// The URL Github provides for a third-party to use in order to pass/fail a deployment gate
DeploymentCallbackURL *string `json:"deployment_callback_url,omitempty"`
Deployment *Deployment `json:"deployment,omitempty"`
Repo *Repository `json:"repository,omitempty"`
Organization *Organization `json:"organization,omitempty"`
PullRequests []*PullRequest `json:"pull_requests,omitempty"`
Sender *User `json:"sender,omitempty"`
Installation *Installation `json:"installation,omitempty"`
}
// DeploymentStatusEvent represents a deployment status.
// The Webhook event name is "deployment_status".
//
// Events of this type are not visible in timelines, they are only used to trigger hooks.
//
// GitHub API docs: https://docs.github.com/developers/webhooks-and-events/webhook-events-and-payloads#deployment_status
type DeploymentStatusEvent struct {
Action *string `json:"action,omitempty"`
Deployment *Deployment `json:"deployment,omitempty"`
DeploymentStatus *DeploymentStatus `json:"deployment_status,omitempty"`
Repo *Repository `json:"repository,omitempty"`
// The following fields are only populated by Webhook events.
Sender *User `json:"sender,omitempty"`
Installation *Installation `json:"installation,omitempty"`
// The following field is only present when the webhook is triggered on
// a repository belonging to an organization.
Org *Organization `json:"organization,omitempty"`
}
// DiscussionCommentEvent represents a webhook event for a comment on discussion.
// The Webhook event name is "discussion_comment".
//
// GitHub API docs: https://docs.github.com/webhooks-and-events/webhooks/webhook-events-and-payloads#discussion_comment
type DiscussionCommentEvent struct {
// Action is the action that was performed on the comment.
// Possible values are: "created", "edited", "deleted". ** check what all can be added
Action *string `json:"action,omitempty"`
Discussion *Discussion `json:"discussion,omitempty"`
Comment *CommentDiscussion `json:"comment,omitempty"`
Repo *Repository `json:"repository,omitempty"`
Org *Organization `json:"organization,omitempty"`
Sender *User `json:"sender,omitempty"`
Installation *Installation `json:"installation,omitempty"`
}
// CommentDiscussion represents a comment in a GitHub DiscussionCommentEvent.
type CommentDiscussion struct {
AuthorAssociation *string `json:"author_association,omitempty"`
Body *string `json:"body,omitempty"`
ChildCommentCount *int `json:"child_comment_count,omitempty"`
CreatedAt *Timestamp `json:"created_at,omitempty"`
DiscussionID *int64 `json:"discussion_id,omitempty"`
HTMLURL *string `json:"html_url,omitempty"`
ID *int64 `json:"id,omitempty"`
NodeID *string `json:"node_id,omitempty"`
ParentID *int64 `json:"parent_id,omitempty"`
Reactions *Reactions `json:"reactions,omitempty"`
RepositoryURL *string `json:"repository_url,omitempty"`
UpdatedAt *Timestamp `json:"updated_at,omitempty"`
User *User `json:"user,omitempty"`
}
// DiscussionEvent represents a webhook event for a discussion.
// The Webhook event name is "discussion".
//
// GitHub API docs: https://docs.github.com/developers/webhooks-and-events/webhooks/webhook-events-and-payloads#discussion
type DiscussionEvent struct {
// Action is the action that was performed. Possible values are:
// created, edited, deleted, pinned, unpinned, locked, unlocked,
// transferred, category_changed, answered, or unanswered.
Action *string `json:"action,omitempty"`
Discussion *Discussion `json:"discussion,omitempty"`
Repo *Repository `json:"repository,omitempty"`
Org *Organization `json:"organization,omitempty"`
Sender *User `json:"sender,omitempty"`
Installation *Installation `json:"installation,omitempty"`
}
// Discussion represents a discussion in a GitHub DiscussionEvent.
type Discussion struct {
RepositoryURL *string `json:"repository_url,omitempty"`
DiscussionCategory *DiscussionCategory `json:"category,omitempty"`
AnswerHTMLURL *string `json:"answer_html_url,omitempty"`
AnswerChosenAt *Timestamp `json:"answer_chosen_at,omitempty"`
AnswerChosenBy *string `json:"answer_chosen_by,omitempty"`
HTMLURL *string `json:"html_url,omitempty"`
ID *int64 `json:"id,omitempty"`
NodeID *string `json:"node_id,omitempty"`
Number *int `json:"number,omitempty"`
Title *string `json:"title,omitempty"`
User *User `json:"user,omitempty"`
State *string `json:"state,omitempty"`
Locked *bool `json:"locked,omitempty"`
Comments *int `json:"comments,omitempty"`
CreatedAt *Timestamp `json:"created_at,omitempty"`
UpdatedAt *Timestamp `json:"updated_at,omitempty"`
AuthorAssociation *string `json:"author_association,omitempty"`
ActiveLockReason *string `json:"active_lock_reason,omitempty"`
Body *string `json:"body,omitempty"`
}
// DiscussionCategory represents a discussion category in a GitHub DiscussionEvent.
type DiscussionCategory struct {
ID *int64 `json:"id,omitempty"`
NodeID *string `json:"node_id,omitempty"`
RepositoryID *int64 `json:"repository_id,omitempty"`
Emoji *string `json:"emoji,omitempty"`
Name *string `json:"name,omitempty"`
Description *string `json:"description,omitempty"`
CreatedAt *Timestamp `json:"created_at,omitempty"`
UpdatedAt *Timestamp `json:"updated_at,omitempty"`
Slug *string `json:"slug,omitempty"`
IsAnswerable *bool `json:"is_answerable,omitempty"`
}
// ForkEvent is triggered when a user forks a repository.
// The Webhook event name is "fork".
//
// GitHub API docs: https://docs.github.com/developers/webhooks-and-events/webhook-events-and-payloads#fork
type ForkEvent struct {
// Forkee is the created repository.
Forkee *Repository `json:"forkee,omitempty"`
// The following fields are only populated by Webhook events.
Repo *Repository `json:"repository,omitempty"`
Sender *User `json:"sender,omitempty"`
Installation *Installation `json:"installation,omitempty"`
}
// GitHubAppAuthorizationEvent is triggered when a user's authorization for a
// GitHub Application is revoked.
//
// GitHub API docs: https://docs.github.com/developers/webhooks-and-events/webhook-events-and-payloads#github_app_authorization
type GitHubAppAuthorizationEvent struct {
// The action performed. Possible value is: "revoked".
Action *string `json:"action,omitempty"`
// The following fields are only populated by Webhook events.
Sender *User `json:"sender,omitempty"`
Installation *Installation `json:"installation,omitempty"`
}
// Page represents a single Wiki page.
type Page struct {
PageName *string `json:"page_name,omitempty"`
Title *string `json:"title,omitempty"`
Summary *string `json:"summary,omitempty"`
Action *string `json:"action,omitempty"`
SHA *string `json:"sha,omitempty"`
HTMLURL *string `json:"html_url,omitempty"`
}
// GollumEvent is triggered when a Wiki page is created or updated.
// The Webhook event name is "gollum".
//
// GitHub API docs: https://docs.github.com/developers/webhooks-and-events/webhook-events-and-payloads#gollum
type GollumEvent struct {
Pages []*Page `json:"pages,omitempty"`
// The following fields are only populated by Webhook events.
Repo *Repository `json:"repository,omitempty"`
Sender *User `json:"sender,omitempty"`
Installation *Installation `json:"installation,omitempty"`
// The following field is only present when the webhook is triggered on
// a repository belonging to an organization.
Org *Organization `json:"organization,omitempty"`
}
// EditChange represents the changes when an issue, pull request, comment,
// or repository has been edited.
type EditChange struct {
Title *EditTitle `json:"title,omitempty"`
Body *EditBody `json:"body,omitempty"`
Base *EditBase `json:"base,omitempty"`
Repo *EditRepo `json:"repository,omitempty"`
Owner *EditOwner `json:"owner,omitempty"`
DefaultBranch *EditDefaultBranch `json:"default_branch,omitempty"`
Topics *EditTopics `json:"topics,omitempty"`
}
// EditTitle represents a pull-request title change.
type EditTitle struct {
From *string `json:"from,omitempty"`
}
// EditBody represents a change of pull-request body.
type EditBody struct {
From *string `json:"from,omitempty"`
}
// EditBase represents the change of a pull-request base branch.
type EditBase struct {
Ref *EditRef `json:"ref,omitempty"`
SHA *EditSHA `json:"sha,omitempty"`
}
// EditRef represents a ref change of a pull-request.
type EditRef struct {
From *string `json:"from,omitempty"`
}
// EditRepo represents a change of repository name.
type EditRepo struct {
Name *RepoName `json:"name,omitempty"`
}
// EditOwner represents a change of repository ownership.
type EditOwner struct {
OwnerInfo *OwnerInfo `json:"from,omitempty"`
}
// OwnerInfo represents the account info of the owner of the repo (could be User or Organization but both are User structs).
type OwnerInfo struct {
User *User `json:"user,omitempty"`
Org *User `json:"organization,omitempty"`
}
// RepoName represents a change of repository name.
type RepoName struct {
From *string `json:"from,omitempty"`
}
// EditTopics represents a change of repository topics.
type EditTopics struct {
From []string `json:"from,omitempty"`
}
// EditSHA represents a sha change of a pull-request.
type EditSHA struct {
From *string `json:"from,omitempty"`
}
// EditDefaultBranch represents a change of repository's default branch name.
type EditDefaultBranch struct {
From *string `json:"from,omitempty"`
}
// ProjectChange represents the changes when a project has been edited.
type ProjectChange struct {
Name *ProjectName `json:"name,omitempty"`
Body *ProjectBody `json:"body,omitempty"`
}
// ProjectName represents a project name change.
type ProjectName struct {
From *string `json:"from,omitempty"`
}
// ProjectBody represents a project body change.
type ProjectBody struct {
From *string `json:"from,omitempty"`
}
// ProjectCardChange represents the changes when a project card has been edited.
type ProjectCardChange struct {
Note *ProjectCardNote `json:"note,omitempty"`
}
// ProjectCardNote represents a change of a note of a project card.
type ProjectCardNote struct {
From *string `json:"from,omitempty"`
}
// ProjectColumnChange represents the changes when a project column has been edited.
type ProjectColumnChange struct {
Name *ProjectColumnName `json:"name,omitempty"`
}
// ProjectColumnName represents a project column name change.
type ProjectColumnName struct {
From *string `json:"from,omitempty"`
}
// TeamChange represents the changes when a team has been edited.
type TeamChange struct {
Description *TeamDescription `json:"description,omitempty"`
Name *TeamName `json:"name,omitempty"`
Privacy *TeamPrivacy `json:"privacy,omitempty"`
Repository *TeamRepository `json:"repository,omitempty"`
}
// TeamDescription represents a team description change.
type TeamDescription struct {
From *string `json:"from,omitempty"`
}
// TeamName represents a team name change.
type TeamName struct {
From *string `json:"from,omitempty"`
}
// TeamPrivacy represents a team privacy change.
type TeamPrivacy struct {
From *string `json:"from,omitempty"`
}
// TeamRepository represents a team repository permission change.
type TeamRepository struct {
Permissions *TeamPermissions `json:"permissions,omitempty"`
}
// TeamPermissions represents a team permission change.
type TeamPermissions struct {
From *TeamPermissionsFrom `json:"from,omitempty"`
}
// TeamPermissionsFrom represents a team permission change.
type TeamPermissionsFrom struct {
Admin *bool `json:"admin,omitempty"`
Pull *bool `json:"pull,omitempty"`
Push *bool `json:"push,omitempty"`
}
// InstallationEvent is triggered when a GitHub App has been installed, uninstalled, suspend, unsuspended
// or new permissions have been accepted.
// The Webhook event name is "installation".
//
// GitHub API docs: https://docs.github.com/developers/webhooks-and-events/webhook-events-and-payloads#installation
type InstallationEvent struct {
// The action that was performed. Can be either "created", "deleted", "suspend", "unsuspend" or "new_permissions_accepted".
Action *string `json:"action,omitempty"`
Repositories []*Repository `json:"repositories,omitempty"`
Sender *User `json:"sender,omitempty"`
Installation *Installation `json:"installation,omitempty"`
Requester *User `json:"requester,omitempty"`
// The following field is only present when the webhook is triggered on
// a repository belonging to an organization.
Org *Organization `json:"organization,omitempty"`
}
// InstallationRepositoriesEvent is triggered when a repository is added or
// removed from an installation. The Webhook event name is "installation_repositories".
//
// GitHub API docs: https://docs.github.com/developers/webhooks-and-events/webhook-events-and-payloads#installation_repositories
type InstallationRepositoriesEvent struct {
// The action that was performed. Can be either "added" or "removed".
Action *string `json:"action,omitempty"`
RepositoriesAdded []*Repository `json:"repositories_added,omitempty"`
RepositoriesRemoved []*Repository `json:"repositories_removed,omitempty"`
RepositorySelection *string `json:"repository_selection,omitempty"`
Sender *User `json:"sender,omitempty"`
Installation *Installation `json:"installation,omitempty"`
// The following field is only present when the webhook is triggered on
// a repository belonging to an organization.
Org *Organization `json:"organization,omitempty"`
}
// InstallationLoginChange represents a change in login on an installation.
type InstallationLoginChange struct {
From *string `json:"from,omitempty"`
}
// InstallationSlugChange represents a change in slug on an installation.
type InstallationSlugChange struct {
From *string `json:"from,omitempty"`
}
// InstallationChanges represents a change in slug or login on an installation.
type InstallationChanges struct {
Login *InstallationLoginChange `json:"login,omitempty"`
Slug *InstallationSlugChange `json:"slug,omitempty"`
}
// InstallationTargetEvent is triggered when there is activity on an installation from a user or organization account.
// The Webhook event name is "installation_target".
//
// GitHub API docs: https://docs.github.com/webhooks-and-events/webhooks/webhook-events-and-payloads#installation_target
type InstallationTargetEvent struct {
Account *User `json:"account,omitempty"`
Action *string `json:"action,omitempty"`
Changes *InstallationChanges `json:"changes,omitempty"`
Enterprise *Enterprise `json:"enterprise,omitempty"`
Installation *Installation `json:"installation,omitempty"`
Organization *Organization `json:"organization,omitempty"`
Repository *Repository `json:"repository,omitempty"`
Sender *User `json:"sender,omitempty"`
TargetType *string `json:"target_type,omitempty"`
}
// IssueCommentEvent is triggered when an issue comment is created on an issue
// or pull request.
// The Webhook event name is "issue_comment".
//
// GitHub API docs: https://docs.github.com/developers/webhooks-and-events/webhook-events-and-payloads#issue_comment
type IssueCommentEvent struct {
// Action is the action that was performed on the comment.
// Possible values are: "created", "edited", "deleted".
Action *string `json:"action,omitempty"`
Issue *Issue `json:"issue,omitempty"`
Comment *IssueComment `json:"comment,omitempty"`
// The following fields are only populated by Webhook events.
Changes *EditChange `json:"changes,omitempty"`
Repo *Repository `json:"repository,omitempty"`
Sender *User `json:"sender,omitempty"`
Installation *Installation `json:"installation,omitempty"`
// The following field is only present when the webhook is triggered on
// a repository belonging to an organization.
Organization *Organization `json:"organization,omitempty"`
}
// IssuesEvent is triggered when an issue is opened, edited, deleted, transferred,
// pinned, unpinned, closed, reopened, assigned, unassigned, labeled, unlabeled,
// locked, unlocked, milestoned, or demilestoned.
// The Webhook event name is "issues".
//
// GitHub API docs: https://docs.github.com/developers/webhooks-and-events/webhook-events-and-payloads#issues
type IssuesEvent struct {
// Action is the action that was performed. Possible values are: "opened",
// "edited", "deleted", "transferred", "pinned", "unpinned", "closed", "reopened",
// "assigned", "unassigned", "labeled", "unlabeled", "locked", "unlocked",
// "milestoned", or "demilestoned".
Action *string `json:"action,omitempty"`
Issue *Issue `json:"issue,omitempty"`
Assignee *User `json:"assignee,omitempty"`
Label *Label `json:"label,omitempty"`
// The following fields are only populated by Webhook events.
Changes *EditChange `json:"changes,omitempty"`
Repo *Repository `json:"repository,omitempty"`
Sender *User `json:"sender,omitempty"`
Installation *Installation `json:"installation,omitempty"`
Milestone *Milestone `json:"milestone,omitempty"`
// The following field is only present when the webhook is triggered on
// a repository belonging to an organization.
Org *Organization `json:"organization,omitempty"`
}
// LabelEvent is triggered when a repository's label is created, edited, or deleted.
// The Webhook event name is "label"
//
// GitHub API docs: https://docs.github.com/developers/webhooks-and-events/webhook-events-and-payloads#label
type LabelEvent struct {
// Action is the action that was performed. Possible values are:
// "created", "edited", "deleted"
Action *string `json:"action,omitempty"`
Label *Label `json:"label,omitempty"`
Changes *EditChange `json:"changes,omitempty"`
// The following fields are only populated by Webhook events.
Repo *Repository `json:"repository,omitempty"`
Org *Organization `json:"organization,omitempty"`
Sender *User `json:"sender,omitempty"`
Installation *Installation `json:"installation,omitempty"`
}
// MarketplacePurchaseEvent is triggered when a user purchases, cancels, or changes
// their GitHub Marketplace plan.
// Webhook event name "marketplace_purchase".
//
// GitHub API docs: https://docs.github.com/developers/webhooks-and-events/webhook-events-and-payloads#marketplace_purchase
type MarketplacePurchaseEvent struct {
// Action is the action that was performed. Possible values are:
// "purchased", "cancelled", "pending_change", "pending_change_cancelled", "changed".
Action *string `json:"action,omitempty"`
// The following fields are only populated by Webhook events.
EffectiveDate *Timestamp `json:"effective_date,omitempty"`
MarketplacePurchase *MarketplacePurchase `json:"marketplace_purchase,omitempty"`
PreviousMarketplacePurchase *MarketplacePurchase `json:"previous_marketplace_purchase,omitempty"`
Sender *User `json:"sender,omitempty"`
Installation *Installation `json:"installation,omitempty"`
// The following field is only present when the webhook is triggered on
// a repository belonging to an organization.
Org *Organization `json:"organization,omitempty"`
}
// MemberChangesPermission represents changes to a repository collaborator's permissions.
type MemberChangesPermission struct {
From *string `json:"from,omitempty"`
To *string `json:"to,omitempty"`
}
// MemberChangesRoleName represents changes to a repository collaborator's role.
type MemberChangesRoleName struct {
From *string `json:"from,omitempty"`
To *string `json:"to,omitempty"`
}
// MemberChanges represents changes to a repository collaborator's role or permission.
type MemberChanges struct {
Permission *MemberChangesPermission `json:"permission,omitempty"`
RoleName *MemberChangesRoleName `json:"role_name,omitempty"`
}
// MemberEvent is triggered when a user's membership as a collaborator to a repository changes.
// The Webhook event name is "member".
//
// GitHub API docs: https://docs.github.com/developers/webhooks-and-events/webhook-events-and-payloads#member
type MemberEvent struct {
// Action is the action that was performed. Possible values are:
//"added", "edited", "removed".
Action *string `json:"action,omitempty"`
Member *User `json:"member,omitempty"`
Changes *MemberChanges `json:"changes,omitempty"`
// The following fields are only populated by Webhook events.
Repo *Repository `json:"repository,omitempty"`
Sender *User `json:"sender,omitempty"`
Installation *Installation `json:"installation,omitempty"`
// The following field is only present when the webhook is triggered on
// a repository belonging to an organization.
Org *Organization `json:"organization,omitempty"`
}
// MembershipEvent is triggered when a user is added or removed from a team.
// The Webhook event name is "membership".
//
// Events of this type are not visible in timelines, they are only used to
// trigger organization webhooks.
//
// GitHub API docs: https://docs.github.com/developers/webhooks-and-events/webhook-events-and-payloads#membership
type MembershipEvent struct {
// Action is the action that was performed. Possible values are: "added", "removed".
Action *string `json:"action,omitempty"`
// Scope is the scope of the membership. Possible value is: "team".
Scope *string `json:"scope,omitempty"`
Member *User `json:"member,omitempty"`
Team *Team `json:"team,omitempty"`
// The following fields are only populated by Webhook events.
Org *Organization `json:"organization,omitempty"`
Sender *User `json:"sender,omitempty"`
Installation *Installation `json:"installation,omitempty"`
}
// MergeGroup represents the merge group in a merge queue.
type MergeGroup struct {
// The SHA of the merge group.
HeadSHA *string `json:"head_sha,omitempty"`
// The full ref of the merge group.
HeadRef *string `json:"head_ref,omitempty"`
// The SHA of the merge group's parent commit.
BaseSHA *string `json:"base_sha,omitempty"`
// The full ref of the branch the merge group will be merged into.
BaseRef *string `json:"base_ref,omitempty"`
// An expanded representation of the head_sha commit.
HeadCommit *Commit `json:"head_commit,omitempty"`
}
// MergeGroupEvent represents activity related to merge groups in a merge queue. The type of activity is specified
// in the action property of the payload object.
//
// GitHub API docs: https://docs.github.com/developers/webhooks-and-events/webhook-events-and-payloads#merge_group
type MergeGroupEvent struct {
// The action that was performed. Currently, can only be checks_requested.
Action *string `json:"action,omitempty"`
// The merge group.
MergeGroup *MergeGroup `json:"merge_group,omitempty"`
// The following fields are only populated by Webhook events.
Repo *Repository `json:"repository,omitempty"`
Org *Organization `json:"organization,omitempty"`
Installation *Installation `json:"installation,omitempty"`
Sender *User `json:"sender,omitempty"`
}
// MetaEvent is triggered when the webhook that this event is configured on is deleted.
// This event will only listen for changes to the particular hook the event is installed on.
// Therefore, it must be selected for each hook that you'd like to receive meta events for.
// The Webhook event name is "meta".
//
// GitHub API docs: https://docs.github.com/developers/webhooks-and-events/webhook-events-and-payloads#meta
type MetaEvent struct {
// Action is the action that was performed. Possible value is: "deleted".
Action *string `json:"action,omitempty"`
// The ID of the modified webhook.
HookID *int64 `json:"hook_id,omitempty"`
// The modified webhook.
// This will contain different keys based on the type of webhook it is: repository,
// organization, business, app, or GitHub Marketplace.
Hook *Hook `json:"hook,omitempty"`
// The following fields are only populated by Webhook events.
Repo *Repository `json:"repository,omitempty"`
Org *Organization `json:"organization,omitempty"`
Sender *User `json:"sender,omitempty"`
Installation *Installation `json:"installation,omitempty"`
}
// MilestoneEvent is triggered when a milestone is created, closed, opened, edited, or deleted.
// The Webhook event name is "milestone".
//
// GitHub API docs: https://docs.github.com/developers/webhooks-and-events/webhook-events-and-payloads#milestone
type MilestoneEvent struct {
// Action is the action that was performed. Possible values are:
// "created", "closed", "opened", "edited", "deleted"
Action *string `json:"action,omitempty"`
Milestone *Milestone `json:"milestone,omitempty"`
// The following fields are only populated by Webhook events.
Changes *EditChange `json:"changes,omitempty"`
Repo *Repository `json:"repository,omitempty"`
Sender *User `json:"sender,omitempty"`
Org *Organization `json:"organization,omitempty"`
Installation *Installation `json:"installation,omitempty"`
}
// OrganizationEvent is triggered when an organization is deleted and renamed, and when a user is added,
// removed, or invited to an organization.
// Events of this type are not visible in timelines. These events are only used to trigger organization hooks.
// Webhook event name is "organization".
//
// GitHub API docs: https://docs.github.com/developers/webhooks-and-events/webhook-events-and-payloads#organization
type OrganizationEvent struct {
// Action is the action that was performed.
// Possible values are: "deleted", "renamed", "member_added", "member_removed", or "member_invited".
Action *string `json:"action,omitempty"`
// Invitation is the invitation for the user or email if the action is "member_invited".
Invitation *Invitation `json:"invitation,omitempty"`
// Membership is the membership between the user and the organization.
// Not present when the action is "member_invited".
Membership *Membership `json:"membership,omitempty"`
Organization *Organization `json:"organization,omitempty"`
Sender *User `json:"sender,omitempty"`
Installation *Installation `json:"installation,omitempty"`
}
// OrgBlockEvent is triggered when an organization blocks or unblocks a user.
// The Webhook event name is "org_block".
//
// GitHub API docs: https://docs.github.com/developers/webhooks-and-events/webhook-events-and-payloads#org_block
type OrgBlockEvent struct {
// Action is the action that was performed.
// Can be "blocked" or "unblocked".
Action *string `json:"action,omitempty"`
BlockedUser *User `json:"blocked_user,omitempty"`
Organization *Organization `json:"organization,omitempty"`
Sender *User `json:"sender,omitempty"`
// The following fields are only populated by Webhook events.
Installation *Installation `json:"installation,omitempty"`
}
// PackageEvent represents activity related to GitHub Packages.
// The Webhook event name is "package".
//
// This event is triggered when a GitHub Package is published or updated.
//
// GitHub API docs: https://developer.github.com/webhooks/event-payloads/#package
type PackageEvent struct {
// Action is the action that was performed.
// Can be "published" or "updated".
Action *string `json:"action,omitempty"`
Package *Package `json:"package,omitempty"`
Repo *Repository `json:"repository,omitempty"`
Org *Organization `json:"organization,omitempty"`
Sender *User `json:"sender,omitempty"`
// The following fields are only populated by Webhook events.
Installation *Installation `json:"installation,omitempty"`
}
// PageBuildEvent represents an attempted build of a GitHub Pages site, whether
// successful or not.
// The Webhook event name is "page_build".
//
// This event is triggered on push to a GitHub Pages enabled branch (gh-pages
// for project pages, master for user and organization pages).
//
// Events of this type are not visible in timelines, they are only used to trigger hooks.
//
// GitHub API docs: https://docs.github.com/developers/webhooks-and-events/webhook-events-and-payloads#page_build
type PageBuildEvent struct {
Build *PagesBuild `json:"build,omitempty"`
// The following fields are only populated by Webhook events.
ID *int64 `json:"id,omitempty"`
Repo *Repository `json:"repository,omitempty"`
Sender *User `json:"sender,omitempty"`
Installation *Installation `json:"installation,omitempty"`
// The following field is only present when the webhook is triggered on
// a repository belonging to an organization.
Org *Organization `json:"organization,omitempty"`
}
// PersonalAccessTokenRequestEvent occurs when there is activity relating to a
// request for a fine-grained personal access token to access resources that
// belong to a resource owner that requires approval for token access.
// The webhook event name is "personal_access_token_request".
//
// GitHub API docs: https://docs.github.com/webhooks-and-events/webhooks/webhook-events-and-payloads#personal_access_token_request
type PersonalAccessTokenRequestEvent struct {
// Action is the action that was performed. Possible values are:
// "approved", "cancelled", "created" or "denied"
Action *string `json:"action,omitempty"`
PersonalAccessTokenRequest *PersonalAccessTokenRequest `json:"personal_access_token_request,omitempty"`
Org *Organization `json:"organization,omitempty"`
Sender *User `json:"sender,omitempty"`
Installation *Installation `json:"installation,omitempty"`
}
// PersonalAccessTokenRequest contains the details of a PersonalAccessTokenRequestEvent.
type PersonalAccessTokenRequest struct {
// Unique identifier of the request for access via fine-grained personal
// access token. Used as the pat_request_id parameter in the list and review
// API calls.
ID *int64 `json:"id,omitempty"`
Owner *User `json:"owner,omitempty"`
// New requested permissions, categorized by type of permission.
PermissionsAdded *PersonalAccessTokenPermissions `json:"permissions_added,omitempty"`
// Requested permissions that elevate access for a previously approved
// request for access, categorized by type of permission.
PermissionsUpgraded *PersonalAccessTokenPermissions `json:"permissions_upgraded,omitempty"`
// Permissions requested, categorized by type of permission.
// This field incorporates permissions_added and permissions_upgraded.
PermissionsResult *PersonalAccessTokenPermissions `json:"permissions_result,omitempty"`
// Type of repository selection requested. Possible values are:
// "none", "all" or "subset"
RepositorySelection *string `json:"repository_selection,omitempty"`
// The number of repositories the token is requesting access to.
// This field is only populated when repository_selection is subset.
RepositoryCount *int64 `json:"repository_count,omitempty"`
// An array of repository objects the token is requesting access to.
// This field is only populated when repository_selection is subset.
Repositories []*Repository `json:"repositories,omitempty"`
// Date and time when the request for access was created.
CreatedAt *Timestamp `json:"created_at,omitempty"`
// Whether the associated fine-grained personal access token has expired.
TokenExpired *bool `json:"token_expired,omitempty"`
// Date and time when the associated fine-grained personal access token expires.
TokenExpiresAt *Timestamp `json:"token_expires_at,omitempty"`
// Date and time when the associated fine-grained personal access token was last used for authentication.
TokenLastUsedAt *Timestamp `json:"token_last_used_at,omitempty"`
// The following field is only present when the webhook is triggered on
// a repository belonging to an organization.
Org *Organization `json:"organization,omitempty"`
}
// PersonalAccessTokenPermissions represents the original or newly requested
// scope of permissions for a fine-grained personal access token within a PersonalAccessTokenRequest.
type PersonalAccessTokenPermissions struct {
Org map[string]string `json:"organization,omitempty"`
Repo map[string]string `json:"repository,omitempty"`
Other map[string]string `json:"other,omitempty"`
}
// PingEvent is triggered when a Webhook is added to GitHub.
//
// GitHub API docs: https://developer.github.com/webhooks/#ping-event
type PingEvent struct {
// Random string of GitHub zen.
Zen *string `json:"zen,omitempty"`
// The ID of the webhook that triggered the ping.
HookID *int64 `json:"hook_id,omitempty"`
// The webhook configuration.
Hook *Hook `json:"hook,omitempty"`
// The following fields are only populated by Webhook events.
Repo *Repository `json:"repository,omitempty"`
Org *Organization `json:"organization,omitempty"`
Sender *User `json:"sender,omitempty"`
Installation *Installation `json:"installation,omitempty"`
}
// ProjectEvent is triggered when project is created, modified or deleted.
// The webhook event name is "project".
//
// GitHub API docs: https://docs.github.com/developers/webhooks-and-events/webhook-events-and-payloads#project