Skip to content

refactor(scripts): replace GitHub-only CI wrappers with CIHelpers in linting scripts#184

Merged
WilliamBerryiii merged 3 commits intomainfrom
refactor/issue-69-linting-scripts-cihelpers
Feb 16, 2026
Merged

refactor(scripts): replace GitHub-only CI wrappers with CIHelpers in linting scripts#184
WilliamBerryiii merged 3 commits intomainfrom
refactor/issue-69-linting-scripts-cihelpers

Conversation

@WilliamBerryiii
Copy link
Member

Description

Refactored all four PowerShell linting scripts under scripts/linting/ to replace GitHub Actions-specific CI wrapper calls with the shared CIHelpers.psm1 module. 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

  • Imported CIHelpers.psm1 in all four linting scripts alongside existing LintingHelpers.psm1
  • Replaced Write-GitHubAnnotation with Write-CIAnnotation, Set-GitHubOutput with Set-CIOutput, Set-GitHubEnv with Set-CIEnv, and Write-GitHubStepSummary with Write-CIStepSummary
  • Removed inline ::group:: / ::endgroup:: / ::error:: workflow commands from Invoke-PSScriptAnalyzer.ps1
  • Added standard file headers (copyright, SPDX, #Requires -Version 7.0), Set-StrictMode, and main execution guards across all scripts
  • Wrapped core logic into testable functions (Invoke-PSScriptAnalyzerCore, Invoke-MarkdownLinkCheckCore, Invoke-LinkLanguageCheckCore, Invoke-LinkLanguageCheck)
  • Replaced exit calls with return inside wrapper functions for improved testability
  • Removed dead Get-RelativePrefix function from Markdown-Link-Check.ps1
  • Removed unused -SoftFail parameter from Invoke-PSScriptAnalyzer.ps1 (callers use workflow-level continue-on-error instead)
  • Replaced if ($Verbose) guards with native Write-Verbose cmdlet usage in Link-Lang-Check.ps1

Type of Change

  • 🐛 Bug fix (non-breaking change fixing an issue)
  • ✨ New feature (non-breaking change adding functionality)
  • 💥 Breaking change (fix or feature causing existing functionality to change)
  • 📚 Documentation update
  • 🏗️ Infrastructure change (Terraform/IaC)
  • ♻️ Refactoring (no functional changes)

Component(s) Affected

  • deploy/000-prerequisites - Azure subscription setup
  • deploy/001-iac - Terraform infrastructure
  • deploy/002-setup - OSMO control plane / Helm
  • deploy/004-workflow - Training workflows
  • src/training - Python training scripts
  • docs/ - Documentation

Note: Changes target scripts/linting/ (not listed above). Four scripts modified:
Invoke-PSScriptAnalyzer.ps1, Markdown-Link-Check.ps1, Invoke-LinkLanguageCheck.ps1, Link-Lang-Check.ps1

Testing Performed

  • Terraform plan reviewed (no unexpected changes)
  • Terraform apply tested in dev environment
  • Training scripts tested locally with Isaac Sim
  • OSMO workflow submitted successfully
  • Smoke tests passed (smoke_test_azure.py)

PSScriptAnalyzer ran against all four modified scripts with project settings (PSScriptAnalyzer.psd1) — zero violations detected. Workflow YAML files verified as unchanged callers with identical file paths, parameters, exit codes, and artifact output paths.

Documentation Impact

  • No documentation changes needed
  • Documentation updated in this PR
  • Documentation issue filed

Checklist

🔧 - Generated by Copilot

…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
Copilot AI review requested due to automatic review settings February 15, 2026 01:02
@github-actions
Copy link

github-actions bot commented Feb 15, 2026

Dependency Review

✅ No vulnerabilities or license issues or OpenSSF Scorecard issues found.

Scanned Files

None

Copy link

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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.psm1 alongside existing LintingHelpers.psm1 in 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 -SoftFail parameter from Invoke-PSScriptAnalyzer.ps1 and unused Get-RelativePrefix function from Markdown-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

WilliamBerryiii and others added 2 commits February 15, 2026 20:16
- 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
Copilot AI review requested due to automatic review settings February 16, 2026 20:47
Copy link

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Copilot reviewed 5 out of 5 changed files in this pull request and generated no new comments.

@WilliamBerryiii WilliamBerryiii merged commit 033cc9c into main Feb 16, 2026
16 checks passed
@WilliamBerryiii WilliamBerryiii deleted the refactor/issue-69-linting-scripts-cihelpers branch February 16, 2026 21:47
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

refactor(scripts): standardize linting scripts with shared modules

3 participants