opschain step set-output
Included from Basic tier
opschain step set-output <key> [<value>]
Publishes one output from inside a running step for later steps'
${{ steps.<name>.outputs.<key> }} references. The pair is appended as a
key=value line to the file named by $OPSCHAIN_OUTPUT — or, with
--sensitive, by $OPSCHAIN_OUTPUT_SENSITIVE — and applied by the engine
when the step succeeds. A repeated key keeps its last value.
Keys must match ^[a-z0-9_]{1,50}$. Values are single-line (the outputs
file is key=value per line); multi-line data belongs in an artifact. A
step's outputs (keys plus values, plain and sensitive files combined) share
a 64 KiB budget — a value over it is refused here, with the budget named,
instead of failing the step at collection. A plain output whose value
matches a masked secret fails the step at finalisation — publish it as a
sensitive output or keep it in the secret vault.
--value-file reads the value from a file (- reads stdin) for values
beyond OS argument limits, e.g. base64-encoded report bodies; a single
trailing newline is dropped. Pass the value as an argument or via
--value-file, not both.
Flags
| Flag | Meaning |
|---|---|
--sensitive | Treat the value as sensitive: stored encrypted, masked in later step logs, redacted on API reads. |
--value-file | Read the value from this file instead of the argument (- reads stdin). |
Environment
| Variable | Meaning |
|---|---|
OPSCHAIN_OUTPUT | The plain outputs file this command appends to (set by the executor). |
OPSCHAIN_OUTPUT_SENSITIVE | The sensitive outputs file --sensitive appends to instead. |
Exit codes
| Code | Meaning |
|---|---|
| 0 | Output recorded. |
| 1 | The outputs file could not be written. |
| 2 | Usage error (bad key, multi-line value, value over the output budget, not inside a step). |
Named errors
output key "<key>" must match ^[a-z0-9_]{1,50}$output values are single-line (the outputs file is key=value per line): store multi-line data as an artifact insteadoutput "<key>" is <n> bytes — a step's outputs share a 65536-byte budget: publish large data as an artifact, or leave it in the step logpass the value as an argument or via --value-file, not botha value is required: pass it as an argument or via --value-file$OPSCHAIN_OUTPUT is not set:opschain stepsubcommands only work inside a running OpsChain step
All exit 2.
Examples
opschain step set-output image_tag v2.3.1
opschain step set-output api_key "$GENERATED_KEY" --sensitive
opschain step set-output report_md_b64 --value-file report.b64
base64 < report.md | tr -d '\n' | opschain step set-output report_md_b64 --value-file -
See also
opschain docs artifacts— declare report or dist files as step artifacts instead of base64-folding them into outputs; the budget stays, artifacts are the transport for anything larger.opschain docs cli/step-set-property— persist a value into properties instead of handing it to the next step.opschain learn 2.1— consuming outputs in YAML actions.