Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
25 commits
Select commit Hold shift + click to select a range
675a191
Add robust pre-commit PowerShell test integration and CI optimization
AprilDeFeu Nov 14, 2025
162a72e
Initial plan
Copilot Nov 14, 2025
8c20533
Fix PowerShell tests: Update to Pester v5 syntax and remove hardcoded…
Copilot Nov 14, 2025
b86ba8c
Update pre-commit hook to Pester v5 and fix test result format
Copilot Nov 15, 2025
48e7cff
Merge pull request #16 from AprilDeFeu/copilot/sub-pr-15
AprilDeFeu Nov 15, 2025
ad7f45d
Initial plan
Copilot Nov 15, 2025
fddf330
Address PR review feedback: fix Confirm-Action calls, restore edge ca…
Copilot Nov 15, 2025
06938b1
Fix PSCmdlet references in scriptblocks and update documentation
Copilot Nov 15, 2025
34de42d
Merge pull request #17 from AprilDeFeu/copilot/sub-pr-15
AprilDeFeu Nov 15, 2025
b6956b0
Update .githooks/pre-commit.ps1
AprilDeFeu Nov 15, 2025
3965bbc
Initial plan
Copilot Nov 16, 2025
b6bac37
Fix PSScriptAnalyzer warnings and remove unused DestructiveMode param…
Copilot Nov 16, 2025
d35cf4f
Update PowerShell/system-administration/maintenance/system-maintenanc…
AprilDeFeu Nov 16, 2025
aad1413
Merge pull request #18 from AprilDeFeu/copilot/sub-pr-15-again
AprilDeFeu Nov 16, 2025
da50f48
Update PowerShell/system-administration/maintenance/system-maintenanc…
AprilDeFeu Nov 16, 2025
69c5e4d
Update .githooks/pre-commit.ps1
AprilDeFeu Nov 16, 2025
d54bd48
Update PowerShell/system-administration/maintenance/system-maintenanc…
AprilDeFeu Nov 16, 2025
ab9e85d
Update .githooks/pre-commit.ps1
AprilDeFeu Nov 16, 2025
2585550
Update PowerShell/system-administration/maintenance/system-maintenanc…
AprilDeFeu Nov 16, 2025
2ee523a
Update PowerShell/system-administration/maintenance/system-maintenanc…
AprilDeFeu Nov 16, 2025
66d08cf
Update .githooks/pre-commit.ps1
AprilDeFeu Nov 16, 2025
4a3a3d8
Update .githooks/pre-commit.ps1
AprilDeFeu Nov 16, 2025
5606b86
Update .githooks/pre-commit.ps1
AprilDeFeu Nov 16, 2025
7954f09
Update PowerShell/system-administration/maintenance/system-maintenanc…
AprilDeFeu Nov 16, 2025
b611a3e
Update PowerShell/system-administration/maintenance/system-maintenanc…
AprilDeFeu Nov 16, 2025
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
46 changes: 46 additions & 0 deletions .githooks/pre-commit.ps1
Original file line number Diff line number Diff line change
@@ -0,0 +1,46 @@
#!/usr/bin/env pwsh
# Pre-commit hook: Run Pester tests for system-maintenance.ps1 and save results
$ErrorActionPreference = 'Stop'
$testScript = 'PowerShell/system-administration/maintenance/system-maintenance.ps1'
$testPath = 'tests/unit/PowerShell/system-maintenance.Tests.ps1'
$resultsPath = 'tests/results/system-maintenance.xml'

if (Test-Path $testPath) {
Write-Information "Running Pester tests for $testScript..."

# Set SCRIPTS_ROOT environment variable for tests
$env:SCRIPTS_ROOT = (Get-Location).Path

# Ensure the results directory exists before running Pester
New-Item -ItemType Directory -Path (Split-Path $resultsPath -Parent) -Force -ErrorAction SilentlyContinue | Out-Null

# Use Pester v5 configuration syntax
$config = New-PesterConfiguration
$config.Run.Path = $testPath
$config.Run.PassThru = $true
$config.TestResult.Enabled = $true
$config.TestResult.OutputPath = $resultsPath
$config.TestResult.OutputFormat = 'JUnitXml'

# Ensure the results directory exists before running Pester
New-Item -ItemType Directory -Path (Split-Path $resultsPath -Parent) -Force -ErrorAction SilentlyContinue
$result = Invoke-Pester -Configuration $config

if ($result.FailedCount -gt 0) {
Write-Error "Tests failed. Aborting commit."
exit 1
}

if (Test-Path $resultsPath) {
Write-Information "Test results saved to: $resultsPath"
}
else {
Write-Information "Test results not found, aborting commit."
exit 1
}
}
else {
Write-Output "Test file not found: $testPath"
Write-Host "Cannot verify script quality. Aborting commit."
exit 1
}
7 changes: 7 additions & 0 deletions .github/copilot-instructions.md
Original file line number Diff line number Diff line change
Expand Up @@ -264,3 +264,10 @@ This repository prefers:
- Create pull requests via GitHub web UI
- Avoid using `gh` CLI in automation
- Refer to `.github/PR_PREFERENCES.md` for detailed workflow guidance

## Copilot PR Review Policy

**IMPORTANT**: Do NOT automatically review pull requests when they are marked as "ready for review".
- Only perform PR reviews when explicitly requested by tagging @copilot in a comment
- Premium review requests should be used wisely and deliberately
- Wait for manual request before analyzing or reviewing code changes
3 changes: 3 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -2,3 +2,6 @@

#Ignore vscode AI rules
.github\instructions\codacy.instructions.md

# Test results
tests/results/
7 changes: 7 additions & 0 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -35,3 +35,10 @@ repos:
language: system
types: [powershell]
pass_filenames: false
- id: powershell-pester-tests
name: powershell-pester-tests
entry: pwsh .githooks/pre-commit.ps1
language: system
types: [powershell]
files: ^PowerShell/system-administration/maintenance/system-maintenance\.ps1$
pass_filenames: false
Loading