The Cake.AzureDevOps addin provides an alias for reading pull request information.
The following example will read details of a pull request:
#addin "Cake.AzureDevOps"
Task("Read-PullRequest").Does(() =>
{
var pullRequestSettings =
new AzureDevOpsPullRequestSettings(
new Uri("http://myserver:8080/defaultcollection/myproject/_git/myrepository"),
"refs/heads/feature/myfeature",
AzureDevOpsAuthenticationNtlm());
var pullRequest =
AzureDevOpsPullRequest(
pullRequestSettings);
Information(pullRequest.TargetRefName);
});