@@ -3,7 +3,6 @@ import * as path from "path";
3
3
import * as core from "@actions/core" ;
4
4
5
5
import {
6
- ActionStatus ,
7
6
createStatusReportBase ,
8
7
getActionsStatus ,
9
8
getActionVersion ,
@@ -95,20 +94,22 @@ interface InitToolsDownloadFields {
95
94
tools_feature_flags_valid ?: boolean ;
96
95
}
97
96
98
- async function sendInitStatusReport (
99
- actionStatus : ActionStatus ,
97
+ async function sendCompletedStatusReport (
100
98
startedAt : Date ,
101
99
config : configUtils . Config | undefined ,
102
100
toolsDownloadDurationMs : number | undefined ,
103
101
toolsFeatureFlagsValid : boolean | undefined ,
104
102
toolsSource : ToolsSource ,
105
103
toolsVersion : string ,
106
- logger : Logger
104
+ logger : Logger ,
105
+ error ?: Error
107
106
) {
108
107
const statusReportBase = await createStatusReportBase (
109
108
"init" ,
110
- actionStatus ,
111
- startedAt
109
+ getActionsStatus ( error ) ,
110
+ startedAt ,
111
+ error ?. message ,
112
+ error ?. stack
112
113
) ;
113
114
114
115
const workflowLanguages = getOptionalInput ( "languages" ) ;
@@ -366,23 +367,21 @@ async function run() {
366
367
367
368
core . setOutput ( "codeql-path" , config . codeQLCmd ) ;
368
369
} catch ( error ) {
369
- core . setFailed ( String ( error ) ) ;
370
-
370
+ core . setFailed ( error instanceof Error ? error . message : String ( error ) ) ;
371
371
console . log ( error ) ;
372
- await sendInitStatusReport (
373
- getActionsStatus ( error ) ,
372
+ await sendCompletedStatusReport (
374
373
startedAt ,
375
374
config ,
376
375
toolsDownloadDurationMs ,
377
376
toolsFeatureFlagsValid ,
378
377
toolsSource ,
379
378
toolsVersion ,
380
- logger
379
+ logger ,
380
+ error instanceof Error ? error : new Error ( String ( error ) )
381
381
) ;
382
382
return ;
383
383
}
384
- await sendInitStatusReport (
385
- "success" ,
384
+ await sendCompletedStatusReport (
386
385
startedAt ,
387
386
config ,
388
387
toolsDownloadDurationMs ,
0 commit comments