From dadad0fa760db9a3e72d0359e1897588c551209f Mon Sep 17 00:00:00 2001 From: sima-zhu Date: Fri, 12 Nov 2021 13:13:51 -0800 Subject: [PATCH] Add more message --- eng/common/scripts/get-codeowners.ps1 | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/eng/common/scripts/get-codeowners.ps1 b/eng/common/scripts/get-codeowners.ps1 index 4091e38564a..92f77228ca1 100644 --- a/eng/common/scripts/get-codeowners.ps1 +++ b/eng/common/scripts/get-codeowners.ps1 @@ -3,25 +3,25 @@ param ( [string]$ToolVersion = "", # Placeholder. Will update in next PR [string]$ToolPath = "$env:AGENT_TOOLSDIRECTORY", # The place to check the tool existence. Put $(Agent.ToolsDirectory) as default [string]$DevOpsFeed = "https://pkgs.dev.azure.com/azure-sdk/public/_packaging/azure-sdk-for-net/nuget/v3/index.json", # DevOp tool feeds. - [string]$CodeOwnerFileLocation = "$env:SYSTEM_DEFAULTWORKINGDIRECTORY/.github/CODEOWNERS", # The place we fetch CODEOWNERS file + [string]$CodeOwnerFileLocation = "../../../.github/CODEOWNERS", # The place we fetch CODEOWNERS file [string]$VsoVariable = "" # Option of write code owners into devop variable ) - # Check if the retrieve-codeowners tool exsit or not. function InstallRetrieveCodeOwnersTool() { if (Get-Command "$ToolPath/retrieve-code-owners") { return } + Write-Warning "Installing the retrieve-code-owner tool under $ToolPath... " dotnet tool install --tool-path $toolPath --add-source "$DevOpsFeed" --version "$ToolVersion" "Azure.Sdk.Tools.RetrieveCodeOwners" } # Get the json property from tool command. function GetCodeOwnersEntryFromCommand() { - #return & "$ToolPath/retrieve-code-owners" --target-directory "$CodeOwnerPathExpression" --code-owner-file-path "$CodeOwnerFileLocation" - Push-Location .\tools\code-owners-parser\Azure.Sdk.Tools.RetrieveCodeOwners\ - dotnet run --target-directory "$CodeOwnerPathExpression" --code-owner-file-path "$CodeOwnerFileLocation" - Pop-Location + if (Get-Command "$ToolPath/retrieve-code-owners") { + Write-Error "The retieve-code-owners tool is not properly installed. Please check your tool path. $ToolPath" + } + return & "$ToolPath/retrieve-code-owners" --target-directory "$CodeOwnerPathExpression" --code-owner-file-path "$CodeOwnerFileLocation" } function GetCodeOwners([string]$codeOwnersString) @@ -40,7 +40,7 @@ function GetCodeOwners([string]$codeOwnersString) return $codeOwners } -#InstallRetrieveCodeOwnersTool +InstallRetrieveCodeOwnersTool $codeOwnerToolOutput = GetCodeOwnersEntryFromCommand # Failed at the command of fetching code owners.