JavaScript (node-script@v1)
Run JavaScript that needs Node.js modules, network access, the filesystem, or environment variables, with action-owned Node.js.
For data transforms that need none of these, use the built-in js.run step. It runs in an embedded sandbox and needs no Node.js download.
- Repository:
dagucloud/node-script - Runtime owned by the action:
nodejs/node@v22.21.1through actiontools
Contributions are welcome. The repository is public, so improvements, bug reports, and pull requests can go to dagucloud/node-script.
Example
yaml
steps:
- id: compute
action: node-script@v1
with:
input:
version: "1.2.3"
services: ["api", "worker"]
script: |
console.log("preparing release", input.version)
return {
tag: `v${input.version}`,
serviceCount: input.services.length
}
- id: print
run: echo "result=${steps.compute.outputs.result}"
depends: computescript is a JavaScript async function body. return publishes result. The action exposes input, params, env, and a captured console object.
Inputs
| Field | Description |
|---|---|
script | Required. JavaScript async function body to run. |
input | JSON-compatible value exposed to the script as input. |
env | Extra environment variables for the script, as a string map. |
timeoutSeconds | Script timeout in seconds, from 1 to 300. Defaults to 30. |
Outputs
| Field | Description |
|---|---|
ok | true when the script completed successfully. |
result | JSON-compatible value returned by the script. |
stdout | Text written through console.log, console.info, console.debug, or console.dir. |
stderr | Text written through console.warn or console.error. |
durationMs | Wrapper-measured script duration in milliseconds. |
nodeVersion | Node.js version used by the action. |
error | Error object when the script fails. |

