8000 Add core to execution context by jclem · Pull Request #33 · actions/github-script · GitHub
[go: up one dir, main page]

Skip to content

Add core to execution context #33

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 3 commits into from
Mar 24, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations 8000
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 3 additions & 2 deletions .github/workflows/integration.yml
Original file line number Diff line number Diff line change
Expand Up @@ -8,9 +8,10 @@ jobs:
- id: output-set
uses: actions/github-script@master
with:
script: return 'test'
script: return core.getInput('input-value')
result-encoding: string
input-value: output
- run: |
if [[ "${{steps.output-set.outputs.result}}" != "test" ]]; then
if [[ "${{steps.output-set.outputs.result}}" != "output" ]]; then
exit 1
fi
1 change: 1 addition & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -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` A reference to the [@actions/core](https://github.com/actions/toolkit/tree/master/packages/core) package

Since the `script` is just a function body, these values will already be
defined, so you don't have to (see examples below).
Expand Down
2 changes: 1 addition & 1 deletion dist/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -9178,7 +9178,7 @@ async function main() {
const github = new lib_github.GitHub(token, opts);
const script = Object(core.getInput)('script', { required: true });
// Using property/value shorthand on `require` (e.g. `{require}`) causes compilatin errors.
const result = await callAsyncFunction({ require: __webpack_require__(875), github, context: lib_github.context }, script);
const result = await callAsyncFunction({ require: __webpack_require__(875), github, context: lib_github.context, core: core }, script);
let encoding = Object(core.getInput)('result-encoding');
encoding = encoding ? encoding : 'json';
let output;
Expand Down
2 changes: 1 addition & 1 deletion src/main.ts
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ async function main() {

// Using property/value shorthand on `require` (e.g. `{require}`) causes compilatin errors.
const result = await callAsyncFunction(
{require: require, github, context},
{require: require, github, context, core},
script
)

Expand Down
0