-
Notifications
You must be signed in to change notification settings - Fork 2.1k
Sync eng/common directory with azure-sdk-tools for PR 10286 #45434
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change | ||||
---|---|---|---|---|---|---|
|
@@ -55,11 +55,20 @@ function Submit-Request($filePath, $packageName) | |||||
} | ||||||
$uri = [System.UriBuilder]$APIViewUri | ||||||
$uri.query = $query.toString() | ||||||
|
||||||
$correlationId = [System.Guid]::NewGuid().ToString() | ||||||
$headers = @{ | ||||||
"Content-Type" = "application/json" | ||||||
"x-correlation-id" = $correlationId | ||||||
} | ||||||
LogInfo "Request URI: $($uri.Uri.OriginalString)" | ||||||
LogInfo "Correlation ID: $correlationId" | ||||||
try | ||||||
{ | ||||||
$Response = Invoke-WebRequest -Method 'GET' -Uri $uri.Uri -MaximumRetryCount 3 | ||||||
$Response = Invoke-WebRequest -Method 'GET' -Uri $uri.Uri -Headers $headers -MaximumRetryCount 3 | ||||||
$StatusCode = $Response.StatusCode | ||||||
$responseContent = $Response.Content | ConvertFrom-Json | ConvertTo-Json -Depth 10 | ||||||
LogSuccess $responseContent | ||||||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. [nitpick] LogSuccess only outputs the JSON body. Including the HTTP status code in this log would make troubleshooting easier and consistent with other calls.
Suggested change
Copilot uses AI. Check for mistakes. Positive FeedbackNegative Feedback |
||||||
} | ||||||
catch | ||||||
{ | ||||||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -168,10 +168,16 @@ function Set-ApiViewCommentForPR { | |
$apiviewEndpoint = "$APIViewHost/api/pullrequests?pullRequestNumber=$PrNumber&repoName=$repoFullName&commitSHA=$HeadCommitish" | ||
LogDebug "Get APIView information for PR using endpoint: $apiviewEndpoint" | ||
|
||
$correlationId = [System.Guid]::NewGuid().ToString() | ||
$headers = @{ | ||
"x-correlation-id" = $correlationId | ||
} | ||
LogInfo "Correlation ID: $correlationId" | ||
|
||
$commentText = @() | ||
$commentText += "## API Change Check" | ||
try { | ||
$response = Invoke-WebRequest -Uri $apiviewEndpoint -Method Get -MaximumRetryCount 3 | ||
$response = Invoke-WebRequest -Uri $apiviewEndpoint -Method Get -Headers $headers -MaximumRetryCount 3 | ||
LogInfo "OperationId: $($response.Headers['X-Operation-Id'])" | ||
if ($response.StatusCode -ne 200) { | ||
LogInfo "API changes are not detected in this pull request." | ||
|
@@ -272,10 +278,12 @@ function Create-API-Review { | |
{ | ||
$response = Invoke-WebRequest -Method 'GET' -Uri $requestUri.Uri -Headers $headers -MaximumRetryCount 3 | ||
if ($response.StatusCode -eq 201) { | ||
LogSuccess "Status Code: $($response.StatusCode)`nAPI review request created successfully.`n$($response.Content)" | ||
$responseContent = $Response.Content | ConvertFrom-Json | ConvertTo-Json -Depth 10 | ||
LogSuccess "Status Code: $($response.StatusCode)`nAPI review request created successfully.`n$($responseContent)" | ||
} | ||
elseif ($response.StatusCode -eq 208) { | ||
LogSuccess "Status Code: $($response.StatusCode)`nThere is no API change compared with the previous version." | ||
$responseContent = $Response.Content | ConvertFrom-Json | ConvertTo-Json -Depth 10 | ||
Comment on lines
+281
to
+285
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. [nitpick] Variable casing is inconsistent— Copilot uses AI. Check for mistakes. Positive FeedbackNegative Feedback |
||
LogSuccess "Status Code: $($response.StatusCode)`nThere is no API change compared with the previous version.`n$($responseContent)" | ||
} | ||
else { | ||
LogError "Failed to create API review request. $($response)" | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Using a 'Content-Type' header on a GET request is misleading—consider replacing it with an 'Accept: application/json' header or removing it entirely.
Copilot uses AI. Check for mistakes.