Skip nested YAML structures

Signed-off-by: Pedro Algarvio <palgarvio@vmware.com>
This commit is contained in:
Pedro Algarvio 2023-09-11 15:43:10 +01:00
parent c096bc6022
commit 5a89789ba7
No known key found for this signature in database
GPG key ID: BB36BF6584A298FF
2 changed files with 2 additions and 0 deletions

View file

@ -108,6 +108,7 @@ if ( [String]::IsNullOrEmpty($Version) ) {
$yaml = Get-Content -Path "$PROJECT_DIR\cicd\shared-gh-workflows-context.yml"
$dict_versions = @{}
$yaml | ForEach-Object {
if ( $_.Name.Trim().EndsWith(":") ) { return } # This is likely a nested structure
$val1, $val2 = $_ -split ": "
$dict_versions[$val1] = $val2.Trim("""")
}

View file

@ -78,6 +78,7 @@ function Write-Result($result, $ForegroundColor="Green") {
$yaml = Get-Content -Path "$PROJECT_DIR\cicd\shared-gh-workflows-context.yml"
$dict_versions = @{}
$yaml | ForEach-Object {
if ( $_.Name.Trim().EndsWith(":") ) { return } # This is likely a nested structure
$val1, $val2 = $_ -split ": "
$dict_versions[$val1] = $val2.Trim("""")
}