# 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`](/reference/cli/templates/actions/test) or [`try`](/reference/cli/templates/actions/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**

```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:

```sh
croct use template.json5
```

## Properties

These are the supported properties:

- `name`: `string`

  The action identifier. Always `run` for this action.

- `actions`: `Action | Array<Action>` (see [Action](/reference/cli/templates/actions), [Array\<Action>](/reference/cli/templates/actions))

  The actions to execute sequentially.

  Accepts a single action or a list of actions.

## Explore

- [Execute package](/reference/cli/templates/actions/execute-package): Learn how to run a package binary instead.
- [Install](/reference/cli/templates/actions/install): Learn how to install dependencies first.
- [Define](/reference/cli/templates/actions/define): Learn how to store command output in a variable.
- [Test](/reference/cli/templates/actions/test): Learn how to branch based on command results.
