You can write a CI job to check if the status of the Ticket and then fail the job according to the need. Also there is a setting to prevent merging when there are failed pipelines https://docs.gitlab.com/ee/user/project/merge_requests/auto_merge.html#require-a-successful-pipeline-for-merge
This will ensure changes are not pushed to the main branch in case the requirement is not satisfied.