diff --git a/lib/input.js b/lib/input.js index 65405e53..6b848113 100644 --- a/lib/input.js +++ b/lib/input.js @@ -50,6 +50,10 @@ function getInputs() { const noprefix = nodetail || utils_1.stob(core.getInput('noprefix')); const proxyHost = core.getInput('proxyHost', { required: false, trimWhitespace: true }); const proxyPort = utils_1.asNumber(core.getInput('proxyPort', { required: false, trimWhitespace: true })); + if (proxyHost && proxyPort) { + process.env['http_proxy'] = `http://${proxyHost}:${proxyPort}`; + process.env['https_proxy'] = `http://${proxyHost}:${proxyPort}`; + } const inputs = { webhooks: webhooks, status: core.getInput('status', { trimWhitespace: true }).toLowerCase(), @@ -60,9 +64,7 @@ function getInputs() { username: core.getInput('username', { trimWhitespace: true }), avatar_url: core.getInput('avatar_url', { trimWhitespace: true }), nocontext: nocontext, - noprefix: noprefix, - proxyHost, - proxyPort + noprefix: noprefix }; if (!inputs.webhooks.length) { throw new Error("no webhook is given"); diff --git a/lib/main.js b/lib/main.js index ecc0da77..e606dbd5 100644 --- a/lib/main.js +++ b/lib/main.js @@ -50,19 +50,18 @@ function run() { utils_1.logInfo(JSON.stringify(payload, null, 2)); core_1.endGroup(); utils_1.logInfo(`Triggering ${inputs.webhooks.length} webhook${inputs.webhooks.length > 1 ? 's' : ''}...`); - yield Promise.all(inputs.webhooks.map(w => wrapWebhook(w.trim(), payload, inputs.proxyHost, inputs.proxyPort))); + yield Promise.all(inputs.webhooks.map(w => wrapWebhook(w.trim(), payload))); } catch (e) { utils_1.logError(`Unexpected failure: ${e} (${e.message})`); } }); } -function wrapWebhook(webhook, payload, proxyHost, proxyPort) { +function wrapWebhook(webhook, payload) { return function () { return __awaiter(this, void 0, void 0, function* () { try { - const proxy = proxyHost && proxyPort ? { proxy: { host: proxyHost, port: proxyPort, protocol: 'http' } } : {}; - yield axios_1.default.post(webhook, payload, proxy); + yield axios_1.default.post(webhook, payload); } catch (e) { if (e.response) {