diff --git a/tools/devops/automation/scripts/GitHub.psm1 b/tools/devops/automation/scripts/GitHub.psm1 index 7a6017b32a55..fa863d317db2 100644 --- a/tools/devops/automation/scripts/GitHub.psm1 +++ b/tools/devops/automation/scripts/GitHub.psm1 @@ -884,6 +884,12 @@ function Get-GitHubPRsForHash { Write-Host "Getting related PR ids for commit $Hash" + $prs = [System.Collections.ArrayList]@() + if ($Env:IS_PR -eq "false") { + Write-Host "This isn't a PR, IS_PR=false" + return $prs + } + if ($Org -and $Repo) { $url = "https://api.github.com/repos/$($Org)/$($Repo)/commits/$Hash/pulls" } else { @@ -902,7 +908,6 @@ function Get-GitHubPRsForHash { Write-Host "Request result: $request" # loop over the result and remove all the extra noise we are not interested in - $prs = [System.Collections.ArrayList]@() foreach ($prInfo in $request) { $state = $prInfo.state if ($state -ne "open") { diff --git a/tools/devops/automation/templates/tests/publish-html.yml b/tools/devops/automation/templates/tests/publish-html.yml index 1ce5e03edfc6..bce78fc48cfd 100644 --- a/tools/devops/automation/templates/tests/publish-html.yml +++ b/tools/devops/automation/templates/tests/publish-html.yml @@ -90,6 +90,7 @@ steps: TESTS_JOBSTATUS: $(TESTS_JOBSTATUS) # set by the runTests step TESTS_SUMMARY: $(TEST_SUMMARY_PATH) ACCESSTOKEN: $(System.AccessToken) + IS_PR: ${{ parameters.isPR }} ${{ if eq(parameters.repositoryAlias, 'self') }}: COMMENT_HASH: $(fix_commit.GIT_HASH) ${{ else }}: