Skip to content

Commit ec4f4bf

Browse files
committed
Print diagnostic message if snapshot creation is not SUCCESS or ACCEPTED
1 parent 9a8ccd0 commit ec4f4bf

File tree

1 file changed

+11
-4
lines changed

1 file changed

+11
-4
lines changed

src/snapshot.ts

Lines changed: 11 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,6 @@
11
import { Context } from '@actions/github/lib/context'
22
import * as core from '@actions/core'
33
import * as github from '@actions/github'
4-
import { Octokit } from '@octokit/rest'
54
import { RequestError } from '@octokit/request-error'
65
import { PullRequestEvent } from '@octokit/webhooks-types'
76

@@ -188,9 +187,17 @@ export async function submitSnapshot(
188187
...snapshot
189188
}
190189
)
191-
core.notice(
192-
'Snapshot successfully created at ' + response.data.created_at.toString()
193-
)
190+
const result = response.data.result
191+
if (result === 'SUCCESS' || result === 'ACCEPTED') {
192+
core.notice(
193+
'Snapshot successfully created at ' +
194+
response.data.created_at.toString()
195+
)
196+
} else {
197+
core.error(
198+
`Snapshot creation failed with result: "${result}: ${response.data.message}"`
199+
)
200+
}
194201
} catch (error) {
195202
if (error instanceof RequestError) {
196203
core.error(

0 commit comments

Comments
 (0)