Skip to content

Commit fb88c2d

Browse files
committed
Add snapshot correlator action input
1 parent 58dce73 commit fb88c2d

File tree

7 files changed

+16
-5
lines changed

7 files changed

+16
-5
lines changed

.gitignore

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -67,4 +67,7 @@ typings/
6767
.next
6868

6969
# Output from scanning
70-
output.json
70+
output.json
71+
72+
# Component Detection binary downloaded by tests
73+
component-detection

README.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -34,6 +34,7 @@ directoryExclusionList | Filters out specific directories following a minimatch
3434
detectorArgs | 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. | `Pip=EnableIfDefaultOff`
3535
dockerImagesToScan |Comma separated list of docker image names or hashes to execute container scanning on | ubuntu:16.04,56bab49eef2ef07505f6a1b0d5bd3a601dfc3c76ad4460f24c91d6fa298369ab |
3636
detectorsFilter | A comma separated list with the identifiers of the specific detectors to be used. | `Pip, RustCrateDetector`
37+
correlator | An optional identifier to distinguish between multiple dependency snapshots of the same type. Defaults to the [job_id](https://docs.github.com/en/actions/using-workflows/workflow-syntax-for-github-actions#jobsjob_id) of the current job | `csharp-backend`
3738

3839
For more information: https://github.com/microsoft/component-detection
3940

action.yml

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,10 @@ inputs:
2121
detectorsFilter:
2222
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.'
2323
required: false
24+
correlator:
25+
description: 'An optional identifier to distinguish between multiple dependency snapshots of the same type.'
26+
type: string
27+
required: false
2428
runs:
2529
using: 'node16'
2630
main: 'dist/index.js'

componentDetection.test.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ test("Runs CLI", async () => {
1010
await ComponentDetection.downloadLatestRelease();
1111
await ComponentDetection.runComponentDetection("./test");
1212
expect(fs.existsSync(ComponentDetection.outputPath));
13-
});
13+
}, 6000);
1414

1515
test("Parses CLI output", async () => {
1616
await ComponentDetection.downloadLatestRelease();

dist/index.js

Lines changed: 3 additions & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

dist/index.js.map

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

index.ts

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,7 @@ import ComponentDetection from './componentDetection';
1414

1515
async function run() {
1616
let manifests = await ComponentDetection.scanAndGetManifests(core.getInput('filePath'));
17+
const correlatorInput = core.getInput('correlator')?.trim() || github.context.job;
1718

1819
let snapshot = new Snapshot({
1920
name: "Component Detection",
@@ -22,7 +23,7 @@ async function run() {
2223
},
2324
github.context,
2425
{
25-
correlator:`${github.context.job}`,
26+
correlator: correlatorInput,
2627
id: github.context.runId.toString()
2728
});
2829

0 commit comments

Comments
 (0)