Skip to content

🪲 [Fix]: Test data reaches module tests in every consumer repository#377

Open
Marius Storhaug (MariusStorhaug) wants to merge 3 commits into
mainfrom
feat/import-testdata
Open

🪲 [Fix]: Test data reaches module tests in every consumer repository#377
Marius Storhaug (MariusStorhaug) wants to merge 3 commits into
mainfrom
feat/import-testdata

Conversation

@MariusStorhaug

@MariusStorhaug Marius Storhaug (MariusStorhaug) commented Jul 10, 2026

Copy link
Copy Markdown
Member

Module test workflows now receive the caller-provided test data (secrets and variables) in every repository that consumes Process-PSModule, and version resolution once again honors the bump label on pull requests. Previously the BeforeAll, Test, and AfterAll module jobs failed at the "Expose caller-provided test data" step because they ran a script that shipped only inside Process-PSModule's own repository, so no consumer could actually use the TestData secret introduced in v6.0.0.

Fixed: Test data now reaches module tests in consumer repositories

The TestData secret (a single-line JSON object of secrets and variables) is now exposed to the BeforeAll, Test, and AfterAll module test jobs in any repository that consumes Process-PSModule. Each job installs the shared helpers and runs the Import-TestData command, which reads the payload, masks the secrets, and publishes every entry as an environment variable for the tests.

The consumer interface is unchanged — callers already pass TestData to workflow.yml (added in v6.0.0), so no migration is required:

secrets:
  TestData: >-
    { "secrets": { "TEST_SECRET": "${{ secrets.TEST_SECRET }}" },
      "variables": { "TEST_VARIABLE": ${{ toJSON(vars.TEST_VARIABLE) }} } }

Secrets arrive masked in the logs; variables arrive verbatim.

Fixed: Bump labels are honored during version resolution on pull requests

Version resolution now always evaluates the Major/Minor/Patch bump label, so a pull request labeled Minor previews the correct next minor version instead of defaulting to a patch prerelease. This is picked up by adopting Resolve-PSModuleVersion v1.1.4.

Technical Details

  • Removed .github/scripts/Expose-TestData.ps1 (138 lines); the exposure logic moved into the shared PSModule/Install-PSModuleHelpers module as the Import-TestData command, so it no longer has to be checked out from the caller's repository.
  • BeforeAll-ModuleLocal.yml, Test-ModuleLocal.yml, and AfterAll-ModuleLocal.yml each now install PSModule/Install-PSModuleHelpers@v1.0.9 and run Import-TestData (env PSMODULE_TEST_DATA: ${{ secrets.TestData }}) in place of the deleted script.
  • Plan.yml: PSModule/Resolve-PSModuleVersion pinned to v1.1.4, which contains the always-evaluate-labels fix.
  • Build-Site.yml: Install-PSModuleHelpers bumped v1.0.8 → v1.0.9 so the action resolves to a single version across the repo.
  • README.md documents that test data is exposed through Install-PSModuleHelpers / Import-TestData.
  • All action references are pinned to release commit SHAs (IPH v1.0.9 = 8bfb84d557755c67d9b5643efe573bdcae4c1a4a, Resolve v1.1.4 = 8d1dac7f326a45ba08060c1e24a5dd6f6f00b3ab); actionlint is clean.
  • Validated end-to-end on a consumer module: all module test matrix jobs (Linux/Windows/macOS) pass, with a masked secret and a verbatim variable observed in the tests.

