Skip to content

Commit 5ac59f7

Browse files
committed
Merge branch 'dependency-review' of https://github.com/advanced-security/github-sbom-toolkit into dependency-review
2 parents e3aaf6f + 4dcf2b3 commit 5ac59f7

File tree

2 files changed

+4
-6
lines changed

2 files changed

+4
-6
lines changed

src/componentDetection.ts

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,7 @@ export default class ComponentDetection {
3434
// This is the default entry point for this class.
3535
// If executablePath is provided, use it directly and skip download.
3636
async scanAndGetManifests(path: string): Promise<Manifest[] | undefined> {
37-
if (!this.componentDetectionPath) {
37+
if (!fs.existsSync(this.componentDetectionPath)) {
3838
await this.downloadLatestRelease();
3939
}
4040

@@ -272,9 +272,7 @@ export default class ComponentDetection {
272272
if (packageUrlJson.Version) {
273273
packageUrl += `@${packageUrlJson.Version}`;
274274
}
275-
if (typeof packageUrlJson.Qualifiers === "object"
276-
&& packageUrlJson.Qualifiers !== null
277-
&& Object.keys(packageUrlJson.Qualifiers).length > 0) {
275+
if (packageUrlJson.Qualifiers && Object.keys(packageUrlJson.Qualifiers).length > 0) {
278276
const qualifierString = Object.entries(packageUrlJson.Qualifiers)
279277
.map(([key, value]) => `${key}=${value}`)
280278
.join("&");

src/sbomCollector.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -260,7 +260,7 @@ export class SbomCollector {
260260
this.decisions[fullName] = `Fetching because error comparing pushed_at (${baseline.repoPushedAt} / ${repo.pushed_at})`;
261261
}
262262
} else {
263-
this.decisions[fullName] = baseline ? `Fetching because missing pushed_at (${baseline.repoPushedAt} / ${repo.pushed_at})` : "Fetching because no baseline";
263+
this.decisions[fullName] = baseline ? `Fetching because of missing pushed_at (${baseline.repoPushedAt} / ${repo.pushed_at})` : "Fetching because no baseline";
264264
}
265265

266266
let sbom: RepositorySbom | undefined = undefined;
@@ -540,7 +540,7 @@ export class SbomCollector {
540540
if (ok) {
541541
console.log(chalk.blue(`Snapshot submission attempted; waiting 3 seconds before retrying dependency review diff for ${org}/${repo} ${base}...${head}...`));
542542
await new Promise(r => setTimeout(r, 3000));
543-
return await this.fetchDependencyReviewDiff(org, repo, base, head, --retries, latestCommit);
543+
return await this.fetchDependencyReviewDiff(org, repo, base, head, retries - 1, latestCommit);
544544
}
545545
} catch (subErr) {
546546
console.error(chalk.red(`Snapshot submission failed for ${org}/${repo} branch ${head}: ${(subErr as Error).message}`));

0 commit comments

Comments
 (0)