Skip to content

Commit c4755e1

Browse files
committed
Refactor PowerShell module installation for AzPolicyTest and update action name for clarity
1 parent 36ce735 commit c4755e1

2 files changed

Lines changed: 9 additions & 5 deletions

File tree

.github/actions/templates/policyDocGenerateWiki/action.yml

Lines changed: 2 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -63,7 +63,7 @@ runs:
6363
with:
6464
fetch-depth: 0
6565

66-
- name: 'Install PowerShell-Yaml Module'
66+
- name: 'Install PowerShell Modules'
6767
shell: pwsh
6868
run: |
6969
if (-not (Get-Module -ListAvailable -Name powershell-yaml)) {
@@ -96,10 +96,7 @@ runs:
9696
git config --global user.name "${inputs.gitUserName}"
9797
git config --global user.email "${inputs.gitUserEmail}"
9898
#git config --global http.extraheader "AUTHORIZATION: basic $token"
99-
- name: Install AzPolicyTest module
100-
shell: pwsh
101-
run: |
102-
Install-Module -Name AzPolicyTest -RequiredVersion 3.0.0 -Force -Scope CurrentUser
99+
103100
- name: Generate Wiki
104101
id: generate_wiki
105102
continue-on-error: true

scripts/github-set-variables.ps1

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,13 @@ if (-not (Get-Module -ListAvailable -Name powershell-yaml)) {
2121
}
2222
Import-Module powershell-yaml
2323

24+
# Import AzPolicyTest module for YAML parsing
25+
if (-not (Get-Module -ListAvailable -Name AzPolicyTest)) {
26+
Write-Verbose "Installing AzPolicyTest module..."
27+
Install-Module -Name AzPolicyTest -RequiredVersion 3.0.0 -Force -Scope CurrentUser
28+
}
29+
Import-Module AzPolicyTest
30+
2431
# Read and parse YAML file
2532
Write-Output "Reading configuration from: $configFilePath"
2633
$yamlContent = Get-Content -Path $configFilePath -Raw

0 commit comments

Comments
 (0)