GET /projects/:id/merge_requests/:merge_request_iid/changes
gives you all changes, see Merge requests API | GitLab
Or using git:
My Job:
script:
- git fetch origin $CI_MERGE_REQUEST_TARGET_BRANCH_NAME
- git diff-tree --name-only -r "HEAD..origin/$CI_MERGE_REQUEST_TARGET_BRANCH_NAME"