Any way to work with azure devops pull requests with shallow fetch

We are using azure devops, and are looking into using sonarcloud for analysis. However, it seems that analysis of pull requests using a shallow fetch is not working, since it cannot determine what changes are made in a pull request. Doing a full checkout is not really a feasable option for us, because this will take over 5 minutes for each build.

I was hoping that we could solve this by triggering an analysis after each PR was merged on the main branch, and that sonarcloud could analyse the differences based on the latest analysis of the target branch, but thid doesn’t seem to work. What are our options here?


Ehm… You really need a full checkout. I’m not sure there are other options.


Well that really is not an option for us.

However, it seems that we have a way out. Yhe CI trigger I created actually does seem to work. I simply made an error with the testing. So summarizing:

I added a CI trigger on our main branch, which is the target of most pull seems that sonar cloud can determine the changes correctly if it has a recent analysis of the target branch of the pr. Can you confirm this?