2020-08-25 23:36:04 +00:00
|
|
|
import * as core from '@actions/core';
|
|
|
|
import { http } from './http';
|
|
|
|
|
|
|
|
async function run() {
|
|
|
|
try {
|
|
|
|
const url = core.getInput('url');
|
|
|
|
const headers = core.getInput('headers') ?? '';
|
|
|
|
const body = core.getInput('body') ?? '';
|
|
|
|
|
|
|
|
// initial info
|
|
|
|
core.info(`Sending webhook request to ${url}...`);
|
|
|
|
|
|
|
|
// debug start
|
|
|
|
core.debug((new Date()).toTimeString()); // debug is only output if you set the secret `ACTIONS_RUNNER_DEBUG` to true
|
|
|
|
|
|
|
|
// make the request
|
2020-08-25 23:50:21 +00:00
|
|
|
http.make(url, headers, body)
|
|
|
|
.then((res) => core.setOutput('statusCode', res.status));
|
2020-08-25 23:36:04 +00:00
|
|
|
|
|
|
|
// debug end
|
|
|
|
core.info((new Date()).toTimeString());
|
|
|
|
} catch (error) {
|
|
|
|
core.setFailed(error.message);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
run();
|