GH-200 · Question #13
Which command can you include in your workflow file to set the output parameter for an action?
The correct answer is D. echo "action_color=purple" >> $GITHUB_OUTPUT. Setting an output parameter Sets a step's output parameter. Note that the step will need an id to be defined to later retrieve the output value. You can set multi-line output values with the same technique used in the Multiline strings section to define multi-line environment…
Question
Which command can you include in your workflow file to set the output parameter for an action?
Options
- Aecho "action_color=purple" >> $GITHUB_ENV
- Becho "::debug::action_color=purple"
- Cecho "::add-mask::$ACTI0N_C0L0R"
- Decho "action_color=purple" >> $GITHUB_OUTPUT
How the community answered
(32 responses)- A3% (1)
- C6% (2)
- D91% (29)
Explanation
Setting an output parameter Sets a step's output parameter. Note that the step will need an id to be defined to later retrieve the output value. You can set multi-line output values with the same technique used in the Multiline strings section to define multi-line environment variables. echo "{name}={value}" >> "$GITHUB_OUTPUT" Example of setting an output parameter This example demonstrates how to set the SELECTED_COLOR output parameter and later - name: Set color id: color-selector run: echo "SELECTED_COLOR=green" >> "$GITHUB_OUTPUT" - name: Get color SELECTED_COLOR: ${{ steps.color-selector.outputs.SELECTED_COLOR }} run: echo "The selected color is $SELECTED_COLOR" https://docs.github.com/en/actions/reference/workflows-and-actions/workflow-commands
Topics
Community Discussion
No community discussion yet for this question.