Skip to content

Commit

Permalink
Sync eng/common directory with azure-sdk-tools for PR 8110 (#43457)
Browse files Browse the repository at this point in the history
* Show review link in logs and set DevOps project name based on the pipeline run

* Add project param in request

---------

Co-authored-by: Praveen Kuttappan <prmarott@microsoft.com>
  • Loading branch information
azure-sdk and praveenkuttappan committed Apr 17, 2024
1 parent 44d1f56 commit b5eefaa
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 1 deletion.
Expand Up @@ -22,6 +22,7 @@ steps:
-RepoFullName $(Build.Repository.Name)
-APIViewUri $(ApiChangeDetectRequestUrl)
-ArtifactName ${{ parameters.ArtifactName }}
-DevopsProject $(System.TeamProject)
pwsh: true
displayName: Detect API changes
condition: and(succeededOrFailed(), eq(variables['Build.Reason'],'PullRequest'))
2 changes: 2 additions & 0 deletions eng/common/scripts/Create-APIReview.ps1
Expand Up @@ -78,6 +78,7 @@ function Upload-SourceArtifact($filePath, $apiLabel, $releaseStatus, $packageVer
try
{
$Response = Invoke-WebRequest -Method 'POST' -Uri $uri -Body $multipartContent -Headers $headers
Write-Host "API review: $($Response.Content)"
$StatusCode = $Response.StatusCode
}
catch
Expand Down Expand Up @@ -114,6 +115,7 @@ function Upload-ReviewTokenFile($packageName, $apiLabel, $releaseStatus, $review
try
{
$Response = Invoke-WebRequest -Method 'GET' -Uri $uri -Headers $headers
Write-Host "API review: $($Response.Content)"
$StatusCode = $Response.StatusCode
}
catch
Expand Down
5 changes: 4 additions & 1 deletion eng/common/scripts/Detect-Api-Changes.ps1
Expand Up @@ -15,7 +15,8 @@ Param (
[string] $APIViewUri,
[string] $RepoFullName = "",
[string] $ArtifactName = "packages",
[string] $TargetBranch = ("origin/${env:SYSTEM_PULLREQUEST_TARGETBRANCH}" -replace "refs/heads/")
[string] $TargetBranch = ("origin/${env:SYSTEM_PULLREQUEST_TARGETBRANCH}" -replace "refs/heads/"),
[string] $DevopsProject = "internal"
)

. (Join-Path $PSScriptRoot common.ps1)
Expand All @@ -37,6 +38,7 @@ function Submit-Request($filePath, $packageName)
$query.Add('pullRequestNumber', $PullRequestNumber)
$query.Add('packageName', $packageName)
$query.Add('language', $LanguageShort)
$query.Add('project', $DevopsProject)
$reviewFileFullName = Join-Path -Path $ArtifactPath $packageName $reviewFileName
if (Test-Path $reviewFileFullName)
{
Expand Down Expand Up @@ -87,6 +89,7 @@ function Log-Input-Params()
Write-Host "Language: $($Language)"
Write-Host "Commit SHA: $($CommitSha)"
Write-Host "Repo Name: $($RepoFullName)"
Write-Host "Project: $($DevopsProject)"
}

Log-Input-Params
Expand Down

0 comments on commit b5eefaa

Please sign in to comment.