Using with pull request id

This example shows how to write issues as comments to an Azure DevOps pull request while using pull request id.

To determine the remote repository URL you need the Cake.Git addin:

#addin "Cake.Git"

To write issues as comments to Azure DevOps pull requests you need to import the core addin, the core pull request addin, the Azure DevOps support including the Cake.AzureDevOps addin, and one or more issue providers, in this example for JetBrains InspectCode:

#addin "Cake.Issues"
#addin "Cake.Issues.InspectCode"
#addin "Cake.Issues.PullRequests"
#addin "Cake.Issues.PullRequests.AzureDevOps"
#addin "Cake.AzureDevOps"

Please note that you always should pin addins to a specific version to make sure your builds are deterministic and won't break due to updates to one of the addins.

See pinning addin versions for details.

In the following task we'll first determine the remote repository URL and with this information call the AzureDevOpsPullRequests alias, which will authenticate through NTLM to an on-premise Azure DevOps Server instance:

Task("ReportIssuesToPullRequest").Does(() =>
{
    var repoRootFolder = MakeAbsolute(Directory("./"));
    var repoRemoteUrl = new Uri(currentBranch.Remotes.Single(x => x.Name == "origin").Url);
    var pullRequestId = 123;

    ReportIssuesToPullRequest(
        InspectCodeIssuesFromFilePath(
            @"C:\build\inspectcode.log"),
        AzureDevOpsPullRequests(
            repoRemoteUrl,
            pullRequestId,
            AzureDevOpsAuthenticationNtlm()),
        repoRootFolder);
});
GitHub