Forum Discussion
Enhance YAML Pipelines 'Changes' API Endpoint to allow user to specify the 'artifact'
There exists an API endpoint that allows a user to request the changes for a Classic Release run and pass the Artifact Alias that they would like the changes from:
https://vsrm.dev.azure.com/{collection}/{project}/_apis/Release/releases/{releaseId}/changes?artifactAlias={artifactAlias}
If a team replicates this type of pattern in YAML pipelines where there is a build pipeline (or multiple) and then a multi-stage YAML 'release' pipeline, there is no way to get the changes from the build artifacts. You can request the changes from the API for the multi-stage 'release' pipeline, but you cannot get the changes for the build pipelines IN THE CONTEXT OF the currently releasing stage.
The build artifacts are specified in the release pipeline in the resources:
resources:
pipelines:
- pipeline: myBuildPipeline
source: myBuildPipeline
trigger:
branches:
include:
- main
1 Reply
Try Build Changes API directly:
Use the Builds - Get Build Changes API to retrieve changes from the build pipeline:
GET https://dev.azure.com/{organization}/{project}/_apis/build/builds/{buildId}/changes?api-version=7.1
To make this work:
- Use predefined variables like resources.pipeline.{alias}.runID to get the build ID of the referenced pipeline.
- Then call the above API with that build ID to get the changes.
In YAML:
steps: - script: echo $(resources.pipeline.myBuildPipeline.runID)
Use that ID in your script or REST call to fetch changes.