mirror of
https://github.com/joelwmale/webhook-action.git
synced 2026-08-31 14:39:48 +08:00
Add support for failing check on HTTP error responses (#23)
This commit is contained in:
@@ -23,6 +23,9 @@ async function run() {
|
|||||||
.then((res) => {
|
.then((res) => {
|
||||||
// output the status
|
// output the status
|
||||||
core.setOutput('statusCode', res.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
|
// report on the status code
|
||||||
core.info(`Received status code: ${res.status}`);
|
core.info(`Received status code: ${res.status}`);
|
||||||
// debug end
|
// debug end
|
||||||
|
|||||||
Reference in New Issue
Block a user