CI/CD pipeline - get list of changed files

hi guys, I just wanted to drop my solution. It’s based on all the answers here so I wanted to share back, maybe it is useful for someone. I wanted to find all changed yaml files in my merge-request to run a job against it. Solution is pretty easy once you know it:

script:
    - git fetch
    - git diff --name-only origin/$CI_MERGE_REQUEST_SOURCE_BRANCH_NAME origin/$CI_MERGE_REQUEST_TARGET_BRANCH_NAME | grep '\.yaml$' | xargs yamllint
3 Likes