Skip to content

Commit 6935940

Browse files
Update APIView Helpers (#40322)
Co-authored-by: Chidozie Ononiwu <chononiw@microsoft.com>
1 parent 48f5f65 commit 6935940

File tree

1 file changed

+13
-6
lines changed

1 file changed

+13
-6
lines changed

eng/common/scripts/Helpers/ApiView-Helpers.ps1

Lines changed: 13 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -168,8 +168,8 @@ function Set-ApiViewCommentForPR {
168168
$commentText = @()
169169
$commentText += "## API Change Check"
170170
try {
171-
$response = Invoke-RestMethod -Uri $apiviewEndpoint -Method Get -MaximumRetryCount 3
172-
if ($response.Count -eq 0) {
171+
$response = Invoke-WebRequest -Uri $apiviewEndpoint -Method Get -MaximumRetryCount 3
172+
if ($response.StatusCode -ne 200) {
173173
LogWarning "API changes are not detected in this pull request."
174174
$commentText += ""
175175
$commentText += "API changes are not detected in this pull request."
@@ -179,10 +179,17 @@ function Set-ApiViewCommentForPR {
179179
$commentText += ""
180180
$commentText += "APIView identified API level changes in this PR and created the following API reviews"
181181
$commentText += ""
182-
$commentText += "| Language | API Review for Package |"
183-
$commentText += "|----------|---------|"
184-
$response | ForEach-Object {
185-
$commentText += "| $($_.language) | [$($_.packageName)]($($_.url)) |"
182+
183+
if ($RepoName.StartsWith(("azure-sdk-for-"))) {
184+
$response | ForEach-Object {
185+
$commentText += "[$($_.packageName)]($($_.url))"
186+
}
187+
} else {
188+
$commentText += "| Language | API Review for Package |"
189+
$commentText += "|----------|---------|"
190+
$response | ForEach-Object {
191+
$commentText += "| $($_.language) | [$($_.packageName)]($($_.url)) |"
192+
}
186193
}
187194
}
188195
} catch{

0 commit comments

Comments
 (0)