Skip to content

Commit

Permalink
Updating GH Workflow to validate policy file and meta names are the s…
Browse files Browse the repository at this point in the history
…ame (#1711)

Co-authored-by: Jack Tracey <[email protected]>
  • Loading branch information
Springstone and jtracey93 authored Aug 12, 2024
1 parent 0b8d048 commit cbbf394
Showing 1 changed file with 15 additions and 0 deletions.
15 changes: 15 additions & 0 deletions .github/actions-pester/Test-ModifiedPolicies.Tests.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -109,6 +109,21 @@ Describe 'UnitTest-ModifiedPolicies' {
}
}

It "Check policy metadata name matches policy filename" {
$ModifiedAddedFiles | ForEach-Object {
$PolicyJson = Get-Content -Path $_ -Raw | ConvertFrom-Json
$PolicyFile = Split-Path $_ -Leaf
$PolicyMetadataName = $PolicyJson.name
$PolicyFileNoExt = [System.IO.Path]::GetFileNameWithoutExtension($PolicyFile)
if ($PolicyFileNoExt.Contains("AzureChinaCloud") -or $PolicyFileNoExt.Contains("AzureUSGovernment"))
{
$PolicyFileNoExt = $PolicyFileNoExt.Substring(0, $PolicyFileNoExt.IndexOf("."))
}
Write-Warning "$($PolicyFileNoExt) - This is the policy metadata name: $($PolicyMetadataName)"
$PolicyMetadataName | Should -Be $PolicyFileNoExt
}
}

}

Context "Validate policy parameters" {
Expand Down

0 comments on commit cbbf394

Please sign in to comment.