Skip to main content

Command execution

Run terminal commands as an action input — CLI tools, scripts, curl, df, ps, package managers, and so on. Parse the output into structured data with parse.

actions:
- name: DiskFree
command:
run: df -h
parse:
data_type: text
split_whitespace: true

Use parse / parse_stderr to turn stdout/stderr into JSON, CSV, or XML — by delimiter, whitespace, line range, keys, or regex matches.

Success and failure: expect_exit

A command's exit code is its own failure signal, so it decides the action's outcome the same way an HTTP status does. The default is 0; anything else fails the action, which is what makes retry, run_when_failed and error branches work against a failing script.

- name: Build
command:
run: ./build.sh # exits non-zero -> the action fails

A failing command returns stdout, stderr and exit_code together, whatever the parse config says, so an error branch can read the code and whatever the command wrote:

- name: Report
run_when_failed: [Build]
input: a|Build| # .exit_code, .stdout, .stderr
ValueMeaning
unset0 is success (the default)
2one exact code
[0, 1]any of a list — e.g. grep, where 1 means "no matches"
anynever fail on the exit code

CommandRun

FieldTypeDescription
timeoutstring (nullable)How long to let the command run before it is killed, e.g. 30s, 2m.
namestring (nullable)Label for this command in traces and logs. Cosmetic — it does not affect the run.
shellstring (nullable)Shell to execute run with. Defaults to the platform shell; set it when the command depends on a specific one.
runstringRequired. The command line to execute. Example ↓
parseCommandParse (nullable)How to read the command's stdout. Unparsed output stays a plain string, so set this when the command emits structured data you want to use downstream.
parse_stderrCommandParse (nullable)How to read stderr, when the command reports structured errors there.
expect_exitExitExpectation (nullable)Which exit codes count as a SUCCESSFUL action. Defaults to 0. An exit code is a command's own failure signal, exactly as a status code is an HTTP server's, so it decides the…

Field examples

run

The command line to execute.

run: curl -s https://example.com/health

CommandParse

FieldTypeDescription
data_typeDataType (nullable)
disable_auto_extractboolean (nullable)
delimiterstring (nullable)
split_startstring (nullable)
split_endstring (nullable)
line_startnumber (nullable)
line_endnumber (nullable)
keysArray<string> (nullable)
split_bystring (nullable)
split_whitespaceboolean (nullable)
matchesArray<CommandRegex> (nullable)
ignore_outputboolean (nullable)

CommandRegex

FieldTypeDescription
keysArray<string>Required.
regexstring (nullable)
split_bystring (nullable)
split_whitespaceboolean (nullable)