---
title: Understanding YAML triggers
description: "This is an important topic since YAML pipelines don't have a graphical UI to define triggers and schedules for the pipelines. All the steps will be done in the `trigger` section of the YAML file. It defines **which branches** will…"
url: "https://ariste.info/dynamics365almguide/understanding-yaml-triggers/"
updated: "2025-10-28"
category: Unified experience ALM / Pipelines
---

# Understanding YAML triggers

This is an important topic since YAML pipelines don't have a graphical UI to define triggers and schedules for the pipelines.

All the steps will be done in the `trigger` section of the YAML file. It defines **which branches** will automatically run the pipeline when a push (commit or merge) happens.

```
trigger:
  - main
  - dev
```

Runs automatically when code is pushed to `main` or `dev`.

## Specify branches

You can use `include` and `exclude` rules to select which branches trigger a pipeline:

```
trigger:
  branches:
    include:
      - main
      - releases/*
    exclude:
      - dev/*
```

The example above will:

- Includes pushes to `main` and any branch starting with `releases/` (e.g. `releases/1.0`).
- Excludes pushes to `dev/*` branches, **even if they match an include pattern**.

If you use both `include` and `exclude`, the exclude rules take precedence.

### Disable All Branch Triggers

```
trigger: none
```

Use this if you want to run the pipeline manually, for example.

## Schedules

With the `schedules` keyword, you can run your pipeline automatically at specific times (like nightly or weekly builds).

This is what it looks like:

```
schedules:
  - cron: "0 3 * * 1-5"   # Every weekday at 03:00 UTC
    displayName: Weekday Nightly Build
    branches:
      include:
        - main
    always: true
```

Now let's see what the parameters are:

- `cron`: Standard cron format (`minute hour day month day-of-week`), it runs at 03:00 UTC, Monday to Friday. The times are always in UTC. You need to calculate the time depending on your time zone.
- `branches.include`: Runs the schedule only for the `main` branch.
- `always: true`: Runs even if there were no new commits since the last run. Use `false` if you want to only trigger the build when there are code changes.

If you're not familiar with the cron format, here's a [crontab expression generator](https://crontab.guru). Using ChatGPT/Copilot is quite helpful as well.

#### Subscribe!

Receive an email when a new post is published
