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
+1 -1
View File
@@ -23,4 +23,4 @@ jobs:
- uses: actions/checkout@v3
- name: Component detection
uses: jhutchings1/component-detection-action@v0.0.1
```
```
+15
View File
@@ -9,6 +9,21 @@ inputs:
description: 'The path to the directory containing the environment files to upload. Defaults to Actions working directory.'
required: false
default: '.'
directoryExclusionList:
description: 'Filters out specific directories following a minimatch pattern.'
required: false
ignoreDirectories:
description: 'Filters out specific directories, providing individual directory paths separated by semicolon. Obsolete in favor of DirectoryExclusionList's glob syntax.'
required: false
detectorArgs:
description: 'Comma separated list of properties that can affect the detectors execution, like EnableIfDefaultOff that allows a specific detector that is in beta to run, the format for this property is DetectorId=EnableIfDefaultOff, for example Pip=EnableIfDefaultOff.'
required: false
dockerImagesToScan:
description: 'Comma separated list of docker image names or hashes to execute container scanning on, ex: ubuntu:16.04,56bab49eef2ef07505f6a1b0d5bd3a601dfc3c76ad4460f24c91d6fa298369ab'
required: false
detectorsFilter:
description: 'A comma separated list with the identifiers of the specific detectors to be used. This is meant to be used for testing purposes only.'
required: false
runs:
using: 'node16'
main: 'dist/index.js'
+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
+1
View File
@@ -5,6 +5,7 @@ export default class ComponentDetection {
static scanAndGetManifests(path: string): Promise<Manifest[] | undefined>;
private static downloadLatestRelease;
private static runComponentDetection;
private static getComponentDetectionParameters;
private static getManifestsFromResults;
private static getDependencyScope;
private static makePackageUrl;
Generated Vendored
+10 -1
View File
@@ -23772,13 +23772,22 @@ class ComponentDetection {
return __awaiter(this, void 0, void 0, function* () {
core.info("Running component-detection");
try {
yield exec.exec(`${this.componentDetectionPath} scan --SourceDirectory ${path} --ManifestFile ${this.outputPath}`);
yield exec.exec(`${this.componentDetectionPath} scan --SourceDirectory ${path} --ManifestFile ${this.outputPath} ${this.getComponentDetectionParameters()}`);
}
catch (error) {
core.error(error);
}
});
}
static getComponentDetectionParameters() {
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;
}
static getManifestsFromResults() {
return __awaiter(this, void 0, void 0, function* () {
core.info("Getting manifests from results");
Generated Vendored
+1 -1
View File
File diff suppressed because one or more lines are too long