After
Mint can run tasks after other tasks without inheriting the file system contents and environment variables as with using use
.
A few common scenarios might include:
- Continuous Deployment workflows, where tasks have side effects of modifying external resources and need to run in a specific order
- Optimizing build minutes, where you may want to make sure some tasks succeed before running others
- Dependencies in the task graph, where you only need an output value but no file system outputs
Example
tasks:
- key: one
run: echo this is task one
- key: two
run: echo this is task two
- key: three
after: [one, two]
run: echo task three runs after one and two
Running Tasks After Other Tasks Fail
By default, using after
means that the task will only run if every task listed in after
succeeds.
However, you may want to run some tasks after others fail.
To do this, you can configure after
using an expression instead of an array.
tasks:
- key: one
run: exit 1
- key: if-one-fails
after: ${{ one.failed }}
run: echo task one failed!
You can use &&
and ||
operators to list multiple tasks within the expression.
For more details, see the documentation on expressions.
To control the after
conditions, the following attributes are available on tasks within expressions:
succeeded
failed
finished
aborted
cancelled
skipped
cache-hit
timed-out