Core functions for setting results, logging, registering secrets and exporting variables across actions
Import the package
Action inputs can be read with
getInput. Outputs can be set with
setOutput which makes them available to be mapped into inputs of other actions to ensure they are decoupled.
const myInput = core;core;
Since each step runs in a separate process, you can use
exportVariable to add it to this step and future steps environment blocks.
Setting a secret
Setting a secret registers the secret with the runner to ensure it is masked in logs.
To make a tool's path available in the path for the remainder of the job (without altering the machine or containers state), use
addPath. The runner will prepend the path given to the jobs PATH.
You should use this library to set the failing exit code for your action. If status is not set and the script runs to completion, that will lead to a success.
const core = ;try// Do stuffcatch err// setFailed logs the message and sets a failing exit codecore;Note that `setNeutral` is not yet implemented in actions V2 but equivalent functionality is being planned
Finally, this library provides some utilities for logging. Note that debug logging is hidden from the logs by default. This behavior can be toggled by enabling the Step Debug Logs.
const core = ;const myInput = core;trycore;if !myInputcore;// Do stuffcatch errcore;
This library can also wrap chunks of output in foldable groups.
const core =// Manually wrap outputcorecore// Wrap an asynchronous function callconst result = await core
You can use this library to save state and get state for sharing information between a given wrapper action:
name: 'Wrapper action sample'inputs:name:default: 'GitHub'runs:using: 'node12'main: 'main.js'post: 'cleanup.js'
const core = ;core;
const core = ;var pid = core;process;