@@ -65,7 +65,7 @@ func (cfp *ScanRepositoryCmd) scanAndFixRepository(repository *utils.Repository,
65
65
}
66
66
67
67
func (cfp * ScanRepositoryCmd ) scanAndFixBranch (repository * utils.Repository ) (err error ) {
68
- clonedRepoDir , restoreBaseDir , err := cfp .cloneRepositoryAndCheckoutToBranch (repository . RepoName )
68
+ clonedRepoDir , restoreBaseDir , err := cfp .cloneRepositoryAndCheckoutToBranch ()
69
69
if err != nil {
70
70
return
71
71
}
@@ -96,7 +96,19 @@ func (cfp *ScanRepositoryCmd) setCommandPrerequisites(repository *utils.Reposito
96
96
SetMinSeverity (repository .MinSeverity )
97
97
cfp .aggregateFixes = repository .Git .AggregateFixes
98
98
cfp .OutputWriter = outputwriter .GetCompatibleOutputWriter (repository .GitProvider )
99
- cfp .gitManager , err = utils .NewGitManager (cfp .details .Username , cfp .details .Token , cfp .details .Git , cfp .dryRun , cfp .dryRunRepoPath )
99
+ repositoryInfo , err := client .GetRepositoryInfo (context .Background (), cfp .details .RepoOwner , cfp .details .RepoName )
100
+ if err != nil {
101
+ return
102
+ }
103
+ remoteHttpsGitUrl := repositoryInfo .CloneInfo .HTTP
104
+ cfp .gitManager , err = utils .NewGitManager ().
105
+ SetAuth (cfp .details .Username , cfp .details .Token ).
106
+ SetDryRun (cfp .dryRun , cfp .dryRunRepoPath ).
107
+ SetRemoteGitUrl (remoteHttpsGitUrl )
108
+ if err != nil {
109
+ return
110
+ }
111
+ _ , err = cfp .gitManager .SetGitParams (cfp .details .Git )
100
112
return
101
113
}
102
114
@@ -359,15 +371,14 @@ func (cfp *ScanRepositoryCmd) preparePullRequestDetails(vulnerabilitiesDetails .
359
371
return pullRequestTitle , prBody , nil
360
372
}
361
373
362
- func (cfp * ScanRepositoryCmd ) cloneRepositoryAndCheckoutToBranch (repoName string ) (tempWd string , restoreDir func () error , err error ) {
374
+ func (cfp * ScanRepositoryCmd ) cloneRepositoryAndCheckoutToBranch () (tempWd string , restoreDir func () error , err error ) {
363
375
if cfp .dryRun {
364
- tempWd = filepath .Join (cfp .dryRunRepoPath , repoName )
376
+ tempWd = filepath .Join (cfp .dryRunRepoPath , cfp . details . RepoName )
365
377
} else {
366
378
// Create temp working directory
367
- tempWd , err = fileutils .CreateTempDir ()
368
- }
369
- if err != nil {
370
- return
379
+ if tempWd , err = fileutils .CreateTempDir (); err != nil {
380
+ return
381
+ }
371
382
}
372
383
log .Debug ("Created temp working directory:" , tempWd )
373
384
@@ -407,7 +418,9 @@ func (cfp *ScanRepositoryCmd) createVulnerabilitiesMap(scanResults *xrayutils.Ex
407
418
}
408
419
}
409
420
}
410
- log .Debug ("Frogbot will attempt to resolve the following vulnerable dependencies:\n " , strings .Join (maps .Keys (vulnerabilitiesMap ), ",\n " ))
421
+ if len (vulnerabilitiesMap ) > 0 {
422
+ log .Debug ("Frogbot will attempt to resolve the following vulnerable dependencies:\n " , strings .Join (maps .Keys (vulnerabilitiesMap ), ",\n " ))
423
+ }
411
424
return vulnerabilitiesMap , nil
412
425
}
413
426
0 commit comments