Search code examples
gitazureazure-pipelinesazure-pipelines-yamlazure-repos

Obtain commits associated with pipeline run


In the Azure Pipelines Bun/Run view I can see that the current build is associated with the last N commits: Last 7 commits

This is much more valuable than the Build.SourceVersion pipeline variable for incremental build's sake as I could be able to tell exactly what has changed since the last run.

I've looked at dev.azure.com/{org}/{project}/_traceability/runview/changes?currentRunId={id} but don't see the commits in there.

I've also tried to specify https://dev.azure.com/{org}/{projct}/_apis/build/changes?toBuildId={id}, but without the previous build ID, it errors.

Is there a way to easily access which changes this pipeline build is running with ?


Solution

  • It appears that using the changes API with the same build number as both fromBuildId and toBuildId does just that.