Expressions
Mint supports expressions for referencing values and defining boolean logic in task definitions.
Syntax
Expressions are denoted using ${{ }}
in supported places within task definitions. For example:
tasks:
- key: greeting
run: echo hello ${{ init.name }}!
Usage
You can use expressions to reference values when defining:
run
init
in event triggerswith
parameters when calling leavesinit
parameters when embedding runsid
on concurrency pools- values for environment variables
And to implement boolean logic for:
if
conditions on tasksif
conditions on concurrency pools
Expressions are also used for configuring after conditions
Referencing Values
Reference init
parameters:
${{ init.commit-sha }}
Reference vault secrets and OIDC tokens:
${{ secrets.SOME_API_TOKEN }}
${{ vaults.custom_vault.secrets.SOME_CREDENTIALS }}
Reference task output values:
${{ tasks.some-task.values.some-value }}
Boolean Logic
You can use ()
, &&
, ||
, ==
, !=
,=~
, and !~
inside expressions for implementing boolean logic. When using =~
or !~
, the right-hand side must evaluate to a string that can be parsed as a regular expression.
if: ${{ init.branch == 'main' }}
if: ${{ init.branch != 'main' }}
if: ${{ init.branch == 'main' || init.branch == 'production' }}
if: ${{ event.git.ref =~ '^refs/tags/v.+$' }}