Skip to content

refactor(scripts): refactor dev-tools and lib scripts to use CIHelpers module#482

Merged
WilliamBerryiii merged 9 commits intomicrosoft:mainfrom
chaosdinosaur:refactor/scripts-cihelpers-devtools-lib-352
Feb 13, 2026
Merged

refactor(scripts): refactor dev-tools and lib scripts to use CIHelpers module#482
WilliamBerryiii merged 9 commits intomicrosoft:mainfrom
chaosdinosaur:refactor/scripts-cihelpers-devtools-lib-352

Conversation

@chaosdinosaur
Copy link
Copy Markdown
Collaborator

@chaosdinosaur chaosdinosaur commented Feb 12, 2026

Pull Request

Description

  • Add CIHelpers module import, mocking, and cleanup to test files for Generate-PrReference.ps1 and Get-VerifiedDownload.ps1. Add error propagation tests verifying CI annotation handling paths.

  • Replace remaining inline $env:GITHUB_ACTIONS check and raw ::error:: output in Test-ActionVersionConsistency.ps1 catch block with Write-CIAnnotation.

Related Issue(s)

Fixes #352

Type of Change

Select all that apply:

Code & Documentation:

  • 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 & Configuration:

  • GitHub Actions workflow
  • Linting configuration (markdown, PowerShell, etc.)
  • Security configuration
  • DevContainer configuration
  • Dependency update

AI Artifacts:

  • Reviewed contribution with prompt-builder agent and addressed all feedback
  • Copilot instructions (.github/instructions/*.instructions.md)
  • Copilot prompt (.github/prompts/*.prompt.md)
  • Copilot agent (.github/agents/*.agent.md)
  • Copilot skill (.github/skills/*/SKILL.md)

Note for AI Artifact Contributors:

  • Agents: Research, indexing/referencing other project (using standard VS Code GitHub Copilot/MCP tools), planning, and general implementation agents likely already exist. Review .github/agents/ before creating new ones.
  • Skills: Must include both bash and PowerShell scripts. See Skills.
  • Model Versions: Only contributions targeting the latest Anthropic and OpenAI models will be accepted. Older model versions (e.g., GPT-3.5, Claude 3) will be rejected.
  • See Agents Not Accepted and Model Version Requirements.

Other:

  • Script/automation (.ps1, .sh, .py)
  • Other (please describe):

Sample Prompts (for AI Artifact Contributions)

User Request:

Execution Flow:

Output Artifacts:

Success Indicators:

For detailed contribution requirements, see:

Testing

Checklist

Required Checks

  • Documentation is updated (if applicable)
  • Files follow existing naming conventions
  • Changes are backwards compatible (if applicable)
  • Tests added for new functionality (if applicable)

AI Artifact Contributions

  • Used /prompt-analyze to review contribution
  • Addressed all feedback from prompt-builder review
  • Verified contribution follows common standards and type-specific requirements

Required Automated Checks

The following validation commands must pass before merging:

  • Markdown linting: npm run lint:md
  • Spell checking: npm run spell-check
  • Frontmatter validation: npm run lint:frontmatter
  • Link validation: npm run lint:md-links
  • PowerShell analysis: npm run lint:ps

Security Considerations

  • This PR does not contain any sensitive or NDA information
  • Any new dependencies have been reviewed for security issues
  • Security-related scripts follow the principle of least privilege

Additional Notes

Copilot AI review requested due to automatic review settings February 12, 2026 00:06
@codecov-commenter
Copy link
Copy Markdown

codecov-commenter commented Feb 12, 2026

Codecov Report

❌ Patch coverage is 0% with 8 lines in your changes missing coverage. Please review.
✅ Project coverage is 85.34%. Comparing base (5e53271) to head (83ee4a6).

Files with missing lines Patch % Lines
scripts/security/Test-ActionVersionConsistency.ps1 0.00% 8 Missing ⚠️
Additional details and impacted files

Impacted file tree graph

@@            Coverage Diff             @@
##             main     #482      +/-   ##
==========================================
- Coverage   85.34%   85.34%   -0.01%     
==========================================
  Files          23       23              
  Lines        4476     4475       -1     
==========================================
- Hits         3820     3819       -1     
  Misses        656      656              
Flag Coverage Δ
pester 85.34% <0.00%> (-0.01%) ⬇️

Flags with carried forward coverage won't be shown. Click here to find out more.

Files with missing lines Coverage Δ
scripts/security/Test-ActionVersionConsistency.ps1 84.06% <0.00%> (+0.45%) ⬆️

... and 1 file with indirect coverage changes

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

