Keyboard shortcuts

Press or to navigate between chapters

Press S or / to search in the book

Press ? to show this help

Press Esc to hide this help

Branch

Branches allow conditional branching at a step. Set the branches attribute to define multiple branches, each with its own if condition and list of child steps.

name: test
steps:
    - id: step1
      uses: acts.transform.set
      params:
        a: 5
    - id: step2
      branches:
        - id: b1
          name: branch 1
          if: '${{ a }} > 0'
          steps:
            - id: step3
              uses: acts.transform.set
              params:
                result: positive
        - id: b2
          name: branch 2
          steps:
            - id: step4
              uses: acts.transform.set
              params:
                result: zero_or_negative

Branch Attributes

KeyNameDescription
idIDUnique branch identifier
nameNameBranch name
ifConditionWhen condition is satisfied, execute this branch
needsDependenciesPredecessor branch IDs, sets Pending state
varsVariablesLocal variables
stepsStepsChild steps of this branch
inputsInputsInput schema
outputsOutputsOutput schema

Branch Dependencies

Use needs to declare dependencies between branches:

branches:
    - id: b1
      needs: [b2]
      steps:
        - id: step3
    - id: b2
      steps:
        - id: step4

If branch b1 depends on b2, the engine sets b1 to Pending state until b2 is completed.

Expressions in Conditions

Branch conditions use ${{ }} expression syntax:

# Variable comparison
if: '${{ a }} > 0'

# Multi-condition
if: '${{ a }} > 0 && $get("status") == "active"'