nerdexam
Microsoft

GH-200 · Question #44

How should you print a debug message in your workflow?

The correct answer is A. echo "::debug::Set variable myVariable to true". GitHub Actions uses workflow commands via a specific syntax written to stdout. The format echo "::debug::<message>" is the official workflow command syntax for printing debug messages to the log. These messages are only visible when debug logging is enabled. Option B writes to…

Author and Maintain Workflows

Question

How should you print a debug message in your workflow?

Options

  • Aecho "::debug::Set variable myVariable to true"
  • Becho "Set variable MyVariable to true" >> $DEBUG_MESSAGE
  • Cecho "::add-mask::Set variable myVariable to true"
  • Decho "debug_message=Set variable myVariable to true" >> &GITHUB_OUTPUT

How the community answered

(64 responses)
  • A
    92% (59)
  • B
    2% (1)
  • C
    2% (1)
  • D
    5% (3)

Explanation

GitHub Actions uses workflow commands via a specific syntax written to stdout. The format echo "::debug::<message>" is the official workflow command syntax for printing debug messages to the log. These messages are only visible when debug logging is enabled. Option B writes to a non-existent variable, option C uses add-mask which is for masking sensitive values, and option D uses a malformed GITHUB_OUTPUT syntax.

Topics

#GitHub Actions#Workflow commands#Debugging#Logging

Community Discussion

No community discussion yet for this question.

Full GH-200 Practice