@@ -2,7 +2,7 @@ import * as core from '@actions/core'
2
2
import * as fs from 'fs'
3
3
import client from 'aws-sdk/clients/codedeploy'
4
4
5
- async function run ( ) {
5
+ async function run ( ) : Promise < void > {
6
6
try {
7
7
const appName = core . getInput ( 'application-name' )
8
8
const groupName = core . getInput ( 'deployment-group-name' )
@@ -16,26 +16,33 @@ async function run () {
16
16
core . debug ( '*** end appspecJson ***' )
17
17
18
18
const codeDeploy = new client ( )
19
- const deployment = await codeDeploy . createDeployment ( {
20
- applicationName : appName ,
21
- deploymentGroupName : groupName ,
22
- revision : {
23
- revisionType : 'AppSpecContent' ,
24
- appSpecContent : {
25
- content : appspecJson
19
+ const deployment = await codeDeploy
20
+ . createDeployment ( {
21
+ applicationName : appName ,
22
+ deploymentGroupName : groupName ,
23
+ revision : {
24
+ revisionType : 'AppSpecContent' ,
25
+ appSpecContent : {
26
+ content : appspecJson
27
+ }
26
28
}
27
- }
28
- } ) . promise ( )
29
+ } )
30
+ . promise ( )
29
31
core . debug ( `deployment: ${ JSON . stringify ( deployment ) } ` )
30
- await codeDeploy . waitFor ( 'deploymentSuccessful' , {
31
- deploymentId : deployment . deploymentId !
32
- } ) . promise ( )
32
+ if ( deployment . deploymentId == null ) {
33
+ core . setFailed ( 'deploymentId should not be null' )
34
+ return
35
+ }
36
+ await codeDeploy
37
+ . waitFor ( 'deploymentSuccessful' , {
38
+ deploymentId : deployment . deploymentId
39
+ } )
40
+ . promise ( )
33
41
34
42
process . exit ( 0 )
35
43
} catch ( error ) {
36
- console . error ( error )
44
+ core . error ( error )
37
45
core . setFailed ( error . message )
38
- process . exit ( 1 )
39
46
}
40
47
}
41
48
0 commit comments