Update 0.6-POST #6
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| name: CI | |
| on: | |
| push: | |
| branches: [ 📦Current ] | |
| pull_request: | |
| branches: [ 📦Current ] | |
| jobs: | |
| test: | |
| runs-on: windows-latest | |
| steps: | |
| - uses: actions/checkout@v3 | |
| - name: Check PowerShell Version | |
| shell: pwsh | |
| run: | | |
| $PSVersion = $PSVersionTable.PSVersion | |
| Write-Host "PowerShell Version: $PSVersion" | |
| if ($PSVersion -lt [Version]"5.1") { | |
| throw "PowerShell version must be 5.1 or higher" | |
| } | |
| - name: Test Script Syntax | |
| shell: pwsh | |
| run: | | |
| $scripts = Get-ChildItem -Path . -Filter *.ps1 -Recurse | |
| foreach ($script in $scripts) { | |
| $errors = $null | |
| $null = [System.Management.Automation.PSParser]::Tokenize((Get-Content $script.FullName -Raw), [ref]$errors) | |
| if ($errors.Count -gt 0) { | |
| throw "Syntax errors found in $($script.FullName): $($errors | ConvertTo-Json)" | |
| } | |
| } | |
| - name: Check for Admin Rights | |
| shell: pwsh | |
| run: | | |
| $isAdmin = ([Security.Principal.WindowsPrincipal] [Security.Principal.WindowsIdentity]::GetCurrent()).IsInRole([Security.Principal.WindowsBuiltInRole]::Administrator) | |
| if (-not $isAdmin) { | |
| Write-Host "Running without admin rights (expected in CI environment)" | |
| } |