diff --git a/dist/index.js b/dist/index.js index fa850e6..8ca5edc 100644 --- a/dist/index.js +++ b/dist/index.js @@ -8737,14 +8737,20 @@ const core = __nccwpck_require__(186); async function run() { const SERVICEID = core.getInput('service-id') || process.env.SERVICEID; - const APIKEY = core.getInput('api-key') || process.env.APIKEY; - + const APIKEY = core.getInput('api-key') || process.env.APIKEY; + const response = await fetch('https://api.render.com/v1/services/' + SERVICEID + '/deploys', { method: 'POST', headers: { 'Authorization': `Bearer ${APIKEY}`} - }) + }) - core.info(`Response received: ${response.status}`) + response.json().then(data => { + if (response.ok) { + core.info(`Deploy ${data.status} - Commit: ${data.commit.message}`) + } else { + core.setFailed(`Deploy error: ${data.message} (status code ${response.status})`) + } + }); } run().catch(e => core.setFailed(e.message)); diff --git a/src/action.js b/src/action.js index d96a322..3f22bd6 100644 --- a/src/action.js +++ b/src/action.js @@ -3,14 +3,20 @@ const core = require('@actions/core'); async function run() { const SERVICEID = core.getInput('service-id') || process.env.SERVICEID; - const APIKEY = core.getInput('api-key') || process.env.APIKEY; - + const APIKEY = core.getInput('api-key') || process.env.APIKEY; + const response = await fetch('https://api.render.com/v1/services/' + SERVICEID + '/deploys', { method: 'POST', headers: { 'Authorization': `Bearer ${APIKEY}`} - }) + }) - core.info(`Response received: ${response.status}`) + response.json().then(data => { + if (response.ok) { + core.info(`Deploy ${data.status} - Commit: ${data.commit.message}`) + } else { + core.setFailed(`Deploy error: ${data.message} (status code ${response.status})`) + } + }); } run().catch(e => core.setFailed(e.message)); \ No newline at end of file