Within a pipeline, you sometimes want to run tasks only for specific branches. The "when:" property for tasks allow you to specify a regular expression. If the expression is met, only then will a task run as part of the pipeline. It is important to note that Sail CI uses the full git ref to match the regular expression.
Full information about different types of refs:
If you are using a simple pipeline without workflows you can simply add the when property to each task to specify a regex of a ref. If the regex matches the task will run as part of your build.
If you have opted into using a workflow you can also use the "when:" property on each task of a workflow instead of on a top level task as shown above.