Question 1
How should you print a debug message in your workflow?
I agree with the suggested answer A. GitHub Actions utilizes specific workflow commands formatted as strings echoed to stdout to interact with the runner, and the ::debug:: prefix is the standard syntax for emitting debug-level logs.
Reason
Option A is correct because echo "::debug::{message}" is the official toolkit command for printing a debug message. These messages are hidden by default and only appear in the log when step debug logging is enabled by setting the secret ACTIONS_STEP_DEBUG to true.
Why the other options are not as suitable
- Option B is incorrect because $DEBUG_MESSAGE is not a standard environment variable or valid file descriptor for capturing debug output in GitHub Actions.
- Option C is incorrect because ::add-mask:: is used to obfuscate sensitive information in logs, replacing the specified string with asterisks rather than marking it as a debug message.
- Option D is incorrect because it uses the syntax for environment files (specifically $GITHUB_OUTPUT) which is intended for passing data between steps, not for emitting log messages.