From daad787c6ebe06ad39c8842b726677e04df504fc Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jakub=20=C4=8C=C3=A1bera?= Date: Tue, 14 Dec 2021 22:55:46 +0100 Subject: [PATCH] fix: Support yml typed manifests --- src/Action/PR.psm1 | 7 ++++++- src/Helpers.psm1 | 5 +++-- 2 files changed, 9 insertions(+), 3 deletions(-) diff --git a/src/Action/PR.psm1 b/src/Action/PR.psm1 index 5d1e824..de95a89 100644 --- a/src/Action/PR.psm1 +++ b/src/Action/PR.psm1 @@ -136,6 +136,8 @@ function Test-PRFile { $object = $null $statuses = [Ordered] @{ } + # TODO: Adopt verify utility + # Convert path into gci item to hold all needed information $manifest = Get-ChildItem $BUCKET_ROOT $f.filename Write-Log 'Manifest' $manifest @@ -144,7 +146,7 @@ function Test-PRFile { $old_e = $ErrorActionPreference $ErrorActionPreference = 'SilentlyContinue' # TODO: Yaml - $object = Get-Content $manifest.Fullname -Raw | ConvertFrom-Json + $object = shovel cat $manifest.FullName --format json | ConvertFrom-Json $ErrorActionPreference = $old_e if ($null -eq $object) { @@ -156,6 +158,9 @@ function Test-PRFile { if ($manifest.Extension -eq '.json') { Write-Log 'Invalid JSON' $invalid += $manifest.Basename + } elseif ($manifest.Extension -in ('.yml', '.yaml')) { + Write-Log 'Invalid YML' + $invalid += $manifest.Basename } else { Write-Log 'Not manifest at all' } diff --git a/src/Helpers.psm1 b/src/Helpers.psm1 index eb54b92..1347d3a 100644 --- a/src/Helpers.psm1 +++ b/src/Helpers.psm1 @@ -130,7 +130,8 @@ function Get-Manifest { # It should alwyas be one item. Just in case use -First $gciItem = Get-ChildItem $MANIFESTS_LOCATION "$Name.*" | Select-Object -First 1 - $manifest = Get-Content $gciItem.Fullname -Raw | ConvertFrom-Json + # TODO: Consider better approach? + $manifest = shovel cat $gciItem.Fullname --format json | ConvertFrom-Json return $gciItem, $manifest } @@ -254,7 +255,7 @@ function Test-NestedBucket { New-Issue -Title $adopt -Body @( 'Buckets without nested `bucket` folder are not supported. You will not be able to use actions without it.', '', - 'See for the most optimal bucket structure.' + 'See for the most optimal bucket structure.' ) }