@@ -289,7 +289,7 @@ func (d DiggerController) GithubSetupExchangeCode(c *gin.Context) {
289
289
})
290
290
}
291
291
292
- func createOrGetDiggerRepoForGithubRepo (ghRepoFullName string , ghRepoOrganisation string , ghRepoName string , ghRepoUrl string , installationId int64 ) (* models.Repo , * models.Organisation , error ) {
292
+ func createOrGetDiggerRepoForGithubRepo (ghRepoFullName string , ghRepoOrganisation string , ghRepoName string , ghRepoUrl string , installationId int64 , appId int64 , defaultBranch string , cloneUrl string ) (* models.Repo , * models.Organisation , error ) {
293
293
slog .Info ("Creating or getting Digger repo for GitHub repo" ,
294
294
slog .Group ("githubRepo" ,
295
295
slog .String ("fullName" , ghRepoFullName ),
@@ -331,6 +331,10 @@ func createOrGetDiggerRepoForGithubRepo(ghRepoFullName string, ghRepoOrganisatio
331
331
if r .RowsAffected > 0 {
332
332
slog .Info ("Digger repo already exists, restoring if deleted" , "diggerRepoName" , diggerRepoName , "repoId" , existingRepo .ID )
333
333
existingRepo .DeletedAt = gorm.DeletedAt {}
334
+ existingRepo .GithubAppId = appId
335
+ existingRepo .GithubAppInstallationId = installationId
336
+ existingRepo .CloneUrl = cloneUrl
337
+ existingRepo .DefaultBranch = defaultBranch
334
338
models .DB .GormDB .Save (& existingRepo )
335
339
return & existingRepo , org , nil
336
340
}
@@ -339,7 +343,7 @@ func createOrGetDiggerRepoForGithubRepo(ghRepoFullName string, ghRepoOrganisatio
339
343
repo , err := models .DB .CreateRepo (diggerRepoName , ghRepoFullName , ghRepoOrganisation , ghRepoName , ghRepoUrl , org , `
340
344
generate_projects:
341
345
include: "."
342
- ` )
346
+ ` , installationId , appId , defaultBranch , cloneUrl )
343
347
if err != nil {
344
348
slog .Error ("Error creating Digger repo" , "diggerRepoName" , diggerRepoName , "error" , err )
345
349
return nil , nil , err
@@ -2548,7 +2552,10 @@ func (d DiggerController) GithubAppCallbackPage(c *gin.Context) {
2548
2552
return
2549
2553
}
2550
2554
2551
- _ , _ , err = createOrGetDiggerRepoForGithubRepo (repoFullName , repoOwner , repoName , repoUrl , installationId64 )
2555
+ cloneUrl := * repo .CloneURL
2556
+ defaultBranch := * repo .DefaultBranch
2557
+
2558
+ _ , _ , err = createOrGetDiggerRepoForGithubRepo (repoFullName , repoOwner , repoName , repoUrl , installationId64 , * installation .AppID , defaultBranch , cloneUrl )
2552
2559
if err != nil {
2553
2560
slog .Error ("Error creating or getting Digger repo" ,
2554
2561
"repoFullName" , repoFullName ,
0 commit comments