Skip to content

Commit

Permalink
fix: Support yml typed manifests
Browse files Browse the repository at this point in the history
  • Loading branch information
Ash258 committed Dec 14, 2021
1 parent 293f0a5 commit daad787
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 3 deletions.
7 changes: 6 additions & 1 deletion src/Action/PR.psm1
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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) {
Expand All @@ -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'
}
Expand Down
5 changes: 3 additions & 2 deletions src/Helpers.psm1
Original file line number Diff line number Diff line change
Expand Up @@ -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
}
Expand Down Expand Up @@ -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 <https://github.com/Ash258/GenericBucket> for the most optimal bucket structure.'
'See <https://github.com/shovel-org/GenericBucket> for the most optimal bucket structure.'
)
}

Expand Down

0 comments on commit daad787

Please sign in to comment.