Skip to Content

GitHub Actions: How to Set Debug Message in GitHub Actions Workflow?

Learn how to correctly set a debug message like “This is an error message” in your GitHub Actions workflow using the proper echo command syntax.

Table of Contents

Question

Which workflow command would set the debug message to This is an error message?

A. echo “::error::This is an error message”
B. echo “error=This is an error message”
C. echo “::error::message=This is an error message”
D. echo “::error::This is an error message::”

Answer

A. echo “::error::This is an error message”

Explanation

This syntax is correct for this workflow command.

The correct workflow command to set the debug message to “This is an error message” is:

echo "::error::This is an error message"

This uses the special GitHub Actions workflow command syntax to set an error debug message. The syntax is:

::error::<message>

where <message> is the debug message you want to set.

The other options are incorrect:

  • Option B uses the wrong syntax of error=<message>
  • Option C incorrectly tries to use message=<message> in addition to ::error::
  • Option D has an extra :: after the message which is invalid.

So in summary, to properly set a debug error message in a GitHub Actions workflow, use:
echo “::error::<your message here>”

This is the accurate and expected syntax for setting debug messages in GitHub Actions workflows.

GitHub Actions certification exam assessment practice question and answer (Q&A) dump including multiple choice questions (MCQ) and objective type questions, with detail explanation and reference available free, helpful to pass the GitHub Actions exam and earn GitHub Actions certification.