mirror of
https://github.com/joelwmale/webhook-action.git
synced 2024-08-25 08:08:00 +00:00
30 lines
819 B
TypeScript
30 lines
819 B
TypeScript
|
import * as core from '@actions/core';
|
||
|
import { http } from './http';
|
||
|
|
||
|
// most @actions toolkit packages have async methods
|
||
|
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
|
||
|
http.make(url, headers, body).then((res) => console.log('hi'));
|
||
|
|
||
|
// debug end
|
||
|
core.info((new Date()).toTimeString());
|
||
|
|
||
|
// output the time it took
|
||
|
core.setOutput('time', new Date().toTimeString());
|
||
|
} catch (error) {
|
||
|
core.setFailed(error.message);
|
||
|
}
|
||
|
}
|
||
|
|
||
|
run();
|