From 62c536d2e035572fc74bd8854154b7c495af8acb Mon Sep 17 00:00:00 2001 From: Wouter de Vos Date: Tue, 8 Oct 2019 21:19:45 +0200 Subject: [PATCH] Make @actions/core accessible to scripts --- README.md | 1 + main.js | 4 ++-- 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/README.md b/README.md index 886b0ef..9dd8f92 100644 --- a/README.md +++ b/README.md @@ -11,6 +11,7 @@ be provided: [octokit/rest.js](https://github.com/octokit/rest.js) client - `context` An object containing the [context of the workflow run](https://github.com/actions/toolkit/tree/master/packages/github) +- `core` Functions for inputs, outputs, results, logging, secrets and variables from [@actions/core](https://github.com/actions/toolkit/blob/master/packages/core) Since the `script` is just a function body, these values will already be defined, so you don't have to (see examples below). diff --git a/main.js b/main.js index 1cc8321..6ff5789 100644 --- a/main.js +++ b/main.js @@ -16,8 +16,8 @@ async function main() { if (previews != null) opts.previews = previews.split(',') const client = new GitHub(token, opts) const script = core.getInput('script', {required: true}) - const fn = new AsyncFunction('github', 'context', script) - const result = await fn(client, context) + const fn = new AsyncFunction('github', 'context', 'core', script) + const result = await fn(client, context, core) core.setOutput('result', JSON.stringify(result)) }