Skip to content

Commit a0f7f61

Browse files
azure-sdksima-zhu
andauthored
Sync eng/common directory with azure-sdk-tools for PR 2086 (Azure#21867)
* Use the latest get-codeowner scripts * Update Update-DocsMsMetadata.ps1 * Update version * Update Update-DocsMsMetadata.ps1 * Update Update-DocsMsMetadata.ps1 Co-authored-by: sima-zhu <sizhu@microsoft.com> Co-authored-by: Sima Zhu <48036328+sima-zhu@users.noreply.github.com>
1 parent 5e6d3c3 commit a0f7f61

File tree

3 files changed

+20
-61
lines changed

3 files changed

+20
-61
lines changed

eng/common/pipelines/templates/steps/get-pr-owners.yml

Lines changed: 0 additions & 54 deletions
This file was deleted.

eng/common/scripts/Update-DocsMsMetadata.ps1

Lines changed: 16 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,7 @@ GitHub repository ID of the SDK. Typically of the form: 'Azure/azure-sdk-for-js'
3333
param(
3434
[Parameter(Mandatory = $true)]
3535
[array]$PackageInfoJsonLocations,
36-
36+
3737
[Parameter(Mandatory = $true)]
3838
[string]$DocRepoLocation,
3939

@@ -78,12 +78,25 @@ function GetAdjustedReadmeContent($ReadmeContent, $PackageInfo, $PackageMetadata
7878
$ReadmeContent = $ReadmeContent -replace $releaseReplaceRegex, $replacementPattern
7979
}
8080

81+
# Get the first code owners of the package.
82+
$author = "ramya-rao-a"
83+
$msauthor = "ramyar"
84+
Write-Host "Retrieve the code owner from $($PackageInfo.DirectoryPath)."
85+
$codeOwnerArray = ."$PSScriptRoot/get-codeowners.ps1" `
86+
-TargetDirectory $PackageInfo.DirectoryPath
87+
if ($codeOwnerArray) {
88+
Write-Host "Code Owners are $($codeOwnerArray -join ",")"
89+
$author = $codeOwnerArray[0]
90+
$msauthor = $author # This is a placeholder for now. Will change to the right ms alias.
91+
}
92+
Write-Host "The author of package: $author"
93+
Write-Host "The ms author of package: $msauthor"
8194
$header = @"
8295
---
8396
title: $foundTitle
8497
keywords: Azure, $Language, SDK, API, $($PackageInfo.Name), $service
85-
author: maggiepint
86-
ms.author: magpint
98+
author: $author
99+
ms.author: $msauthor
87100
ms.date: $date
88101
ms.topic: reference
89102
ms.prod: azure

eng/common/scripts/get-codeowners.ps1

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
param (
22
[string]$TargetDirectory = "", # Code path to code owners. e.g sdk/core/azure-amqp
3-
[string]$CodeOwnerFileLocation = "$PSSCriptRoot/../../../.github/CODEOWNERS", # The absolute path of CODEOWNERS file.
4-
[string]$ToolVersion = "1.0.0-dev.20211122.14", # Placeholder. Will update in next PR
3+
[string]$CodeOwnerFileLocation = (Resolve-Path $PSScriptRoot/../../../.github/CODEOWNERS), # The absolute path of CODEOWNERS file.
4+
[string]$ToolVersion = "1.0.0-dev.20211123.13", # Placeholder. Will update in next PR
55
[string]$ToolPath = (Join-Path ([System.IO.Path]::GetTempPath()) "codeowners-tool-path"), # The place to check the tool existence. Put temp path as default
66
[string]$DevOpsFeed = "https://pkgs.dev.azure.com/azure-sdk/public/_packaging/azure-sdk-for-net/nuget/v3/index.json", # DevOp tool feeds.
77
[string]$VsoVariable = "", # Option of write code owners into devop variable
@@ -34,7 +34,6 @@ function Get-CodeOwners ([string]$targetDirectory, [string]$codeOwnerFileLocatio
3434
{
3535
$command = Get-CodeOwnersTool
3636
# Filter out the non user alias from code owner list.
37-
Write-Host "Testing on $targetDirectory..."
3837
if($includeNonUserAliases) {
3938
$codeOwnersString = & $command --target-directory $targetDirectory --code-owner-file-path $codeOwnerFileLocation 2>&1
4039
}
@@ -62,6 +61,7 @@ function Get-CodeOwners ([string]$targetDirectory, [string]$codeOwnerFileLocatio
6261
}
6362

6463
function TestGetCodeOwner([string]$targetDirectory, [string]$codeOwnerFileLocation, [bool]$includeNonUserAliases = $false, [string[]]$expectReturn) {
64+
Write-Host "Testing on $targetDirectory..."
6565
$actualReturn = Get-CodeOwners -targetDirectory $targetDirectory -codeOwnerFileLocation $codeOwnerFileLocation -includeNonUserAliases $IncludeNonUserAliases
6666

6767
if ($actualReturn.Count -ne $expectReturn.Count) {
@@ -77,7 +77,7 @@ function TestGetCodeOwner([string]$targetDirectory, [string]$codeOwnerFileLocati
7777
}
7878

7979
if($Test) {
80-
$testFile = "$PSSCriptRoot/../../../tools/code-owners-parser/Azure.Sdk.Tools.RetrieveCodeOwners.Tests/CODEOWNERS"
80+
$testFile = (Resolve-Path $PSScriptRoot/../../../tools/code-owners-parser/Azure.Sdk.Tools.RetrieveCodeOwners.Tests/CODEOWNERS)
8181
TestGetCodeOwner -targetDirectory "sdk" -codeOwnerFileLocation $testFile -includeNonUserAliases $true -expectReturn @("person1", "person2")
8282
TestGetCodeOwner -targetDirectory "sdk/noPath" -codeOwnerFileLocation $testFile -includeNonUserAliases $true -expectReturn @("person1", "person2")
8383
TestGetCodeOwner -targetDirectory "/sdk/azconfig" -codeOwnerFileLocation $testFile -includeNonUserAliases $true -expectReturn @("person3", "person4")

0 commit comments

Comments
 (0)