Branch name template

I’m working on a migration from Jenkins + Github to Gitlab CI/CD + Gitlab code repository .

When you create a Pull Request in Github, it prefixes the branch name with PR- and this cannot be edit or changed. So in Jenkins Pipeline I can easily skip certain things if its a Pull Request.

However, I cannot achieve this with Gitlab.

How can I know that this is a Merge Request ? I have looked at the environment variables but the only one which seems helpful is CI_COMMIT_BRANCH but this can be changed by the developer.

Certain merge request variables will carry values if the pipeline is for a merge request. See Pipelines for Merge Requests | GitLab and Predefined environment variables reference | GitLab

For example, you can check for existence of variable $CI_MERGE_REQUEST_IID using a job:rules:if condition: Keyword reference for the .gitlab-ci.yml file | GitLab