jsgithubactionemulator v1.0.5
Js GitHub actions emulator
The goal of this package is to help develop JavaScript Github actions. It allows local debugging replicating the @github/actions package API.
how to use
install
npm install jsgithubactionemulatoruse
In your action's index.js (or whatever the main script name is), simply replace
const core = require("@actions/core");with
const core = require("../JsGithubActionEmulator/core");then you can write your action as if you
debug locally
configure
the jsgithubactionemulator uses a .env file to get the action inputs.
All inputs must be prefixed with GHA_ as in 🧮
GHA_input1=1
GHA_input2=some value
GHA_input3=true There is one special value GHA_EMULATE (dfeault is false) that states if emulation must be activated. this way you can publish your actions with a reference to jsgithubactionemulator. In a github workflow environment the .env file wont be there and jsgithubactionemulator will redirect calls to @actions/core package
run locally
simply run !
node index.jsfull example
I've used this emulator to develop the badges-cache-purge git hub action. You can look at the index.json for an integration of this emulator.