Add merge request environment variables
Description
For example, I want to check syntax only on files changed by the merge request.
Something like this in .gitlab-ci.yml:
syntax-check:
script:
- git checkout $CI_MERGE_TARGET_REF_NAME
- git merge $CI_COMMIT_REF_NAME
- for file in $(git diff --diff-filter=d HEAD^ --name-only $CI_MERGE_TARGET_REF_NAME..HEAD); do echo "Checking $file"; done
Documentation blurb
To add in https://docs.gitlab.com/ce/ci/variables/README.html#predefined-variables-environment-variables
CI_MERGE_TARGET_REF_NAME The target branch of the merge request.