@@ -318,14 +318,15 @@ export class SbomCollector {
318318 if ( this . opts . forceSubmission ) {
319319 try {
320320 console . debug ( chalk . blue ( `Force-submission enabled: submitting component snapshot for ${ fullName } branch ${ b . name } ...` ) ) ;
321- await submitSnapshotIfPossible ( { octokit : this . octokit , owner : org , repo : repo . name , branch : b . name , languages : this . opts . submitLanguages , quiet : this . opts . quiet , componentDetectionBinPath : this . opts . componentDetectionBinPath } ) ;
322- // brief delay to allow snapshot ingestion
323- await new Promise ( r => setTimeout ( r , 1500 ) ) ;
321+ if ( await submitSnapshotIfPossible ( { octokit : this . octokit , owner : org , repo : repo . name , branch : b . name , languages : this . opts . submitLanguages , quiet : this . opts . quiet , componentDetectionBinPath : this . opts . componentDetectionBinPath } ) ) {
322+ // brief delay to allow snapshot ingestion
323+ await new Promise ( r => setTimeout ( r , 1500 ) ) ;
324+ }
324325 } catch ( subErr ) {
325326 console . error ( chalk . red ( `Force submission failed for ${ fullName } branch ${ b . name } : ${ ( subErr as Error ) . message } ` ) ) ;
326327 }
327328 }
328- const diff = await this . fetchDependencyReviewDiff ( org , repo . name , base , b . name , latestCommit , 1 ) ;
329+ const diff = await this . fetchDependencyReviewDiff ( org , repo . name , base , b . name , 1 , latestCommit ) ;
329330 branchDiffs . set ( b . name , diff ) ;
330331 }
331332 if ( branchDiffs . size ) sbom . branchDiffs = branchDiffs ;
@@ -499,7 +500,7 @@ export class SbomCollector {
499500 return branches ;
500501 }
501502
502- private async fetchDependencyReviewDiff ( org : string , repo : string , base : string , head : string , latestCommit ?: { sha ?: string ; commitDate ?: string , retries : number } ) : Promise < BranchDependencyDiff > {
503+ private async fetchDependencyReviewDiff ( org : string , repo : string , base : string , head : string , retries : number , latestCommit ?: { sha ?: string ; commitDate ?: string } ) : Promise < BranchDependencyDiff > {
503504 if ( ! this . octokit ) throw new Error ( "No Octokit instance" ) ;
504505 try {
505506 const basehead = `${ base } ...${ head } ` ;
@@ -536,7 +537,7 @@ export class SbomCollector {
536537 if ( ok ) {
537538 console . log ( chalk . blue ( `Snapshot submission attempted; waiting 3 seconds before retrying dependency review diff for ${ org } /${ repo } ${ base } ...${ head } ...` ) ) ;
538539 await new Promise ( r => setTimeout ( r , 3000 ) ) ;
539- return await this . fetchDependencyReviewDiff ( org , repo , base , head , latestCommit , retries -- ) ;
540+ return await this . fetchDependencyReviewDiff ( org , repo , base , head , retries -- , latestCommit ) ;
540541 }
541542 } catch ( subErr ) {
542543 console . error ( chalk . red ( `Snapshot submission failed for ${ org } /${ repo } branch ${ head } : ${ ( subErr as Error ) . message } ` ) ) ;
0 commit comments