microsoft / PR-Metrics

A GitHub Action & Azure Pipelines task for augmenting pull request titles to let reviewers quickly determine PR size and test coverage.
https://github.com/microsoft/Omex
MIT License
58 stars 12 forks source link

Git diff failing - classic non-yaml PR pipeline #61

Closed ColinKrist closed 3 years ago

ColinKrist commented 3 years ago

Summary

This line is failing on my repo: https://github.com/microsoft/OMEX-Azure-DevOps-Extensions/blob/7bdbb325db12c82e761991c4fa4d5a179e763c3e/PipelinesTasks/PRMetrics/buildAndReleaseTask/src/git/gitInvoker.ts#L33

This is a classic release pipeline with the OAuth token checkbox checked: image

I have another classic release pipeline that works a-ok, so I'm a bit stumped. The only guess I have is that this one uses 'develop' instead of 'development'

screenshot of pipeline run: image

Reproduction Steps

Open PR into 'develop' PR metrics step runs and then fails with this.

Additional Information

muiriswoulfe commented 3 years ago

Hi @ColinKrist. I believe the issue is likely that you have "shallow fetch" turned on for your pipeline.

In your pipeline definition, navigate to "Get sources". At the bottom, there will be a checkbox for "Shallow fetch". If this is on, it's likely that the task won't work. Let me know if it continues to fail and I can investigate further.

In reality, it's possible to leave this on and set the value appropriately deep to allow the task to run, but this depth will depend on the layout of your repo branches so the easiest option – at least initially – is to just switch this off.

By the way, I'm currently working on adding a check for this, which will provide a more useful error message in the case of failures, although it'll likely be a little while still before I am able to get this out. It won't really benefit you here as it will essentially just check for the failure you're seeing and translate it into something more comprehensible.

ColinKrist commented 3 years ago

this did the trick - looking forward to the enhancement too that'll be helpful when we have other engineers troubleshoot as we adopt this into our other pipelines. Thanks!!