Add support for failing check on HTTP error responses (#23)

This commit is contained in:
Anand Chowdhary 2020-08-29 06:36:49 +05:30 committed by GitHub
parent 0c4ba5b174
commit aff8b23be8
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 3 additions and 0 deletions

View File

@ -23,6 +23,9 @@ async function run() {
.then((res) => {
// output the status
core.setOutput('statusCode', res.status);
// throw error on error status codes
if (res.status >= 400)
throw new Error(`Failing with code: ${res.status}`)
// report on the status code
core.info(`Received status code: ${res.status}`);
// debug end