Replace the caller-shipped ./.github/scripts/Expose-TestData.ps1 with a call to Import-TestData, which is provided by PSModule/Install-PSModuleHelpers. All three ModuleLocal workflows (BeforeAll/Test/AfterAll) now install the helpers and run Import-TestData to expose the caller's secrets/variables to the test jobs; BeforeAll/AfterAll take the Install-PSModuleHelpers dependency they previously lacked. The helpers ref is temporarily @feat/import-testdata for end-to-end testing.
Copilot AI review requested due to automatic review settings July 10, 2026 20:15
Comment thread .github/workflows/AfterAll-ModuleLocal.yml Fixed
Comment thread .github/workflows/BeforeAll-ModuleLocal.yml Fixed
Comment thread .github/workflows/Test-ModuleLocal.yml Fixed

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

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 updates the ModuleLocal reusable workflows to expose caller-provided TestData by installing PSModule/Install-PSModuleHelpers and running its new Import-TestData command, replacing the previously caller-shipped .github/scripts/Expose-TestData.ps1 script. This centralizes the logic so consumer repos no longer need to include the script for ModuleLocal jobs to work.

Changes:

  • Replace .github/scripts/Expose-TestData.ps1 usage with Import-TestData in ModuleLocal workflows after installing Install-PSModuleHelpers.
  • Add the missing Install-PSModuleHelpers dependency to BeforeAll-ModuleLocal.yml and AfterAll-ModuleLocal.yml.
  • Update README documentation and remove the now-unused PowerShell script.

Reviewed changes

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

Show a summary per file
File Description
README.md Updates documentation to describe the new Import-TestData-based approach via Install-PSModuleHelpers.
.github/workflows/Test-ModuleLocal.yml Installs helpers and calls Import-TestData instead of the deleted script.
.github/workflows/BeforeAll-ModuleLocal.yml Adds helpers install step and switches to Import-TestData.
.github/workflows/AfterAll-ModuleLocal.yml Adds helpers install step and switches to Import-TestData.
.github/scripts/Expose-TestData.ps1 Removes the old caller-shipped implementation.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment thread .github/workflows/Test-ModuleLocal.yml Outdated
Comment thread .github/workflows/BeforeAll-ModuleLocal.yml Outdated
Comment thread .github/workflows/AfterAll-ModuleLocal.yml Outdated
@github-actions

github-actions Bot commented Jul 10, 2026

Copy link
Copy Markdown

Super-linter summary

Language Validation result
CHECKOV Pass ✅
GITLEAKS Pass ✅
GIT_MERGE_CONFLICT_MARKERS Pass ✅
MARKDOWN Pass ✅
NATURAL_LANGUAGE Pass ✅
POWERSHELL Pass ✅
PRE_COMMIT Pass ✅
SPELL_CODESPELL Pass ✅
TRIVY Pass ✅
YAML Pass ✅

All files and directories linted successfully

For more information, see the GitHub Actions workflow run

Powered by Super-linter

Temporarily reference PSModule/Resolve-PSModuleVersion@feat/always-evaluate-version-labels so the pipeline previews the label-driven bump (e.g. minor) even on a pull_request event. Pin to a released SHA before merge.
Copilot AI review requested due to automatic review settings July 10, 2026 20:50
Comment thread .github/workflows/Plan.yml Fixed

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

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

Comment thread .github/workflows/Test-ModuleLocal.yml Outdated
Comment thread .github/workflows/BeforeAll-ModuleLocal.yml Outdated
Comment thread .github/workflows/AfterAll-ModuleLocal.yml Outdated
Comment thread .github/workflows/Plan.yml
Comment thread .github/workflows/Plan.yml Outdated
…v1.1.4

Replaces the temporary E2E branch refs with released commit SHAs now that Import-TestData (IPH v1.0.9) and the always-evaluate-labels fix (Resolve v1.1.4) are released. Also bumps Build-Site's Install-PSModuleHelpers pin to v1.0.9 so the action is uniform across the repo.
Copilot AI review requested due to automatic review settings July 10, 2026 22:12
@MariusStorhaug Marius Storhaug (MariusStorhaug) changed the title Expose TestData via the Helpers module's Import-TestData command 🪲 [Fix]: Test data reaches module tests in every consumer repository Jul 10, 2026

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

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

Comment thread .github/workflows/Test-ModuleLocal.yml

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Fix version resolution ignoring the bump label on pull requests

3 participants