Skip to content

Rename generic Helpers.psm1 helper modules to per-action names (Action.Helpers) across all actions #364

Description

Context

Per the naming standard in MSXOrg/docs (linked below), an action's private helper module must be named after the action (<ActionRepo>.Helpers) instead of the generic Helpers. A module named Helpers collides with the shared framework Helpers module (installed by PSModule/Install-PSModuleHelpers, and loaded into the test session by PSModule/Invoke-Pester). Two modules named Helpers in one session break module resolution and make Pester Mock -ModuleName Helpers ambiguous.

Concrete failure and fix template: PSModule/Resolve-PSModuleVersion#4 — renamed the helper module, updated the entry-script import and the test -ModuleName, and kept the framework Import-Module -Name 'Helpers' line. RuntimeException: Multiple script or manifest modules named 'Helpers' are currently loaded.

Scope — rename in every action repo that ships a generic helper module

Confirmed via org-wide code search (filename:Helpers.psm1 org:PSModule):

  • Debugsrc/Helpers.psm1 -> Debug.Helpers.psm1
  • Get-PesterCodeCoveragesrc/Helpers.psm1 -> Get-PesterCodeCoverage.Helpers.psm1
  • Invoke-Pestersrc/Helpers.psm1 -> Invoke-Pester.Helpers.psm1
  • Resolve-PSModuleVersion — align the interim scripts/ResolveVersion.psm1 (from Lock workflow to use v0 of actions #4) to Resolve-PSModuleVersion.Helpers.psm1

Special case (do NOT blindly rename):

  • Install-PSModuleHelpers — ships src/Helpers/Helpers.psm1, which is the shared canonical Helpers module imported across actions. Keep it named Helpers; document the carve-out.

Per-repo change checklist

For each affected action:

  1. git mv the module file to <ActionRepo>.Helpers.psm1 (and the matching test file, if any).
  2. Update the entry-script import path to Import-Module -Name "$PSScriptRoot/<ActionRepo>.Helpers.psm1", keeping the framework Import-Module -Name 'Helpers' line.
  3. Update tests: -ModuleName '<ActionRepo>.Helpers' plus the module import path and any data-file path.
  4. Verify CI green (Action-Test / Pester). The collision only reproduces where the framework Helpers is loaded, so validate locally by pre-loading a dummy module named Helpers before Invoke-Pester.
  5. Release the action.

Audit for completeness

Code search only indexes default branches and files literally named Helpers.psm1. Before closing, audit all action repos (any repo with a root action.yml) for any helper/script module whose name is not <ActionRepo>.Helpers:

# per action repo (check scripts/ and src/)
gh api repos/PSModule/<repo>/contents/scripts --jq '.[].name'
gh api repos/PSModule/<repo>/contents/src --jq '.[].name'

Acceptance criteria

  • Every PSModule action's private helper module is named <ActionRepo>.Helpers (except the documented Install-PSModuleHelpers carve-out).
  • No action ships a module named Helpers except Install-PSModuleHelpers.
  • All affected actions have green CI and a released version.
  • Standard declared in MSXOrg/docs (see Related).

Related

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Fields

    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions