Skip to content

Commit b46b487

Browse files
authored
use token to get changed files for one PR on macOS (#11588)
1 parent 401f1b1 commit b46b487

File tree

1 file changed

+9
-2
lines changed

1 file changed

+9
-2
lines changed

tools/BuildPackagesTask/Microsoft.Azure.Build.Tasks/FilesChangedTask.cs

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -14,11 +14,12 @@
1414
//
1515
namespace Microsoft.WindowsAzure.Build.Tasks
1616
{
17+
using System;
18+
using System.Collections.Generic;
19+
using System.Runtime.InteropServices;
1720
using Microsoft.Build.Framework;
1821
using Microsoft.Build.Utilities;
1922
using Octokit;
20-
using System.Collections.Generic;
21-
using System;
2223

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

0 commit comments

Comments
 (0)