Skip to content
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

Detect API changes using pre-generated code file by CI approach #3735

Merged
5 commits merged into from
Jul 25, 2022
Merged
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
10 changes: 8 additions & 2 deletions eng/common/scripts/Detect-Api-Changes.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@ function Submit-Request($filePath, $packageName)
if (!$repoName) {
$repoName = "azure/azure-sdk-for-$LanguageShort"
}
$reviewFileName = "$($packageName)_$($LanguageShort).json"
$query = [System.Web.HttpUtility]::ParseQueryString('')
$query.Add('artifactName', $ArtifactName)
$query.Add('buildId', $BuildId)
Expand All @@ -35,6 +36,12 @@ function Submit-Request($filePath, $packageName)
$query.Add('repoName', $repoName)
$query.Add('pullRequestNumber', $PullRequestNumber)
$query.Add('packageName', $packageName)
$query.Add('language', $LanguageShort)
$reviewFileFullName = Join-Path -Path $ArtifactPath $packageName $reviewFileName
if (Test-Path $reviewFileFullName)
{
$query.Add('codeFile', $reviewFileName)
}
$uri = [System.UriBuilder]$APIViewUri
$uri.query = $query.toString()
Write-Host "Request URI: $($uri.Uri.OriginalString)"
Expand Down Expand Up @@ -65,7 +72,7 @@ function Should-Process-Package($pkgPath, $packageName)
# Get package info from json file created before updating version to daily dev
$pkgInfo = Get-Content $pkgPropPath | ConvertFrom-Json
$packagePath = $pkgInfo.DirectoryPath
$modifiedFiles = Get-ChangedFiles -DiffPath "$packagePath/*" -DiffFilterType ''
$modifiedFiles = @(Get-ChangedFiles -DiffPath "$packagePath/*" -DiffFilterType '')
$filteredFileCount = $modifiedFiles.Count
Write-Host "Number of modified files for package: $filteredFileCount"
return ($filteredFileCount -gt 0 -and $pkgInfo.IsNewSdk)
Expand All @@ -80,7 +87,6 @@ function Log-Input-Params()
Write-Host "Language: $($Language)"
Write-Host "Commit SHA: $($CommitSha)"
Write-Host "Repo Name: $($RepoFullName)"
Write-Host "Package Name: $($PackageName)"
}

Log-Input-Params
Expand Down