Add debugging statements

This commit is contained in:
Justin Hutchings
2023-01-22 07:20:25 +00:00
parent f0ab51072a
commit 82a0300769
4 changed files with 11 additions and 6 deletions

View File

@@ -9,10 +9,6 @@ inputs:
description: 'The path to the directory containing the environment files to upload. Defaults to Actions working directory.'
required: false
default: '.'
filePattern:
description: 'The file name pattern for environment files to upload'
required: false
default: 'environment.yaml'
runs:
using: 'node16'
main: 'dist/index.js'

View File

@@ -29,12 +29,14 @@ export default class ComponentDetection {
// Get the latest release from the component-detection repo, download the tarball, and extract it
private static async downloadLatestRelease() {
try {
core.debug("Downloading latest release");
const downloadURL = await this.getLatestReleaseURL();
const blob = await (await fetch(new URL(downloadURL))).blob();
const arrayBuffer = await blob.arrayBuffer();
const buffer = Buffer.from(arrayBuffer);
// Write the blob to a file
core.debug("Writing binary to file");
await fs.writeFile(this.componentDetectionPath, buffer, {mode: 0o777, flag: 'w'},
(err: any) => {
if (err) {
@@ -48,6 +50,7 @@ export default class ComponentDetection {
// Run the component-detection CLI on the path specified
private static async runComponentDetection(path: string) {
core.info("Running component-detection");
try {
await exec.exec(`${this.componentDetectionPath} scan --SourceDirectory ${path} --ManifestFile ${this.outputPath}`);
} catch (error: any) {
@@ -56,7 +59,7 @@ export default class ComponentDetection {
}
private static async getManifestsFromResults(): Promise<Manifest[]| undefined> {
core.info("Getting manifests from results");
try {
// Parse the result file and add the packages to the package cache
const packageCache = new PackageCache();
@@ -85,6 +88,7 @@ export default class ComponentDetection {
}
});
});
core.debug(JSON.stringify(packages));
// Create manifests
const manifests: Array<Manifest> = [];

5
dist/index.js generated vendored
View File

@@ -23753,11 +23753,13 @@ class ComponentDetection {
static downloadLatestRelease() {
return __awaiter(this, void 0, void 0, function* () {
try {
core.debug("Downloading latest release");
const downloadURL = yield this.getLatestReleaseURL();
const blob = yield (yield (0, cross_fetch_1.default)(new URL(downloadURL))).blob();
const arrayBuffer = yield blob.arrayBuffer();
const buffer = Buffer.from(arrayBuffer);
// Write the blob to a file
core.debug("Writing binary to file");
yield fs_1.default.writeFile(this.componentDetectionPath, buffer, { mode: 0o777, flag: 'w' }, (err) => {
if (err) {
core.error(err);
@@ -23772,6 +23774,7 @@ class ComponentDetection {
// Run the component-detection CLI on the path specified
static runComponentDetection(path) {
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}`);
}
@@ -23782,6 +23785,7 @@ class ComponentDetection {
}
static getManifestsFromResults() {
return __awaiter(this, void 0, void 0, function* () {
core.info("Getting manifests from results");
try {
// Parse the result file and add the packages to the package cache
const packageCache = new dependency_submission_toolkit_1.PackageCache();
@@ -23805,6 +23809,7 @@ class ComponentDetection {
}
}));
}));
core.debug(JSON.stringify(packages));
// Create manifests
const manifests = [];
// Check the locationsFoundAt for every package and add each as a manifest

2
dist/index.js.map generated vendored

File diff suppressed because one or more lines are too long