Copy link
Copy Markdown
Contributor

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 three utility scripts to use the shared CIHelpers module, replacing inline CI annotation patterns with standardized CIHelpers function calls. The changes include updating Test-ActionVersionConsistency.ps1 to use Write-CIAnnotation instead of raw ::error:: output, and adding test coverage for error propagation in Generate-PrReference.ps1 and Get-VerifiedDownload.ps1.

Changes:

  • Replaced inline $env:GITHUB_ACTIONS checks and ::error:: output with Write-CIAnnotation calls in Test-ActionVersionConsistency.ps1
  • Added CIHelpers module imports and cleanup to test files for Generate-PrReference.ps1 and Get-VerifiedDownload.ps1
  • Added error propagation tests to verify error handling paths

Reviewed changes

Copilot reviewed 3 out of 3 changed files in this pull request and generated 6 comments.

File Description
scripts/tests/lib/Get-VerifiedDownload.Tests.ps1 Adds CIHelpers import/cleanup and error propagation test, plus CIHelpers function mocks
scripts/tests/dev-tools/Generate-PrReference.Tests.ps1 Adds CIHelpers import/cleanup and error propagation test, plus CIHelpers function mocks
scripts/security/Test-ActionVersionConsistency.ps1 Replaces inline CI pattern with Write-CIAnnotation in catch block

Copilot AI review requested due to automatic review settings February 12, 2026 00:29
Copy link
Copy Markdown
Contributor

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 3 out of 3 changed files in this pull request and generated no new comments.

@chaosdinosaur chaosdinosaur marked this pull request as ready for review February 12, 2026 16:53
@chaosdinosaur chaosdinosaur requested a review from a team as a code owner February 12, 2026 16:53
Copilot AI review requested due to automatic review settings February 12, 2026 16:53
Copy link
Copy Markdown
Contributor

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 3 out of 3 changed files in this pull request and generated 2 comments.

@chaosdinosaur
Copy link
Copy Markdown
Collaborator Author

@copilot open a new pull request to apply changes based on the comments in this thread

…est cleanup

- Replace inline $env:GITHUB_ACTIONS check and ::error:: output with Write-CIAnnotation in Test-ActionVersionConsistency.ps1
- Standardize entry point guard to $script:SkipMain pattern
- Add CIHelpers module cleanup in AfterAll for Generate-PrReference and Get-VerifiedDownload test files

🔧 - Generated by Copilot
@chaosdinosaur chaosdinosaur force-pushed the refactor/scripts-cihelpers-devtools-lib-352 branch from e3c2e5d to e8642ba Compare February 12, 2026 23:54
Copilot AI review requested due to automatic review settings February 13, 2026 01:23
Copy link
Copy Markdown
Member

@WilliamBerryiii WilliamBerryiii left a comment

Choose a reason for hiding this comment

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

Nice!

@WilliamBerryiii
Copy link
Copy Markdown
Member

Thank you for this contribution, @chaosdinosaur! 🎉 Your refactoring of the dev-tools and lib scripts to use the CIHelpers module — along with the added test coverage for error propagation and CI annotation handling — cleans up the codebase and makes it more consistent. We appreciate the effort you put into this.

Copy link
Copy Markdown
Contributor

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 3 out of 3 changed files in this pull request and generated 3 comments.

…ttern

- extract Invoke-ActionVersionConsistency function with full param block
- replace HVE_SKIP_MAIN env var with MyInvocation.InvocationName guard
- add Remove-Module CIHelpers cleanup to test AfterAll block

🔧 - Generated by Copilot
- pipe Export-ConsistencyReport to Out-Host inside Invoke-ActionVersionConsistency
- prevents Write-Output json from contaminating function return value

🐛 - Generated by Copilot
Copilot AI review requested due to automatic review settings February 13, 2026 02:32
Copy link
Copy Markdown
Contributor

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 4 out of 4 changed files in this pull request and generated 2 comments.

@WilliamBerryiii
Copy link
Copy Markdown
Member

@agreaves-ms or @katriendg ... can you do a quick review of this because I made some small changes on the cleanup for the tests.

Copilot AI review requested due to automatic review settings February 13, 2026 14:33
Copy link
Copy Markdown
Contributor

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 4 out of 4 changed files in this pull request and generated 1 comment.

Copy link
Copy Markdown
Contributor

@katriendg katriendg left a comment

Choose a reason for hiding this comment

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

The changes themselves look OK to me, though I believe the PR description is no longer accurate. Maybe this is due to changes having happened and merged from main, but it was a bit confusing to try and see what has been changed...
There are no new calls to CIHelpers as far as I can see, or added tests and mocking to test files which I don't really see?

Probably best to rebuild the PR description to match.
Thanks a lot in any case and sorry if our fast changes are making it harder for you :)

Copy link
Copy Markdown
Contributor

@katriendg katriendg left a comment

