CI/CD: only build when certain files have changed, also when previous pipeline has failed

I’m creating multiple Docker builds in my CI/CD config of Gitlab and I’m trying to speed things up. I’ve got a couple of Docker services in my Gitlab repository and to avoid building them all on each CI/CD trigger, I’m using the following fragment in .gitlab-ci.yml to only build images when certain files have changed:

      - master
      - myfiles/**/*

This works fine. Except when there’s a pipeline error (connection error during file upload for example). So then I need to trigger it again. But when I do that, the build is not triggered because my files have not changed. So my deploys are unreliable, because I don’t know for sure if the files that have changed since last commit have been built correctly.

Can I somehow update the conditions that it needs to listen to file changes also when a pipeline error has occurred before?