File tree Expand file tree Collapse file tree 1 file changed +14
-5
lines changed
Expand file tree Collapse file tree 1 file changed +14
-5
lines changed Original file line number Diff line number Diff line change @@ -11,9 +11,12 @@ if ($msbuild) {
1111 $msbuild = join-path $msbuild ' MSBuild\Current\Bin\amd64\MSBuild.exe'
1212}
1313
14- # compute authorization header in format "AUTHORIZATION: basic 'encoded token'"
15- # 'encoded token' is the Base64 of the string "nfbot:personal-token"
16- $auth = " basic $ ( [System.Convert ]::ToBase64String([System.Text.Encoding ]::UTF8.GetBytes(" nfbot:${env: MY_GITHUBTOKEN} " ))) )"
14+ # prepare GitHub API headers using token auth
15+ $headers = @ {
16+ Authorization = " token $env: MY_GITHUBTOKEN "
17+ ' User-Agent' = ' azure-pipelines'
18+ Accept = ' application/vnd.github+json'
19+ }
1720
1821if ($env: System_PullRequest_PullRequestId -ne $null )
1922{
@@ -30,7 +33,10 @@ if($env:System_PullRequest_PullRequestId -ne $null)
3033 {
3134 " ##[debug] INFO: iteration $pageCounter " | Write-Host
3235
33- $batch = Invoke-RestMethod - Uri " https://api.github.com/repos/nanoframework/Samples/pulls/$env: System_PullRequest_PullRequestNumber /files?per_page=100&page=$pageCounter " - Header @ {" Authorization" = " $auth " } - ContentType " application/json" - Method GET
36+ $batch = Invoke-RestMethod `
37+ - Uri " https://api.github.com/repos/nanoframework/Samples/pulls/$env: System_PullRequest_PullRequestNumber /files?per_page=100&page=$pageCounter " `
38+ - Headers $headers `
39+ - Method GET
3440
3541 if ($null -eq $commit )
3642 {
6369 {
6470 " ##[command] Get API file change page: $pageCounter " | Write-Host
6571
66- $batch = Invoke-RestMethod - Uri " https://api.github.com/repos/nanoframework/Samples/commits/$env: Build_SourceVersion `?per_page=100&page=$pageCounter " - Header @ {" Authorization" = " $auth " } - ContentType " application/json" - Method GET
72+ $batch = Invoke-RestMethod `
73+ - Uri " https://api.github.com/repos/nanoframework/Samples/commits/$env: Build_SourceVersion `?per_page=100&page=$pageCounter " `
74+ - Headers $headers `
75+ - Method GET
6776
6877 if ($null -eq $commit )
6978 {
You can’t perform that action at this time.
0 commit comments