Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion eng/common/scripts/Helpers/ApiView-Helpers.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -132,7 +132,7 @@ function Set-ApiViewCommentForRelatedIssues {
. ${PSScriptRoot}\..\common.ps1
$issuesForCommit = $null
try {
$issuesForCommit = Search-GitHubIssues -CommitHash $HeadCommitish
$issuesForCommit = Search-GitHubIssues -CommitHash $HeadCommitish -AuthToken $AuthToken
if ($issuesForCommit.items.Count -eq 0) {
LogInfo "No issues found for commit: $HeadCommitish"
Write-Host "##vso[task.complete result=SucceededWithIssues;]DONE"
Expand Down
17 changes: 11 additions & 6 deletions eng/common/scripts/Invoke-GitHubAPI.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -560,12 +560,17 @@ function Search-GitHubIssues {
[ValidateNotNullOrEmpty()]
[Parameter(Mandatory = $true)]
$CommitHash,
$State="open"
$State="open",
$AuthToken
)
$uri = "https://api.github.com/search/issues?q=sha:$CommitHash+state:$State"

return Invoke-RestMethod `
-Method GET `
-Uri $uri `
-MaximumRetryCount 3
$params = @{
Method = 'GET'
Uri = $uri
MaximumRetryCount = 3
}
if ($AuthToken) {
$params.Headers = Get-GitHubApiHeaders -token $AuthToken
}
return Invoke-RestMethod @params
}