diff --git a/action.yml b/action.yml index f162ef91..9eb21038 100644 --- a/action.yml +++ b/action.yml @@ -1,13 +1,18 @@ name: 'Webhook' -description: 'Wait a designated number of milliseconds' +description: 'Send a webhook event to anywhere!' inputs: - milliseconds: # id of input - description: 'number of milliseconds to wait' + url: + description: 'The url to send the webhook event to' required: true - default: '1000' + headers: + description: 'Additional headers to send alongside the defaults' + required: false + body: + description: 'The data sent to the webhook' + required: false outputs: - time: # output will be available to future steps - description: 'The message to output' + status: + description: 'The status of the webhook event' runs: using: 'node12' - main: 'dist/index.js' \ No newline at end of file + main: 'dist/main.js' \ No newline at end of file diff --git a/src/main.ts b/src/main.ts index 0516eca4..1a5668b2 100644 --- a/src/main.ts +++ b/src/main.ts @@ -1,7 +1,6 @@ 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'); @@ -15,13 +14,11 @@ async function run() { 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')); + http.make(url, headers, body) + .then((res) => core.setOutput('statusCode', res.status)); // debug end core.info((new Date()).toTimeString()); - - // output the time it took - core.setOutput('time', new Date().toTimeString()); } catch (error) { core.setFailed(error.message); }