@@ -18,18 +18,12 @@ arguments will be provided:
1818- ` core ` A reference to the [ @actions/core ] ( https://github.com/actions/toolkit/tree/main/packages/core ) package
1919- ` glob ` A reference to the [ @actions/glob ] ( https://github.com/actions/toolkit/tree/main/packages/glob ) package
2020- ` io ` A reference to the [ @actions/io ] ( https://github.com/actions/toolkit/tree/main/packages/io ) package
21- - ` require ` Is available, with some caveats:
22- - The location of the module that runs this action is where the Actions
23- runner downloads the github-script action to, so the ` require ` passed to
24- your script is actually a proxy that intercepts calls to require relative
25- paths and transforms them into an absolute path in the working directory,
26- instead.
27- - If you want to require an npm module in your working directory, you still
28- need to specify the relative path, including ` node_modules ` , such as
29- ` ./node_modules/lodash ` .
30- - If for some reason you need the non-wrapped ` require ` , there is an escape
31- hatch available: ` __original_require__ ` is the original value of ` require `
32- without our wrapping applied.
21+ - ` require ` A proxy wrapper around the normal Node.js ` require ` to enable
22+ requiring relative paths (relative to the current working directory) and
23+ requiring npm packages installed in the current working directory. If for
24+ some reason you need the non-wrapped ` require ` , there is an escape hatch
25+ available: ` __original_require__ ` is the original value of ` require ` without
26+ our wrapping applied.
3327
3428Since the ` script ` is just a function body, these values will already be
3529defined, so you don't have to (see examples below).
@@ -255,7 +249,7 @@ jobs:
255249 - uses : actions/github-script@v3
256250 with :
257251 script : |
258- const script = require(` ./path/to/script.js` )
252+ const script = require(' ./path/to/script.js' )
259253 console.log(script({github, context}))
260254` ` `
261255
@@ -295,7 +289,7 @@ jobs:
295289 SHA : ' ${{env.parentSHA}}'
296290 with :
297291 script : |
298- const script = require(` ./path/to/script.js` )
292+ const script = require(' ./path/to/script.js' )
299293 await script({github, context, core})
300294` ` `
301295
@@ -334,18 +328,13 @@ jobs:
334328 - uses : actions/github-script@v3
335329 with :
336330 script : |
337- const execa = require(`./node_modules/ execa` )
331+ const execa = require(' execa' )
338332
339333 const { stdout } = await execa('echo', ['hello', 'world'])
340334
341335 console.log(stdout)
342336` ` `
343337
344- _(Note that at this time, one still has to specify ` node_modules` in the
345- require path for modules in the working directory of the step that is
346- running. Hopefully we will have a solution for this in the future, but not
347- quite, yet.)_
348-
349338### Use env as input
350339
351340You can set env vars to use them in your script:
0 commit comments