run

Learn how to execute actions sequentially.

This action groups actions into a single sequential block.

It is mainly useful inside control-flow actions like test or try, where you need to execute multiple steps in a branch that expects a single action.

Example

The following template conditionally runs a group of actions based on the user's choice:

template.json5
{  "$schema": "https://schema.croct.com/json/v1/template.json",  "title": "Conditional setup",  "description": "Runs setup steps based on user input.",  "actions": [    {      "name": "prompt",      "type": "confirmation",      "message": "Install dependencies?",      "default": true,      "result": "shouldInstall"    },    {      "name": "test",      "condition": "${this.shouldInstall}",      "then": {        "name": "run",        "actions": [          {            "name": "install"          },          {            "name": "print",            "semantics": "success",            "message": "Dependencies installed."          }        ]      }    }  ]}

To apply this template, run:

npx croct@latest use template.json5

Properties

These are the supported properties:

name
string

The action identifier. Always run for this action.

actions
Action|Array<Action>

The actions to execute sequentially.

Accepts a single action or a list of actions.