Files
component-detection-depende…/index.ts
T

41 lines
1004 B
TypeScript
Raw Normal View History

2023-01-20 01:43:53 +00:00
import * as core from '@actions/core';
import * as github from '@actions/github';
2022-08-25 09:12:00 -07:00
2022-08-25 11:50:14 -07:00
import {
PackageCache,
BuildTarget,
Package,
Snapshot,
2022-10-04 13:16:36 -07:00
Manifest,
2022-08-25 11:50:14 -07:00
submitSnapshot
2023-01-20 00:41:22 +00:00
} from '@github/dependency-submission-toolkit';
2022-08-25 09:12:00 -07:00
2023-01-22 01:06:08 +00:00
import ComponentDetection from './componentDetection';
2023-01-20 00:05:59 +00:00
2022-08-25 09:12:00 -07:00
async function run() {
2023-01-22 07:42:01 +00:00
let manifests = await ComponentDetection.scanAndGetManifests(core.getInput('filePath'));
2025-04-03 05:21:10 +00:00
const correlatorInput = core.getInput('correlator')?.trim() || github.context.job;
2022-08-25 11:50:14 -07:00
let snapshot = new Snapshot({
2023-01-22 01:06:08 +00:00
name: "Component Detection",
2022-08-25 11:50:14 -07:00
version: "0.0.1",
2023-04-07 16:21:17 -07:00
url: "https://github.com/advanced-security/component-detection-dependency-submission-action",
2022-10-04 09:44:26 -07:00
},
github.context,
{
2025-04-03 05:21:10 +00:00
correlator: correlatorInput,
2022-10-04 09:44:26 -07:00
id: github.context.runId.toString()
2022-08-25 11:50:14 -07:00
});
2023-01-22 08:20:54 +00:00
core.debug(`Manifests: ${manifests?.length}`);
2022-08-25 12:49:25 -07:00
manifests?.forEach(manifest => {
2023-01-22 08:20:54 +00:00
core.debug(`Manifest: ${JSON.stringify(manifest)}`);
2022-08-25 12:49:25 -07:00
snapshot.addManifest(manifest);
2022-08-25 11:50:14 -07:00
});
submitSnapshot(snapshot);
}
2022-08-25 09:12:00 -07:00
run();