@@ -4,7 +4,7 @@ import { getConfig } from "./action.ts";
4
4
import * as api from "./api.ts" ;
5
5
import { getWorkflowRunResult , handleActionFail } from "./await-remote-run.ts" ;
6
6
import * as constants from "./constants.ts" ;
7
- import { WorkflowRunConclusion , WorkflowRunStatus } from "./types.ts" ;
7
+ import { WorkflowRunConclusion } from "./types.ts" ;
8
8
9
9
async function main ( ) : Promise < void > {
10
10
try {
@@ -29,21 +29,30 @@ async function main(): Promise<void> {
29
29
runId : config . runId ,
30
30
runTimeoutMs : config . runTimeoutSeconds * 1000 ,
31
31
} ) ;
32
- if ( result . success ) {
33
- core . info (
34
- "Run Completed:\n" +
35
- ` Run ID: ${ config . runId } \n` +
36
- ` Status: ${ WorkflowRunStatus . Completed } \n` +
37
- ` Conclusion: ${ WorkflowRunConclusion . Success } ` ,
38
- ) ;
39
- } else {
32
+ if ( ! result . success ) {
40
33
const elapsedTime = Date . now ( ) - startTime ;
41
34
const failureMsg =
42
35
result . reason === "timeout"
43
36
? `Timeout exceeded while attempting to await run conclusion (${ elapsedTime } ms)`
44
37
: `An unsupported value was reached: ${ result . value } ` ;
45
38
await handleActionFail ( failureMsg , config . runId ) ;
39
+ return ;
40
+ }
41
+
42
+ const { status, conclusion } = result . value ;
43
+ if ( conclusion === WorkflowRunConclusion . Success ) {
44
+ core . info (
45
+ "Run Completed:\n" +
46
+ ` Run ID: ${ config . runId } \n` +
47
+ ` Status: ${ status } \n` +
48
+ ` Conclusion: ${ conclusion } ` ,
49
+ ) ;
46
50
}
51
+
52
+ await handleActionFail (
53
+ `Run has concluded with ${ conclusion } ` ,
54
+ config . runId ,
55
+ ) ;
47
56
} catch ( error ) {
48
57
if ( error instanceof Error ) {
49
58
const failureMsg = `Failed: An unhandled error has occurred: ${ error . message } ` ;
0 commit comments