Use expressions in task arguments
This guide shows how to pass values into a task's arguments with ${{...}} expressions: run inputs, other tasks' outputs, and values built with operators and functions. The expression language reference lists every value an expression can read.
Reference a run input
Pass a run input directly to a task argument:
name: Upload example
compute_type: cpu-4
inputs:
bucket_name: {}
blocks:
main:
tasks:
upload:
name: Upload
args:
bucket: ${{inputs.bucket_name}}
Reference a task output
Pass the output of one task to the argument of a downstream task:
name: Output example
compute_type: cpu-4
blocks:
main:
tasks:
fetch:
name: Fetch
process:
name: Process
start_on:
- fetch
args:
data_path: ${{tasks.fetch.outputs.file_path}}
process does not start until fetch is Complete, at which point ${{tasks.fetch.outputs.file_path}} resolves to the value fetch wrote to the file_path output.
A task reads only the outputs of the tasks it waits on, so list the task that writes the output in start_on, directly or through the tasks in between. A task that runs alongside without that link reads null. See Task outputs for the full rule, including the blocks of if and for_each tasks.
Combine operators and functions
Use functions and operators to build richer arguments:
args:
label: ${{format('Run {0} of {1}', inputs.run_number, inputs.total_runs)}}
is_final: ${{inputs.run_number == inputs.total_runs}}
owner: ${{inputs.owner || 'unassigned'}}
is_final becomes the text true or false, and owner falls back to unassigned when the input is falsy: empty, not supplied, or 0 or false. Expressions have no arithmetic operators.
Mix static text and expressions
An expression can appear anywhere in a string value alongside static text:
args:
message: 'Processing ${{inputs.bucket_name}} for run ${{inputs.run_number}}'
Secrets and the loop variables of a for_each task are passed the same way; see Use secrets in workflows and Iterate over a list with for_each.