diff --git a/tools/BuildPackagesTask/Microsoft.Azure.Build.Tasks/FilesChangedTask.cs b/tools/BuildPackagesTask/Microsoft.Azure.Build.Tasks/FilesChangedTask.cs index 0451eed9ea06..bd289e66d785 100644 --- a/tools/BuildPackagesTask/Microsoft.Azure.Build.Tasks/FilesChangedTask.cs +++ b/tools/BuildPackagesTask/Microsoft.Azure.Build.Tasks/FilesChangedTask.cs @@ -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; /// /// Build task to get all of the files changed in a given PR. @@ -87,7 +88,13 @@ public override bool Execute() List filesChanged = new List(); 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)