I want to run some pytest tests on the files changed in my branch, on which the build pipeline containing all the steps is running. I have this
displayName: 'Get changed files in the latest commit'
inputs:
targetType: 'inline'
script: |
git diff-tree --no-commit-id --name-status -r $(Build.SourceVersion)^ $(Build.SourceVersion) > changed_files.txt
cat changed_files.txt
But this does not work – I get fatal: ambiguous argument 'c971d4f8f356595b603d87c3055055fb43ca2752^': unknown revision or path not in the working tree.
I have tried all the solutions posted on Stackoverflow – checkout with zero depth, fetch using PAT added to url, nothing works. I just need a list of all the files that have been modified in this branch, not just in the latest commit but all of them.
4