Workflow commands for GitHub Actions

You can use workflow commands when running shell commands in a workflow or in an action's code.

GitHub Actions is available with GitHub Free, GitHub Pro, GitHub Team, GitHub Enterprise Cloud, and GitHub One. GitHub Actions is not available for private repositories owned by accounts using legacy per-repository plans. For more information, see "GitHub's products."

In this article

About workflow commands

Actions can communicate with the runner machine to set environment variables, output values used by other actions, add debug messages to the output logs, and other tasks.

Workflow commands use the echo command in a specific format.

echo "::workflow-command parameter1={data},parameter2={data}::{command value}"

Note: Workflow command and parameter names are not case-sensitive.

Warning: If you are using Command Prompt, omit double quote characters (") when using workflow commands.

Setting an environment variable

::set-env name={name}::{value}

Creates or updates an environment variable for any actions running next in a job. The action that creates or updates the environment variable does not have access to the new value, but all subsequent actions in a job will have access. Environment variables are case-sensitive and you can include punctuation.


echo "::set-env name=action_state::yellow"

Setting an output parameter

::set-output name={name}::{value}

Sets an action's output parameter.

Optionally, you can also declare output parameters in an action's metadata file. For more information, see "Metadata syntax for GitHub Actions."


echo "::set-output name=action_fruit::strawberry"

Adding a system path


Prepends a directory to the system PATH variable for all subsequent actions in the current job. The currently running action cannot access the new path variable.


echo "::add-path::/path/to/dir"

Setting a debug message


Prints a debug message to the log. You must create a secret named ACTIONS_STEP_DEBUG with the value true to see the debug messages set by this command in the log. To learn more about creating secrets and using them in a step, see "Creating and using encrypted secrets."


echo "::debug file=app.js,line=1::Entered octocatAddition method"

Setting a warning message

::warning file={name},line={line},col={col}::{message}

Creates a warning message and prints the message to the log. You can optionally provide a filename (file), line number (line), and column (col) number where the warning occurred.


echo "::warning file=app.js,line=1,col=5::Missing semicolon"

Setting an error message

::error file={name},line={line},col={col}::{message}

Creates an error message and prints the message to the log. You can optionally provide a filename (file), line number (line), and column (col) number where the warning occurred.


echo "::error file=app.js,line=10,col=15::Something went wrong"

Masking a value in log


Masking a value prevents a string or variable from being printed in the log. Each masked word separated by whitespace is replaced with the * character. You can use an environment variable or string for the mask's value.

Example masking a string

When you print "Mona The Octocat" in the log, you'll see "***".

echo "::add-mask::Mona The Octocat"

Example masking an environment variable

When you print the variable MY_NAME or the value "Mona The Octocat" in the log, you'll see "***" instead of "Mona The Octocat".

MY_NAME="Mona The Octocat"
echo "::add-mask::$MY_NAME"

Stopping and starting workflow commands


Stops processing any workflow commands. This special command allows you to log anything without accidentally running a workflow command. For example, you could stop logging to output an entire script that has comments.

Example stopping workflow commands

echo "::stop-commands::pause-logging"

To start workflow commands, pass the token that you used to stop workflow commands.


Example starting workflow commands

echo "::pause-logging::"

Ask a human

Can't find what you're looking for?

Contact us