Skip to content

Commit

Permalink
Add more message
Browse files Browse the repository at this point in the history
  • Loading branch information
sima-zhu committed Nov 12, 2021
1 parent 55d33e9 commit dadad0f
Showing 1 changed file with 7 additions and 7 deletions.
14 changes: 7 additions & 7 deletions eng/common/scripts/get-codeowners.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand All @@ -40,7 +40,7 @@ function GetCodeOwners([string]$codeOwnersString)
return $codeOwners
}

#InstallRetrieveCodeOwnersTool
InstallRetrieveCodeOwnersTool

$codeOwnerToolOutput = GetCodeOwnersEntryFromCommand
# Failed at the command of fetching code owners.
Expand Down

0 comments on commit dadad0f

Please sign in to comment.