Skip to main content
The script.run action executes an inline bash script as a deterministic workflow step inside the workflow execution container. Use it when you need repeatable shell automation that does not require an AI agent or model tokens.

Overview

Run Script is designed for workflow steps where the command path is already known. The script runs in bash, can read environment variables, can run inside a cloned repository, and can return structured JSON for later steps.

Deterministic execution

Run the script exactly as written without asking an AI agent to decide what to do.

Workflow data in

Pass trigger data and previous step outputs through environment variables.

Structured data out

Write JSON to $OC_OUTPUT_FILE and reference parsed fields in downstream steps.

Failure-aware

Exit code 0 succeeds. Non-zero exits, including timeouts, fail the step.

When to use Run Script

Use Run Script when the work is deterministic and shell-based. Run Script is a good fit for steps like:
  • Check whether generated files changed after a previous step.
  • Extract metadata from a cloned repository.
  • Convert trigger or agent output into a normalized JSON shape.
  • Run a lightweight command before deciding whether a later agent step should run.

Add a Run Script step in Workflow Builder

Open Workflow Builder

Open or create a workflow in Workflow Builder.

Add the action

Add an action step and choose Run Script.

Configure General fields

Set Step ID, Step Name, and Step Timeout (minutes).

Enter the script

Add your shell commands in Bash Script. The script body is not template-interpolated, so pass dynamic values through Environment Variables instead.

Connect downstream steps

Connect later steps and reference the Run Script result with {{outputs.<stepId>...}} expressions.

Configuration fields

General

string
required
Unique identifier for this step. Use a stable ID because later steps reference outputs with this value, for example {{outputs.run-script.exitCode}}.
string
required
Display name shown in Workflow Builder and workflow run details.
number
Maximum time the whole step can run before Overcut stops it. Defaults to 30 minutes. This remains the outer bound even when Timeout Seconds (optional) is set.

Script

string
required
Inline bash script to execute. The script is required and must not be empty.
string
Relative path inside the workflow workspace. Use this to run a script inside a repository cloned by an earlier git.clone step. This field can use workflow expressions, for example {{outputs.clone-repo.workspacePath}}.
integer
Maximum script runtime in seconds. Defaults to 1800. The effective limit is bounded by Step Timeout (minutes).

Environment Variables

object
Key-value pairs exposed to the script as environment variables. Names must be valid shell identifiers, such as TICKET_TITLE or BUILD_ID. Values can use dynamic workflow expressions such as {{trigger.title}} and {{outputs.previous-step.field}}.

Pass data into scripts

Do not template-interpolate dynamic workflow data directly into Bash Script. Trigger titles, comments, and agent output can contain characters that have special meaning in bash. Instead, put dynamic values in Environment Variables and read them in the script.
Use standard double braces for escaped values and triple braces for raw values. Triple braces are useful when passing agent prose or other text that should arrive without escaping.
Inside the script, quote environment variables like "$ISSUE_TITLE" so bash treats the value as data.

Use secrets safely

Project secrets attached to the workflow are available to Run Script as environment variables. Use them for API tokens, package registry credentials, or other sensitive values needed by deterministic commands.
Do not print secrets. Run Script captures stdout and stderr in workflow run logs and stores captured output in the step result.
A safer pattern is to test that a secret is present without echoing the value:
See Vault for project secret configuration and assignment.

Return structured output with $OC_OUTPUT_FILE

Run Script always captures exitCode and stdout. To pass structured values to later steps, write valid JSON to the file path stored in $OC_OUTPUT_FILE.
Later steps can reference parsed fields under output:
Use {{outputs.<stepId>.output.<field>}} for values written to $OC_OUTPUT_FILE. Use {{outputs.<stepId>.exitCode}}, {{outputs.<stepId>.stdout}}, or {{outputs.<stepId>.truncated}} for the standard result fields.

Execution results and failure behavior

Run Script stores the step result under outputs.<stepId>.
number
required
Script exit code. 0 means the step succeeded. Non-zero values fail the step and workflow run. A timeout reports exit code 124.
string
required
Captured stdout and stderr from the script. The stored value may be truncated.
boolean
required
Whether captured stdout and stderr were truncated before being stored.
object
Parsed JSON object written to $OC_OUTPUT_FILE. Omitted when the output file is missing or empty.
string
Error recorded when $OC_OUTPUT_FILE exists but contains invalid JSON or JSON that is too large. This does not fail an otherwise successful script.
Behavior summary:

Validation rules

Overcut validates Run Script configuration when you save the workflow.

Examples

Run inside a cloned repository

Use git.clone first, then set Working Directory (optional) to the cloned repository folder.

Chain script output into another script

Fail fast on a validation command

If package.json is missing or invalid, the script exits non-zero and the step fails.