nerdexam
Microsoft

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…

Implement and manage GitHub Actions workflows

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)
  • A
    3% (1)
  • C
    6% (2)
  • D
    91% (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

#GitHub Actions#Workflow outputs#Action communication#Workflow commands

Community Discussion

No community discussion yet for this question.

Full GH-200 Practice