@@ -44,31 +44,31 @@ export default class ComponentDetection {
44
44
try {
45
45
this . platform . logger . debug ( `Downloading latest release for ${ process . platform } ` ) ;
46
46
const downloadURL = await this . getLatestReleaseURL ( ) ;
47
-
47
+
48
48
if ( ! downloadURL ) {
49
49
throw new Error ( `No download URL found for platform: ${ process . platform } ` ) ;
50
50
}
51
-
51
+
52
52
this . platform . logger . debug ( `Download URL: ${ downloadURL } ` ) ;
53
-
53
+
54
54
const response = await fetch ( new URL ( downloadURL ) ) ;
55
55
if ( ! response . ok ) {
56
56
throw new Error ( `Failed to download component-detection: ${ response . status } ${ response . statusText } ` ) ;
57
57
}
58
-
58
+
59
59
const blob = await response . blob ( ) ;
60
60
const arrayBuffer = await blob . arrayBuffer ( ) ;
61
61
const buffer = new Uint8Array ( arrayBuffer ) ;
62
62
63
63
// Write the blob to a file
64
64
this . platform . logger . debug ( `Writing binary to file ${ this . componentDetectionPath } ` ) ;
65
65
fs . writeFileSync ( this . componentDetectionPath , buffer , { mode : 0o777 , flag : 'w' } ) ;
66
-
66
+
67
67
// Verify the file was created and is executable
68
68
if ( ! fs . existsSync ( this . componentDetectionPath ) ) {
69
69
throw new Error ( `Failed to create component-detection executable at ${ this . componentDetectionPath } ` ) ;
70
70
}
71
-
71
+
72
72
this . platform . logger . debug ( `Successfully downloaded and saved component-detection to ${ this . componentDetectionPath } ` ) ;
73
73
} catch ( error : any ) {
74
74
this . platform . logger . error ( `Error downloading component-detection: ${ error . message } ` ) ;
@@ -104,12 +104,12 @@ export default class ComponentDetection {
104
104
105
105
try {
106
106
await exec . exec ( command ) ;
107
-
107
+
108
108
// Verify the output file was created
109
109
if ( ! fs . existsSync ( this . outputPath ) ) {
110
110
throw new Error ( `Component detection completed but output file ${ this . outputPath } was not created` ) ;
111
111
}
112
-
112
+
113
113
this . platform . logger . debug ( `Component detection completed successfully. Output file: ${ this . outputPath } ` ) ;
114
114
} catch ( error : any ) {
115
115
this . platform . logger . error ( `Component detection execution failed: ${ error . message } ` ) ;
@@ -129,18 +129,18 @@ export default class ComponentDetection {
129
129
130
130
public static async getManifestsFromResults ( ) : Promise < Manifest [ ] | undefined > {
131
131
this . platform . logger . info ( "Getting manifests from results" ) ;
132
-
132
+
133
133
if ( ! fs . existsSync ( this . outputPath ) ) {
134
134
throw new Error ( `Output file ${ this . outputPath } does not exist. Component detection may have failed.` ) ;
135
135
}
136
-
136
+
137
137
try {
138
138
const results = await fs . readFileSync ( this . outputPath , 'utf8' ) ;
139
139
if ( ! results . trim ( ) ) {
140
140
this . platform . logger . warning ( `Output file ${ this . outputPath } is empty` ) ;
141
141
return [ ] ;
142
142
}
143
-
143
+
144
144
var json : any = JSON . parse ( results ) ;
145
145
let dependencyGraphs : DependencyGraphs = this . normalizeDependencyGraphPaths ( json . dependencyGraphs , this . platform . input . getInput ( 'filePath' ) ) ;
146
146
return this . processComponentsToManifests ( json . componentsFound , dependencyGraphs ) ;
@@ -347,9 +347,9 @@ export default class ComponentDetection {
347
347
348
348
// For accessing public repositories, don't use auth if no token is provided
349
349
// This prevents "Bad credentials" errors when accessing public repos
350
- const octokitConfig : any = {
351
- baseUrl : githubAPIURL ,
352
- request : { fetch : fetch } ,
350
+ const octokitConfig : any = {
351
+ baseUrl : githubAPIURL ,
352
+ request : { fetch : fetch } ,
353
353
log : {
354
354
debug : this . platform . logger . debug ,
355
355
info : this . platform . logger . info ,
@@ -374,10 +374,10 @@ export default class ComponentDetection {
374
374
375
375
var downloadURL : string = "" ;
376
376
const assetName = process . platform === "win32" ? "component-detection-win-x64.exe" : "component-detection-linux-x64" ;
377
-
377
+
378
378
this . platform . logger . debug ( `Looking for asset: ${ assetName } ` ) ;
379
379
this . platform . logger . debug ( `Available assets: ${ latestRelease . data . assets . map ( a => a . name ) . join ( ', ' ) } ` ) ;
380
-
380
+
381
381
latestRelease . data . assets . forEach ( ( asset : any ) => {
382
382
if ( asset . name === assetName ) {
383
383
downloadURL = asset . browser_download_url ;
0 commit comments