refactor(scripts): replace GitHub-only CI wrappers with CIHelpers in linting scripts#184
Merged
WilliamBerryiii merged 3 commits intomainfrom Feb 16, 2026
Merged
Conversation
…linting scripts - import CIHelpers.psm1 in all four linting scripts - replace Write-GitHubAnnotation/Set-GitHubOutput/Set-GitHubEnv/Write-GitHubStepSummary with CIHelpers equivalents - remove inline ::group::/::endgroup::/::error:: workflow commands from Invoke-PSScriptAnalyzer.ps1 - add standard file headers, error handling, and main execution guards - remove dead Get-RelativePrefix function from Markdown-Link-Check.ps1 🔧 - Generated by Copilot
Dependency Review✅ No vulnerabilities or license issues or OpenSSF Scorecard issues found.Scanned FilesNone |
There was a problem hiding this comment.
Pull request overview
This PR refactors four PowerShell linting scripts under scripts/linting/ to replace GitHub Actions-specific CI wrapper calls with the shared CIHelpers.psm1 module, enabling CI platform portability across GitHub Actions, Azure DevOps, and local environments. The refactoring wraps core logic into testable functions with main execution guards, replaces GitHub-specific functions (Write-GitHubAnnotation, Set-GitHubOutput, Set-GitHubEnv, Write-GitHubStepSummary) with platform-agnostic equivalents (Write-CIAnnotation, Set-CIOutput, Set-CIEnv, Write-CIStepSummary), standardizes file headers, and removes dead code.
Changes:
- Imported
CIHelpers.psm1alongside existingLintingHelpers.psm1in all four scripts - Replaced inline GitHub Actions workflow commands and GitHub-specific function calls with CI-agnostic alternatives
- Wrapped core logic into testable functions with standardized main execution guards and error handling
- Removed
-SoftFailparameter fromInvoke-PSScriptAnalyzer.ps1and unusedGet-RelativePrefixfunction fromMarkdown-Link-Check.ps1
Reviewed changes
Copilot reviewed 4 out of 4 changed files in this pull request and generated 4 comments.
| File | Description |
|---|---|
| scripts/linting/Invoke-PSScriptAnalyzer.ps1 | Removed -SoftFail parameter; replaced GitHub-specific calls with CIHelpers; wrapped logic in Invoke-PSScriptAnalyzerCore function; removed inline ::group::/::error:: commands |
| scripts/linting/Markdown-Link-Check.ps1 | Replaced GitHub-specific calls with CIHelpers; wrapped logic in Invoke-MarkdownLinkCheckCore function; removed unused Get-RelativePrefix function |
| scripts/linting/Link-Lang-Check.ps1 | Imported CIHelpers; wrapped logic in Invoke-LinkLanguageCheck function; replaced if ($Verbose) guards with native Write-Verbose cmdlet |
| scripts/linting/Invoke-LinkLanguageCheck.ps1 | Replaced GitHub-specific calls with CIHelpers; wrapped logic in Invoke-LinkLanguageCheckCore function; added comprehensive documentation |
- add .ToString() to Set-CIOutput integer args in PSScriptAnalyzer and LinkLanguageCheck - filter ErrorRecord objects from 2>&1 output before JSON parsing in Invoke-LinkLanguageCheck - remove return 0 mixing with Write-Output in Link-Lang-Check function pipeline - use @().Count for null-safe array access in Invoke-LinkLanguageCheck - add blank line after SPDX header in Link-Lang-Check.ps1 for consistency - replace -SoftFail param with continue-on-error in ps-script-analyzer workflow 🔧 - Generated by Copilot
agreaves-ms
approved these changes
Feb 16, 2026
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.
Description
Refactored all four PowerShell linting scripts under
scripts/linting/to replace GitHub Actions-specific CI wrapper calls with the sharedCIHelpers.psm1module. This enables CI platform portability across GitHub Actions, Azure DevOps, and local environments while preserving the existing external contract (file paths, parameters, exit codes, artifact output paths).Closes #69
CIHelpers.psm1in all four linting scripts alongside existingLintingHelpers.psm1Write-GitHubAnnotationwithWrite-CIAnnotation,Set-GitHubOutputwithSet-CIOutput,Set-GitHubEnvwithSet-CIEnv, andWrite-GitHubStepSummarywithWrite-CIStepSummary::group::/::endgroup::/::error::workflow commands fromInvoke-PSScriptAnalyzer.ps1#Requires -Version 7.0),Set-StrictMode, and main execution guards across all scriptsInvoke-PSScriptAnalyzerCore,Invoke-MarkdownLinkCheckCore,Invoke-LinkLanguageCheckCore,Invoke-LinkLanguageCheck)exitcalls withreturninside wrapper functions for improved testabilityGet-RelativePrefixfunction fromMarkdown-Link-Check.ps1-SoftFailparameter fromInvoke-PSScriptAnalyzer.ps1(callers use workflow-levelcontinue-on-errorinstead)if ($Verbose)guards with nativeWrite-Verbosecmdlet usage inLink-Lang-Check.ps1Type of Change
Component(s) Affected
deploy/000-prerequisites- Azure subscription setupdeploy/001-iac- Terraform infrastructuredeploy/002-setup- OSMO control plane / Helmdeploy/004-workflow- Training workflowssrc/training- Python training scriptsdocs/- DocumentationTesting Performed
planreviewed (no unexpected changes)applytested in dev environmentsmoke_test_azure.py)Documentation Impact
Checklist
🔧 - Generated by Copilot