Adding output parameters and using job summaries
In this recipe, we’ll add an output parameter to the action that can be used in subsequent steps, and we are going to write content to the workflow job summary.
Getting ready…
You will have to finish the previous recipe to continue with this one.
How to do it…
- Open the
action.yml
file and add the following code right under theinputs
section but before theruns
section:outputs: answer: description: 'The answer to everything (always 42)'
This defines one output with an ID of
answer
. - Next, open
entrypoint.sh
and add the following line to the end of the file:echo "answer=42" >> $GITHUB_OUTPUT
This will set the output value for
answer
to42
. - Now, add the following lines to the end of
entrypoint.sh
to write some Markdown and HTML to the step summary:echo "### Hello $@! :rocket:" >> $GITHUB_STEP_SUMMARY echo "<h3...