We have a nightly pipeline that runs to build our application, setup with a schedule like this:

- cron: '0 0 * * *'
  displayName: Daily midnight build
    - main
  always: false

This is all works fine and is only built when any changes actually go in. This is the build our SQA team pick up the next day all is well.

The problem comes when it is more of an urgent build, whereby we manually trigger a build so it can be tested the same day. The pipeline still runs again that night, even though there are no changes to the branch. This leads to a bit of confusion to SQA, as well as a bit of a waste of resources. There is a new build with no changes to those that have previously been tested. There are no work items associated to this second run, so it seems like it should be able to know whether there are actually any changes.

How can this be changed to not run if there aren’t actually any changes since it’s last run?