Add support for additional CLI parameters

This commit is contained in:
Justin Hutchings
2023-01-22 19:46:41 +00:00
parent f78092ab95
commit 2429993ba1
6 changed files with 39 additions and 4 deletions
+11 -1
View File
@@ -49,12 +49,22 @@ export default class ComponentDetection {
core.info("Running component-detection");
try {
await exec.exec(`${this.componentDetectionPath} scan --SourceDirectory ${path} --ManifestFile ${this.outputPath}`);
await exec.exec(`${this.componentDetectionPath} scan --SourceDirectory ${path} --ManifestFile ${this.outputPath} ${this.getComponentDetectionParameters()}`);
} catch (error: any) {
core.error(error);
}
}
private static getComponentDetectionParameters(): string {
var parameters = "";
parameters += (core.getInput('directoryExclusionList')) ? ` --DirectoryExclusionList ${core.getInput('directoryExclusionList')}` : "";
parameters += (core.getInput('ignoreDirectories')) ? ` --IgnoreDirectories ${core.getInput('ignoreDirectories')}` : "";
parameters += (core.getInput('detectorArgs')) ? ` --DetectorArgs ${core.getInput('detectorArgs')}` : "";
parameters += (core.getInput('detectorsFilter')) ? ` --DetectorsFilter ${core.getInput('detectorsFilter')}` : "";
parameters += (core.getInput('dockerImagesToScan')) ? ` --DockerImagesToScan ${core.getInput('dockerImagesToScan')}` : "";
return parameters;
}
private static async getManifestsFromResults(): Promise<Manifest[]| undefined> {
core.info("Getting manifests from results");
// Parse the result file and add the packages to the package cache