🔒security(module): harden repository health#8
Merged
Conversation
Improve repository governance, CI/CD safety, generated artifact handling, PowerShell cleanup behavior, documentation hygiene, and coverage enforcement. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Up to standards ✅🟢 Issues
|
Contributor
There was a problem hiding this comment.
Pull request overview
This PR strengthens the repo’s security/maintenance posture (license, Dependabot, safer workflow permissions, docs automation fixes) while also hardening several cleanup cmdlets with safer filesystem handling and expanded unit tests, raising the enforced Pester coverage baseline.
Changes:
- Harden cleanup cmdlets (safer enumeration/removal, clearer output streams, Windows-host validation) and add/extend unit tests.
- Raise the enforced Pester coverage threshold from 2% to 40% in the Invoke-Build pipeline.
- Improve repository health/automation (MIT LICENSE, Dependabot, MkDocs/Read the Docs config fixes, workflow permission tightening, and removal of generated artifacts from source control).
Reviewed changes
Copilot reviewed 30 out of 32 changed files in this pull request and generated 4 comments.
Show a summary per file
| File | Description |
|---|---|
| src/TheCleaners/Public/Get-StaleUserProfile.ps1 | Adds parameter validation, Windows-host gating, error handling, and safer size measurement. |
| src/TheCleaners/Public/Clear-WindowsTemp.ps1 | Refactors temp cleanup enumeration/removal and switches to information/warning streams. |
| src/TheCleaners/Public/Clear-OldIISLog.ps1 | Improves path checks and registry lookup error handling. |
| src/TheCleaners/Public/Clear-OldExchangeLog.ps1 | Removes ignored Join-Path errors, adds safer enumeration/removal error handling, and propagates WhatIf to IIS cleanup. |
| src/TheCleaners/Public/Clear-CurrentUserTemp.ps1 | Adds safer enumeration, improved messaging, and more robust empty-directory cleanup loop. |
| src/TheCleaners/Private/Show-TCLogo.ps1 | Fixes help text/examples to match the function name and correct a typo. |
| src/TheCleaners/Private/Remove-OldFiles.ps1 | Reuses a cutoff date variable and suppresses nested confirmation prompts. |
| src/TheCleaners.build.ps1 | Raises coverage threshold to 40% and improves clean task error handling/message spelling. |
| src/Tests/Unit/CleanupBehavior.Tests.ps1 | Adds unit tests for Clear-WindowsTemp and Get-StaleUserProfile. |
| src/PSScriptAnalyzerSettings.psd1 | Fixes a comment typo. |
| src/Artifacts/TheCleaners.psm1 | Removes generated/local artifact from repo tracking. |
| src/Artifacts/TheCleaners.psd1 | Removes generated/local artifact from repo tracking. |
| src/Artifacts/Invoke-TheCleaners.ps1 | Removes generated/local artifact from repo tracking. |
| src/Artifacts/en-US/TheCleaners-help.xml | Removes generated/local artifact from repo tracking. |
| README.md | Switches badge link to HTTPS, adds image alt text, and fixes “Example 1” header formatting. |
| mkdocs.yml | Fixes function page nav entries to match actual cmdlet names/files. |
| LICENSE | Adds root MIT license file. |
| docs/index.md | Mirrors README fixes (HTTPS badge link, image alt text, “Example 1” header). |
| docs/Clear-OldIISLog.md | Updates “To Do” wording to a more neutral “Future enhancements…” note. |
| actions_bootstrap.ps1 | Avoids trusting PSGallery globally; installs modules CurrentUser and scopes SkipPublisherCheck to Pester on Windows. |
| .readthedocs.yaml | Points RTD to the root mkdocs.yml and installs from docs/requirements.txt. |
| .gitignore | Ignores src/Archive and src/Artifacts generated output directories. |
| .github/workflows/Publish.yml | Adds minimal permissions and switches to passing the API key via env to the publish script. |
| .github/workflows/publish.ps1 | Adds comment-based help, parameter validation, and stricter error handling for publishing. |
| .github/workflows/Deploy MkDocs.yml | Tightens permissions and installs Python deps from docs/requirements.txt; watches mkdocs.yml path. |
| .github/SECURITY.md | Updates vulnerability reporting guidance to use GitHub private reporting/advisories. |
| .github/PULL_REQUEST_TEMPLATE.md | Fixes grammar in the license checkbox line. |
| .github/dependabot.yml | Adds Dependabot updates for GitHub Actions and docs pip dependencies. |
| .github/CONTRIBUTING.md | Updates contribution target branch and fixes LICENSE link path. |
| .editorconfig | Fixes “PowerShell” casing in a comment. |
| .cspell.json | Fixes ignored-word entry for “Chocolatey”. |
Avoid recursive deletion of old temp directories with newer children, validate SystemRoot before Windows temp cleanup, and suppress nested empty-directory confirmation prompts. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
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
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Validation
pwsh -NoProfile -Command 'Set-Location -Path .\src; Invoke-Build TestLocal .\TheCleaners.build.ps1'git diff --checkNotes
Python is not installed in this local environment, so MkDocs was not executed locally. The docs workflow now installs from
docs/requirements.txtand should validate the corrected MkDocs configuration in CI.