Skip to content

Commit da6f095

Browse files
committed
Await tracking
1 parent da88c37 commit da6f095

5 files changed

Lines changed: 15 additions & 14 deletions

File tree

.eslintrc.json

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -47,7 +47,8 @@
4747
"@typescript-eslint/type-annotation-spacing": "error",
4848
"@typescript-eslint/unbound-method": "error",
4949
"no-console": "off",
50-
"import/no-commonjs": "off"
50+
"import/no-commonjs": "off",
51+
"github/no-then": "off"
5152
},
5253
"env": {
5354
"node": true,

src/approver/main.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,7 @@ async function run(): Promise<void> {
3636
}
3737

3838
run()
39-
.then(() => track({jobID, actionName: 'approver'}))
39+
.then(async () => await track({jobID, actionName: 'approver'}))
4040
.catch(error => {
4141
if (error instanceof Error) {
4242
track({jobID, actionName: 'approver', error: error.message})

src/baller/main.ts

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -22,12 +22,12 @@ async function run(): Promise<{jobId: string}> {
2222
}
2323

2424
run()
25-
.then(({jobId}) => {
26-
track({jobID: jobId, actionName: 'baller'})
25+
.then(async ({jobId}) => {
26+
await track({jobID: jobId, actionName: 'baller'})
2727
core.setOutput('codeball-job-id', jobId)
2828
})
29-
.catch(error => {
30-
track({actionName: 'baller', error: error.message})
29+
.catch(async error => {
30+
await track({actionName: 'baller', error: error.message})
3131
if (error instanceof Error) {
3232
core.setFailed(error.message)
3333
}

src/labeler/main.ts

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -73,10 +73,10 @@ const run = async (): Promise<void> => {
7373
}
7474

7575
run()
76-
.then(() => track({jobID, actionName: 'labeler'}))
77-
.catch(error => {
76+
.then(async () => await track({jobID, actionName: 'labeler'}))
77+
.catch(async error => {
7878
if (error instanceof Error) {
79-
track({jobID, actionName: 'labeler', error: error.message})
79+
await track({jobID, actionName: 'labeler', error: error.message})
8080
if (error.message === 'Resource not accessible by integration') {
8181
core.setFailed(
8282
'Codeball Labeler failed to access GitHub. Check the "GITHUB_TOKEN Permissions" of this job and make sure that the job has WRITE permissions to Pull Requests.'

src/status/main.ts

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -28,13 +28,13 @@ const run = async (jobID: string): Promise<boolean> => {
2828
const jobID = required('codeball-job-id')
2929

3030
run(jobID)
31-
.then(isApproved => {
32-
track({jobID, actionName: 'status'})
33-
core.setOutput('approved', isApproved)
31+
.then(async approved => {
32+
await track({jobID, actionName: 'status'})
33+
core.setOutput('approved', approved)
3434
})
35-
.catch(error => {
35+
.catch(async error => {
3636
if (error instanceof Error) {
37-
track({jobID, actionName: 'status', error: error.message})
37+
await track({jobID, actionName: 'status', error: error.message})
3838
core.setFailed(error.message)
3939
}
4040
})

0 commit comments

Comments
 (0)