script-action
An alternative to the official github-script action, with some additional features.
Usage
See action.yml.
- uses: silverlyra/script-action@v0.2
with:
script: >
console.log("Hello, world!");
input: 'null'
input-encoding: 'json'
result-encoding: 'json'
cwd: '.'
github-token: ${{ github.token }}
Script
The JavaScript passed as the script
input will have the following values predefined:
input
: The input
passed to the action, via with:
env
: An object containing all environment variables (process.env
)
Scripts also have access to some helper functions:
fetch
: The fetch functionreadEvent
: Read the GitHub event JSON file off of disk; return the event name
and its data
shell
: Spawn a process and (optionally) capture its output
These packages are also available:
fs
: The Node.js fs/promises modulepath
: The Node.js path moduleartifact
: The @actions/artifact NPM packagechalk
: The chalk NPM packagecore
: The @actions/core NPM packageexec
: The @actions/exec NPM packageglob
: The @actions/glob NPM packageio
: The @actions/io NPM package