File tree Expand file tree Collapse file tree 2 files changed +12
-7
lines changed Expand file tree Collapse file tree 2 files changed +12
-7
lines changed Original file line number Diff line number Diff line change @@ -132,7 +132,7 @@ function Set-ApiViewCommentForRelatedIssues {
132132 . ${PSScriptRoot} \..\common.ps1
133133 $issuesForCommit = $null
134134 try {
135- $issuesForCommit = Search-GitHubIssues - CommitHash $HeadCommitish
135+ $issuesForCommit = Search-GitHubIssues - CommitHash $HeadCommitish - AuthToken $AuthToken
136136 if ($issuesForCommit.items.Count -eq 0 ) {
137137 LogInfo " No issues found for commit: $HeadCommitish "
138138 Write-Host " ##vso[task.complete result=SucceededWithIssues;]DONE"
Original file line number Diff line number Diff line change @@ -560,12 +560,17 @@ function Search-GitHubIssues {
560560 [ValidateNotNullOrEmpty ()]
561561 [Parameter (Mandatory = $true )]
562562 $CommitHash ,
563- $State = " open"
563+ $State = " open" ,
564+ $AuthToken
564565 )
565566 $uri = " https://api.github.com/search/issues?q=sha:$CommitHash +state:$State "
566-
567- return Invoke-RestMethod `
568- - Method GET `
569- - Uri $uri `
570- - MaximumRetryCount 3
567+ $params = @ {
568+ Method = ' GET'
569+ Uri = $uri
570+ MaximumRetryCount = 3
571+ }
572+ if ($AuthToken ) {
573+ $params.Headers = Get-GitHubApiHeaders - token $AuthToken
574+ }
575+ return Invoke-RestMethod @params
571576}
You can’t perform that action at this time.
0 commit comments