Skip to content

Commit 64d4cba

Browse files
committed
fixed lint
1 parent 6008638 commit 64d4cba

File tree

1 file changed

+22
-15
lines changed

1 file changed

+22
-15
lines changed

src/index.ts

Lines changed: 22 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ import * as core from '@actions/core'
22
import * as fs from 'fs'
33
import client from 'aws-sdk/clients/codedeploy'
44

5-
async function run () {
5+
async function run(): Promise<void> {
66
try {
77
const appName = core.getInput('application-name')
88
const groupName = core.getInput('deployment-group-name')
@@ -16,26 +16,33 @@ async function run () {
1616
core.debug('*** end appspecJson ***')
1717

1818
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+
}
2628
}
27-
}
28-
}).promise()
29+
})
30+
.promise()
2931
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()
3341

3442
process.exit(0)
3543
} catch (error) {
36-
console.error(error)
44+
core.error(error)
3745
core.setFailed(error.message)
38-
process.exit(1)
3946
}
4047
}
4148

0 commit comments

Comments
 (0)