I have a GitHub action that essentially is a bash script. The javascript portion of my action executes a bash script:
const core = require("@actions/core");
const exec = require("@actions/exec");
async function run() {
try {
// Execute bash script
await exec.exec(`${__dirname}/my-action-script.sh`);
} catch (error) {
core.setFailed(error.message);
}
}
run();
For now, this action will communicate with other actions by leaving files on the file system. This is an "invisible" way of communication and I would like to fill my action.yml with outputs. How can I enable my-action-script.sh to return me outputs defined in my action.yml?
the output must first be added to the action.yml, ex:
name: some GitHub workflow yaml file
description: some workflow description
runs:
using: node12
main: dist/index.js
inputs:
some_input:
description: some input
required: false
outputs:
some_output:
description: some output
and create the output from the bash script, ex:
echo ::set-output name=some_output::"$SOME_OUTPUT"
then you can use it in your workflow yaml, ex:
${{ steps.<step id>.outputs.some_output }}
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With