CI/CD Getting a list of changed files from a multi-commit push without merge requests

Hi folks,

I have a somewhat unconventional set up where I would like to get a list of changed files from a multi-commit push to a branch directly, not by way of a merge request.

The project I’m working on currently doesn’t use master/working branches, instead changes are pushed directly to several separate branches without merging. This push may include one or more commits which could potentially add/change/delete several different files.

I’ve reviewed a similar question asked in CI/CD pipeline - get list of changed files but the solution only works when the pipeline runs on merge requests or single commit pushes.

If there are multiple commits in a push I can only see the latest commit’s changed files when using COMMIT_FILES=$(git diff-tree --no-commit-id --name-only -r $CI_COMMIT_SHA) , any files changed in earlier commits in the push are lost.

Might anyone have a solution that would work with pipelines that run on pushes with multiple commits?

Thanks for your time,