Start CI pipeline only when fast forward is possible

I have a question related to gitlab CI file, and possible configuration.

I checked option in project settings: Fast-forward merges only

Now there is no point of starting CI jobs if merge request is not rebased.
So I’d like to start my jobs only when fast forward is possible, or have a script with some parameters from environment variables that will check this and fail it’s not possible.
As far as I could find this should be the option in git:

Any ideas?