Update 🚀-feature-request.md #51
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: Project Compliance Check | |
| permissions: | |
| contents: read | |
| 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)" | |
| } | |
| - name: Check for Required Files | |
| shell: pwsh | |
| run: | | |
| $required = @( | |
| 'modules/common.ps1', | |
| 'modules/services-rollback.ps1', | |
| 'modules/telemetry-rollback.ps1', | |
| 'modules/apps-rollback.ps1', | |
| 'modules/misc-rollback.ps1' | |
| ) | |
| foreach ($file in $required) { | |
| if (-not (Test-Path $file)) { | |
| throw "Required file missing: $file" | |
| } | |
| } | |
| - name: Check Modules Dot-Source Common | |
| shell: pwsh | |
| run: | | |
| $modules = Get-ChildItem modules -Filter *.ps1 | Where-Object { $_.Name -notlike '*rollback.ps1' -and $_.Name -ne 'common.ps1' } | |
| foreach ($mod in $modules) { | |
| $content = Get-Content $mod.FullName -Raw | |
| # Allow for single/double quotes, optional whitespace, and no blank lines before dot-source | |
| if ($content -notmatch '(?m)^\s*\.\s+["'']\$PSScriptRoot/common.ps1["'']') { | |
| throw "$($mod.Name) does not dot-source common.ps1" | |
| } | |
| } | |
| - name: Check Rollback Scripts for Each Module | |
| shell: pwsh | |
| run: | | |
| $mainModules = @('services','telemetry','apps','misc') | |
| foreach ($mod in $mainModules) { | |
| $rollback = "modules/$mod-rollback.ps1" | |
| if (-not (Test-Path $rollback)) { | |
| throw "Missing rollback script: $rollback" | |
| } | |
| } | |
| - name: Check README for Enhanced Features | |
| shell: pwsh | |
| run: | | |
| $readme = Get-Content README.md -Raw | |
| $features = @('dry-run','rollback','dependencies','logging','restore point') | |
| foreach ($feature in $features) { | |
| if ($readme -match $feature) { | |
| Write-Host "[OK] Feature documented: $feature" | |
| } else { | |
| throw "README.md missing feature: $feature" | |
| } | |
| } | |
| Write-Host "All required features documented in README!" | |
| - name: Check Script Version Banner | |
| shell: pwsh | |
| run: | | |
| $main = Get-Content windowstelementryblocker.ps1 -Raw | |
| if ($main -notmatch 'Script Version:') { | |
| throw "Script version banner missing in windowstelementryblocker.ps1" | |
| } |