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…
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)- A92% (59)
- B2% (1)
- C2% (1)
- D5% (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
Community Discussion
No community discussion yet for this question.