Skip to content

Commit

Permalink
use token to get changed files for one PR on macOS (#11588)
Browse files Browse the repository at this point in the history
  • Loading branch information
erich-wang authored Apr 16, 2020
1 parent 401f1b1 commit b46b487
Showing 1 changed file with 9 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -14,11 +14,12 @@
//
namespace Microsoft.WindowsAzure.Build.Tasks
{
using System;
using System.Collections.Generic;
using System.Runtime.InteropServices;
using Microsoft.Build.Framework;
using Microsoft.Build.Utilities;
using Octokit;
using System.Collections.Generic;
using System;

/// <summary>
/// Build task to get all of the files changed in a given PR.
Expand Down Expand Up @@ -87,7 +88,13 @@ public override bool Execute()
List<string> filesChanged = new List<string>();
try
{
//The variable is set in pipeline: "azure-powershell - powershell-core"
var token = Environment.GetEnvironmentVariable("NOSCOPEPAT_ADXSDKPS");
var client = new GitHubClient(new ProductHeaderValue("Azure"));
if(RuntimeInformation.IsOSPlatform(OSPlatform.OSX) && !string.IsNullOrEmpty(token))
{
client.Credentials = new Credentials(token);
}
var files = client.PullRequest.Files(RepositoryOwner, RepositoryName, int.Parse(PullRequestNumber))
.ConfigureAwait(false).GetAwaiter().GetResult();
if (files == null)
Expand Down

0 comments on commit b46b487

Please sign in to comment.