@@ -101,6 +101,12 @@ func (d DiggerController) GithubAppWebHook(c *gin.Context) {
101
101
return
102
102
}
103
103
}
104
+ case * github.PushEvent :
105
+ slog .Info ("Processing PushEvent" ,
106
+ "repo" , * event .Repo .FullName ,
107
+ )
108
+
109
+ go handlePushEvent (gh , event , appId64 )
104
110
105
111
case * github.IssueCommentEvent :
106
112
slog .Info ("Processing IssueCommentEvent" ,
@@ -384,11 +390,40 @@ func handleInstallationDeletedEvent(installation *github.InstallationEvent, appI
384
390
return nil
385
391
}
386
392
393
+ func handlePushEvent (gh utils.GithubClientProvider , payload * github.PushEvent , appId int64 ) error {
394
+ slog .Debug ("Handling push event" , "appId" , appId , "payload" , payload )
395
+ defer func () {
396
+ if r := recover (); r != nil {
397
+ stack := string (debug .Stack ())
398
+ slog .Error ("Recovered from panic in handlePushEvent" , "error" , r )
399
+ fmt .Printf ("Stack trace:\n %s\n " , stack )
400
+ }
401
+ }()
402
+
403
+ installationId := * payload .Installation .ID
404
+ repoName := * payload .Repo .Name
405
+ repoOwner := * payload .Repo .Owner .Login
406
+ repoFullName := * payload .Repo .FullName
407
+ cloneURL := * payload .Repo .CloneURL
408
+ ref := * payload .Ref
409
+ defaultBranch := * payload .Repo .DefaultBranch
410
+
411
+ if strings .HasSuffix (ref , defaultBranch ) {
412
+ err := services .LoadProjectsFromGithubRepo (gh , strconv .FormatInt (installationId , 10 ), repoFullName , repoOwner , repoName , cloneURL , defaultBranch )
413
+ if err != nil {
414
+ slog .Error ("Failed to load projects from GitHub repo" , "error" , err )
415
+ }
416
+ }
417
+
418
+ return nil
419
+ }
420
+
387
421
func handlePullRequestEvent (gh utils.GithubClientProvider , payload * github.PullRequestEvent , ciBackendProvider ci_backends.CiBackendProvider , appId int64 ) error {
388
422
defer func () {
389
423
if r := recover (); r != nil {
390
424
stack := string (debug .Stack ())
391
- slog .Error ("Recovered from panic in handlePullRequestEvent" , "error" , r , slog .Group ("stack" , slog .String ("trace" , stack )))
425
+ slog .Error ("Recovered from panic in handlePullRequestEvent" , "error" , r , slog .Group ("stack" ))
426
+ fmt .Printf ("Stack trace:\n %s\n " , stack )
392
427
}
393
428
}()
394
429
@@ -1151,7 +1186,8 @@ func handleIssueCommentEvent(gh utils.GithubClientProvider, payload *github.Issu
1151
1186
defer func () {
1152
1187
if r := recover (); r != nil {
1153
1188
stack := string (debug .Stack ())
1154
- slog .Error ("Recovered from panic in handleIssueCommentEvent" , "error" , r , slog .Group ("stack" , slog .String ("trace" , stack )))
1189
+ slog .Error ("Recovered from panic in handleIssueCommentEvent" , "error" , r , slog .Group ("stack" ))
1190
+ fmt .Printf ("Stack trace:\n %s\n " , stack )
1155
1191
}
1156
1192
}()
1157
1193
0 commit comments