Choose a reason for hiding this comment

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

And I meant to approve...

@WilliamBerryiii
Copy link
Copy Markdown
Member

Addressing the two remaining unresolved review threads:


1. Attribute ordering ([CmdletBinding()] before [OutputType([int])]) — @copilot-pull-request-reviewer

Fixed in commit c12758b. [CmdletBinding()] now precedes [OutputType([int])] on Invoke-ActionVersionConsistency, matching codebase convention.


2. Code coverage for Invoke-ActionVersionConsistency@katriendg

Ran Pester with JaCoCo code coverage against Test-ActionVersionConsistency.ps1:

Metric Value
Overall coverage 82.47% (207/251 commands hit)
Threshold 75%
Tests 47/47 passing

Invoke-ActionVersionConsistency (lines 380–414) shows 34 missed commands in the Pester in-process coverage report. This is expected because the Main Script Execution tests invoke the script via pwsh -NoProfile -Command subprocesses, which Pester's coverage instrumentation cannot track across process boundaries. Those 9 subprocess tests exercise all code paths in the function — exit codes for version mismatches, missing version comments, FailOnMismatch, FailOnMissingComment, and the success path.

The function is fully tested through the existing Main Script Execution test suite; the apparent gap is a Pester coverage tracking limitation, not a testing gap.

Copilot AI review requested due to automatic review settings February 13, 2026 16:20
Copy link
Copy Markdown
Contributor

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 4 out of 4 changed files in this pull request and generated no new comments.

@WilliamBerryiii WilliamBerryiii merged commit fdf9145 into microsoft:main Feb 13, 2026
24 checks passed
@chaosdinosaur chaosdinosaur deleted the refactor/scripts-cihelpers-devtools-lib-352 branch February 13, 2026 16:47
WilliamBerryiii pushed a commit that referenced this pull request Feb 13, 2026
🤖 I have created a release *beep* *boop*
---


##
[2.3.0](hve-core-v2.2.0...hve-core-v2.3.0)
(2026-02-13)


### ✨ Features

* **agents:** add GitHub backlog management pipeline
([#448](#448))
([2b4d123](2b4d123))
* **docs:** define inactivity closure policies for issues and PRs
([#452](#452))
([5e710fd](5e710fd))
* **extension:** implement collection-based plugin distribution system
([#439](#439))
([3156d98](3156d98))
* **instructions:** replace EVEN/ODD hardcoding with runtime milestone
discovery protocol
([#486](#486))
([ae95eb2](ae95eb2))
* **plugin:** support Copilot CLI plugin generation from collection
manifests ([#496](#496))
([e6cee85](e6cee85))
* **scripts:** enhance on-create.sh to install actionlint and PowerShell
modules ([#500](#500))
([67585f5](67585f5))


### 🐛 Bug Fixes

* **docs:** replace broken relative link with inline code reference
([#465](#465))
([8133b36](8133b36))
* **instructions:** prevent local-only paths from leaking into GitHub
issues ([#489](#489))
([497d2fe](497d2fe))
* **workflows:** prevent release-please infinite loop on main branch
([#470](#470))
([134bdd6](134bdd6))
* **workflows:** remove release-please skip guard that prevents tag
creation ([#511](#511))
([5e53271](5e53271))


### 📚 Documentation

* **agents:** add GitHub Backlog Manager documentation and agent catalog
([#503](#503))
([5e818ce](5e818ce))
* align CONTRIBUTING.md with docs/contributing/ guides
([#445](#445))
([73ef6aa](73ef6aa))


### ♻️ Refactoring

* **scripts:** refactor dev-tools and lib scripts to use CIHelpers
module ([#482](#482))
([fdf9145](fdf9145))
* **scripts:** standardize PowerShell entry point guard pattern
([#477](#477))
([6b84a8e](6b84a8e))


### 🔧 Maintenance

* **config:** standardize action mappings in artifact-retention.yml
([#487](#487))
([7927db2](7927db2))
* **deps-dev:** bump cspell from 9.6.2 to 9.6.4 in the npm-dependencies
group ([#461](#461))
([c788095](c788095))
* **deps:** bump actions/setup-python from 5.1.1 to 6.2.0 in the
github-actions group
([#462](#462))
([69ef3c9](69ef3c9))
* **security:** add SBOM artifact retention policy
([#479](#479))
([8031557](8031557)),
closes [#453](#453)

---
This PR was generated with [Release
Please](https://github.com/googleapis/release-please). See
[documentation](https://github.com/googleapis/release-please#release-please).

Co-authored-by: hve-core-release-please[bot] <254602402+hve-core-release-please[bot]@users.noreply.github.com>
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): refactor dev-tools and lib scripts to use CIHelpers module

5 participants