@@ -24,15 +24,16 @@ public class GHEventPayload {
24
24
// Webhook payload object common properties: action, sender, repository, organization, installation
25
25
private String action ;
26
26
private GHUser sender ;
27
- GHRepository repository ;
27
+ private GHRepository repository ;
28
28
private GHOrganization organization ;
29
- GHAppInstallation installation ;
29
+ private GHAppInstallation installation ;
30
30
31
31
GHEventPayload () {
32
32
}
33
33
34
34
/**
35
- * Most webhook payloads contain an action property that contains the specific activity that triggered the event.
35
+ * Gets the action for the triggered event. Most but not all webhook payloads contain an action property that
36
+ * contains the specific activity that triggered the event.
36
37
*
37
38
* @return event action
38
39
*/
@@ -112,11 +113,14 @@ void wrapUp(GitHub root) {
112
113
sender .wrapUp (root );
113
114
}
114
115
if (repository != null ) {
115
- repository .root = root ;
116
+ repository .wrap ( root ) ;
116
117
}
117
118
if (organization != null ) {
118
119
organization .wrapUp (root );
119
120
}
121
+ if (installation != null ) {
122
+ installation .wrapUp (root );
123
+ }
120
124
}
121
125
122
126
// List of events that still need to be added:
@@ -192,8 +196,8 @@ void wrapUp(GitHub root) {
192
196
if (checkRun == null )
193
197
throw new IllegalStateException (
194
198
"Expected check_run payload, but got something else. Maybe we've got another type of event?" );
199
+ GHRepository repository = getRepository ();
195
200
if (repository != null ) {
196
- repository .wrap (root );
197
201
checkRun .wrap (repository );
198
202
} else {
199
203
checkRun .wrap (root );
@@ -226,8 +230,8 @@ void wrapUp(GitHub root) {
226
230
if (checkSuite == null )
227
231
throw new IllegalStateException (
228
232
"Expected check_suite payload, but got something else. Maybe we've got another type of event?" );
233
+ GHRepository repository = getRepository ();
229
234
if (repository != null ) {
230
- repository .wrap (root );
231
235
checkSuite .wrap (repository );
232
236
} else {
233
237
checkSuite .wrap (root );
@@ -258,11 +262,10 @@ public List<GHRepository> getRepositories() {
258
262
@ Override
259
263
void wrapUp (GitHub root ) {
260
264
super .wrapUp (root );
261
- if (installation == null )
265
+ if (getInstallation () == null ) {
262
266
throw new IllegalStateException (
263
267
"Expected check_suite payload, but got something else. Maybe we've got another type of event?" );
264
- else
265
- installation .wrapUp (root );
268
+ }
266
269
267
270
if (repositories != null && !repositories .isEmpty ()) {
268
271
try {
@@ -320,11 +323,10 @@ public List<GHRepository> getRepositoriesRemoved() {
320
323
@ Override
321
324
void wrapUp (GitHub root ) {
322
325
super .wrapUp (root );
323
- if (installation == null )
326
+ if (getInstallation () == null ) {
324
327
throw new IllegalStateException (
325
328
"Expected check_suite payload, but got something else. Maybe we've got another type of event?" );
326
- else
327
- installation .wrapUp (root );
329
+ }
328
330
329
331
List <GHRepository > repositories ;
330
332
if ("added" .equals (getAction ()))
@@ -393,8 +395,8 @@ void wrapUp(GitHub root) {
393
395
if (pullRequest == null )
394
396
throw new IllegalStateException (
395
397
"Expected pull_request payload, but got something else. Maybe we've got another type of event?" );
398
+ GHRepository repository = getRepository ();
396
399
if (repository != null ) {
397
- repository .wrap (root );
398
400
pullRequest .wrapUp (repository );
399
401
} else {
400
402
pullRequest .wrapUp (root );
@@ -441,8 +443,8 @@ void wrapUp(GitHub root) {
441
443
442
444
review .wrapUp (pullRequest );
443
445
446
+ GHRepository repository = getRepository ();
444
447
if (repository != null ) {
445
- repository .wrap (root );
446
448
pullRequest .wrapUp (repository );
447
449
} else {
448
450
pullRequest .wrapUp (root );
@@ -489,8 +491,8 @@ void wrapUp(GitHub root) {
489
491
490
492
comment .wrapUp (pullRequest );
491
493
494
+ GHRepository repository = getRepository ();
492
495
if (repository != null ) {
493
- repository .wrap (root );
494
496
pullRequest .wrapUp (repository );
495
497
} else {
496
498
pullRequest .wrapUp (root );
@@ -531,8 +533,8 @@ public void setIssue(GHIssue issue) {
531
533
@ Override
532
534
void wrapUp (GitHub root ) {
533
535
super .wrapUp (root );
536
+ GHRepository repository = getRepository ();
534
537
if (repository != null ) {
535
- repository .wrap (root );
536
538
issue .wrap (repository );
537
539
} else {
538
540
issue .wrap (root );
@@ -593,8 +595,8 @@ public void setIssue(GHIssue issue) {
593
595
@ Override
594
596
void wrapUp (GitHub root ) {
595
597
super .wrapUp (root );
598
+ GHRepository repository = getRepository ();
596
599
if (repository != null ) {
597
- repository .wrap (root );
598
600
issue .wrap (repository );
599
601
} else {
600
602
issue .wrap (root );
@@ -636,8 +638,8 @@ public void setComment(GHCommitComment comment) {
636
638
@ Override
637
639
void wrapUp (GitHub root ) {
638
640
super .wrapUp (root );
641
+ GHRepository repository = getRepository ();
639
642
if (repository != null ) {
640
- repository .wrap (root );
641
643
comment .wrap (repository );
642
644
}
643
645
}
@@ -695,14 +697,6 @@ public String getMasterBranch() {
695
697
public String getDescription () {
696
698
return description ;
697
699
}
698
-
699
- @ Override
700
- void wrapUp (GitHub root ) {
701
- super .wrapUp (root );
702
- if (repository != null ) {
703
- repository .wrap (root );
704
- }
705
- }
706
700
}
707
701
708
702
/**
@@ -735,14 +729,6 @@ public String getRef() {
735
729
public String getRefType () {
736
730
return refType ;
737
731
}
738
-
739
- @ Override
740
- void wrapUp (GitHub root ) {
741
- super .wrapUp (root );
742
- if (repository != null ) {
743
- repository .wrap (root );
744
- }
745
- }
746
732
}
747
733
748
734
/**
@@ -777,8 +763,8 @@ public void setDeployment(GHDeployment deployment) {
777
763
@ Override
778
764
void wrapUp (GitHub root ) {
779
765
super .wrapUp (root );
766
+ GHRepository repository = getRepository ();
780
767
if (repository != null ) {
781
- repository .wrap (root );
782
768
deployment .wrap (repository );
783
769
}
784
770
}
@@ -837,8 +823,8 @@ public void setDeployment(GHDeployment deployment) {
837
823
@ Override
838
824
void wrapUp (GitHub root ) {
839
825
super .wrapUp (root );
826
+ GHRepository repository = getRepository ();
840
827
if (repository != null ) {
841
- repository .wrap (root );
842
828
deployment .wrap (repository );
843
829
deploymentStatus .wrap (repository );
844
830
}
@@ -878,9 +864,6 @@ public void setForkee(GHRepository forkee) {
878
864
void wrapUp (GitHub root ) {
879
865
super .wrapUp (root );
880
866
forkee .wrap (root );
881
- if (repository != null ) {
882
- repository .wrap (root );
883
- }
884
867
}
885
868
}
886
869
@@ -891,12 +874,6 @@ void wrapUp(GitHub root) {
891
874
* event</a>
892
875
*/
893
876
public static class Ping extends GHEventPayload {
894
- @ Override
895
- void wrapUp (GitHub root ) {
896
- super .wrapUp (root );
897
- if (repository != null )
898
- repository .wrap (root );
899
- }
900
877
901
878
}
902
879
@@ -908,13 +885,6 @@ void wrapUp(GitHub root) {
908
885
*/
909
886
public static class Public extends GHEventPayload {
910
887
911
- @ Override
912
- void wrapUp (GitHub root ) {
913
- super .wrapUp (root );
914
- if (repository != null )
915
- repository .wrap (root );
916
- }
917
-
918
888
}
919
889
920
890
/**
@@ -1038,13 +1008,6 @@ public String getCompare() {
1038
1008
return compare ;
1039
1009
}
1040
1010
1041
- @ Override
1042
- void wrapUp (GitHub root ) {
1043
- super .wrapUp (root );
1044
- if (repository != null )
1045
- repository .wrap (root );
1046
- }
1047
-
1048
1011
/**
1049
1012
* The type Pusher.
1050
1013
*/
@@ -1218,14 +1181,6 @@ public GHRelease getRelease() {
1218
1181
public void setRelease (GHRelease release ) {
1219
1182
this .release = release ;
1220
1183
}
1221
-
1222
- @ Override
1223
- void wrapUp (GitHub root ) {
1224
- super .wrapUp (root );
1225
- if (repository != null ) {
1226
- repository .wrap (root );
1227
- }
1228
- }
1229
1184
}
1230
1185
1231
1186
/**
@@ -1236,11 +1191,7 @@ void wrapUp(GitHub root) {
1236
1191
* @see <a href="https://docs.github.com/en/rest/reference/repos">Repositories</a>
1237
1192
*/
1238
1193
public static class Repository extends GHEventPayload {
1239
- @ Override
1240
- void wrapUp (GitHub root ) {
1241
- super .wrapUp (root );
1242
- repository .wrap (root );
1243
- }
1194
+
1244
1195
}
1245
1196
1246
1197
/**
@@ -1319,8 +1270,8 @@ void wrapUp(GitHub root) {
1319
1270
throw new IllegalStateException (
1320
1271
"Expected status payload, but got something else. Maybe we've got another type of event?" );
1321
1272
}
1273
+ GHRepository repository = getRepository ();
1322
1274
if (repository != null ) {
1323
- repository .wrap (root );
1324
1275
commit .wrapUp (repository );
1325
1276
}
1326
1277
}
0 commit comments