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.ymlfile and add the following code right under theinputssection but before therunssection:outputs: answer: description: 'The answer to everything (always 42)'
This defines one output with an ID of
answer. - Next, open
entrypoint.shand add the following line to the end of the file:echo "answer=42" >> $GITHUB_OUTPUT
This will set the output value for
answerto42. - Now, add the following lines to the end of
entrypoint.shto write some Markdown and HTML to the step summary:echo "### Hello $@! :rocket:" >> $GITHUB_STEP_SUMMARY echo "<h3...