I have the following .gitlab-ci.yml file (including only build stage job as the rest is irrelevant) where I want the build job be triggered only in case of merge requests:
stages: - build - deployToDev - deployToQa - deployToProd variables: O_CHANGES: git diff --name-only $CI_COMMIT_BEFORE_SHA $CI_COMMIT_SHA build: stage: build before_script: - $changedFilesList=(invoke-expression $O_CHANGES) script: - write-host $changedFilesList - C:\Users\alper\gitlab-runner\buildScript.ps1 $changedFilesList except: changes: - .gitignore - .gitlab-ci.yml only: - merge_requests
The job does not trigger when I create a merge request neither does it trigger when I accept the merge request. When I change merge_requests to master or branches, it works fine. What am I doing wrong?