From 39faaef98e1add5829ccb9ff36428bb97569a6df Mon Sep 17 00:00:00 2001 From: Marius Storhaug Date: Fri, 10 Jul 2026 22:17:54 +0200 Subject: [PATCH 1/7] test: E2E for Import-TestData, section docs, and versioning Point CI at PSModule/Process-PSModule@feat/import-testdata. Push a masked secret (TEST_SECRET) and a non-masked variable (TEST_VARIABLE) into the module test jobs via TestData, asserted in tests/Environment.Tests.ps1. Reorganize public functions into sections (Greetings/ with a named landing page, DateAndTime/ with an index.md landing page) to show documentation on the section nodes, leaving Get-PSModuleTest at the top level. --- .github/workflows/Process-PSModule.yml | 7 ++++- .../{ => DateAndTime}/Get-CurrentDateTime.ps1 | 2 +- src/functions/public/DateAndTime/index.md | 7 +++++ .../public/{ => Greetings}/Get-Greeting.ps1 | 2 +- src/functions/public/Greetings/Greetings.md | 7 +++++ tests/Environment.Tests.ps1 | 30 +++++++++++++++++++ 6 files changed, 52 insertions(+), 3 deletions(-) rename src/functions/public/{ => DateAndTime}/Get-CurrentDateTime.ps1 (97%) create mode 100644 src/functions/public/DateAndTime/index.md rename src/functions/public/{ => Greetings}/Get-Greeting.ps1 (97%) create mode 100644 src/functions/public/Greetings/Greetings.md create mode 100644 tests/Environment.Tests.ps1 diff --git a/.github/workflows/Process-PSModule.yml b/.github/workflows/Process-PSModule.yml index 95c66fa..3685008 100644 --- a/.github/workflows/Process-PSModule.yml +++ b/.github/workflows/Process-PSModule.yml @@ -27,6 +27,11 @@ permissions: jobs: Process-PSModule: - uses: PSModule/Process-PSModule/.github/workflows/workflow.yml@60bdf8a5a4c92c53fcf2a8d23f7d5f5c93e6864e # v5.4.3 + uses: PSModule/Process-PSModule/.github/workflows/workflow.yml@feat/import-testdata # E2E: temporary branch ref for the Import-TestData test secrets: APIKey: ${{ secrets.APIKey }} + # E2E: push a secret (masked in logs) and a variable (not masked) into the module test jobs. + # Import-TestData exposes each entry as $env:; asserted in tests/Environment.Tests.ps1. + TestData: >- + { "secrets": { "TEST_SECRET": "${{ secrets.TEST_SECRET }}" }, + "variables": { "TEST_VARIABLE": ${{ toJSON(vars.TEST_VARIABLE) }} } } diff --git a/src/functions/public/Get-CurrentDateTime.ps1 b/src/functions/public/DateAndTime/Get-CurrentDateTime.ps1 similarity index 97% rename from src/functions/public/Get-CurrentDateTime.ps1 rename to src/functions/public/DateAndTime/Get-CurrentDateTime.ps1 index eb36af1..c732d1a 100644 --- a/src/functions/public/Get-CurrentDateTime.ps1 +++ b/src/functions/public/DateAndTime/Get-CurrentDateTime.ps1 @@ -23,7 +23,7 @@ Returns the current date in a custom format like "Monday, January 20, 2026". .LINK - https://MariusStorhaug.github.io/MariusTestModule/Functions/Get-CurrentDateTime/ + https://MariusStorhaug.github.io/MariusTestModule/Functions/DateAndTime/Get-CurrentDateTime/ #> [OutputType([string])] [CmdletBinding()] diff --git a/src/functions/public/DateAndTime/index.md b/src/functions/public/DateAndTime/index.md new file mode 100644 index 0000000..03c46dd --- /dev/null +++ b/src/functions/public/DateAndTime/index.md @@ -0,0 +1,7 @@ +# Date and Time + +Functions for retrieving and formatting the current date and time. + +This section's landing page is provided by an `index.md` file. When Process-PSModule builds the +documentation site, this page becomes the landing page for the **Date and Time** group in the +navigation on GitHub Pages. diff --git a/src/functions/public/Get-Greeting.ps1 b/src/functions/public/Greetings/Get-Greeting.ps1 similarity index 97% rename from src/functions/public/Get-Greeting.ps1 rename to src/functions/public/Greetings/Get-Greeting.ps1 index 37712c2..f2ffe64 100644 --- a/src/functions/public/Get-Greeting.ps1 +++ b/src/functions/public/Greetings/Get-Greeting.ps1 @@ -23,7 +23,7 @@ Returns "Good Morning, Alice!" to the user. .LINK - https://MariusStorhaug.github.io/MariusTestModule/Functions/Get-Greeting/ + https://MariusStorhaug.github.io/MariusTestModule/Functions/Greetings/Get-Greeting/ #> [OutputType([string])] [CmdletBinding()] diff --git a/src/functions/public/Greetings/Greetings.md b/src/functions/public/Greetings/Greetings.md new file mode 100644 index 0000000..4c8d79a --- /dev/null +++ b/src/functions/public/Greetings/Greetings.md @@ -0,0 +1,7 @@ +# Greetings + +Functions for composing greeting messages. + +This section's landing page is provided by a file named after its folder (`Greetings.md`). When +Process-PSModule builds the documentation site, this page becomes the landing page for the +**Greetings** group in the navigation on GitHub Pages. diff --git a/tests/Environment.Tests.ps1 b/tests/Environment.Tests.ps1 new file mode 100644 index 0000000..8e783ef --- /dev/null +++ b/tests/Environment.Tests.ps1 @@ -0,0 +1,30 @@ +[Diagnostics.CodeAnalysis.SuppressMessageAttribute( + 'PSReviewUnusedParameter', '', + Justification = 'Required for Pester tests' +)] +[Diagnostics.CodeAnalysis.SuppressMessageAttribute( + 'PSUseDeclaredVarsMoreThanAssignments', '', + Justification = 'Required for Pester tests' +)] +[CmdletBinding()] +param() + +Describe 'TestData is pushed into the module tests' { + # TEST_SECRET (from the "secrets" map, masked) and TEST_VARIABLE (from the "variables" map, not + # masked) are public non-secret fixtures that exist only to prove the calling workflow can push + # secrets and variables into the module test jobs. The calling workflow passes them through a + # single TestData object and Import-TestData (from Install-PSModuleHelpers) exposes them as + # environment variables; these tests confirm they arrive with the expected values. + + It 'Exposes the secret from the "secrets" map' { + $actual = [System.Environment]::GetEnvironmentVariable('TEST_SECRET') + $actual | Should -Not -BeNullOrEmpty + $actual | Should -BeExactly 'mariustestmodule-secret-fixture-value' + } + + It 'Exposes the variable from the "variables" map' { + $actual = [System.Environment]::GetEnvironmentVariable('TEST_VARIABLE') + $actual | Should -Not -BeNullOrEmpty + $actual | Should -BeExactly 'mariustestmodule-variable-fixture-value' + } +} From 5643f7b9daef7ac78b971f58317523f65b52ab0b Mon Sep 17 00:00:00 2001 From: Marius Storhaug Date: Fri, 10 Jul 2026 22:22:40 +0200 Subject: [PATCH 2/7] test: print the secret and variable in plain text to show masking Adds an It block that Write-Hosts both values. GitHub Actions masks TEST_SECRET (registered via ::add-mask:: by Import-TestData) to *** in the log, while TEST_VARIABLE is printed verbatim - demonstrating that only the secrets map is masked. --- tests/Environment.Tests.ps1 | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/tests/Environment.Tests.ps1 b/tests/Environment.Tests.ps1 index 8e783ef..1544386 100644 --- a/tests/Environment.Tests.ps1 +++ b/tests/Environment.Tests.ps1 @@ -6,6 +6,10 @@ 'PSUseDeclaredVarsMoreThanAssignments', '', Justification = 'Required for Pester tests' )] +[Diagnostics.CodeAnalysis.SuppressMessageAttribute( + 'PSAvoidUsingWriteHost', '', + Justification = 'Deliberately prints the values to the log to demonstrate GitHub Actions masking' +)] [CmdletBinding()] param() @@ -27,4 +31,12 @@ Describe 'TestData is pushed into the module tests' { $actual | Should -Not -BeNullOrEmpty $actual | Should -BeExactly 'mariustestmodule-variable-fixture-value' } + + It 'Masks the secret in the log even when a test prints it in plain text' { + # Deliberately try to leak both values to the log with Write-Host. Because Import-TestData + # registered the secret via ::add-mask::, GitHub Actions redacts it to *** in the log, while + # the variable (not masked) is printed verbatim. Inspect the job log to see the difference. + Write-Host "Secret in plain text: $env:TEST_SECRET" + Write-Host "Variable in plain text: $env:TEST_VARIABLE" + } } From 030d4273d601d927c898989560e1db47bca59f8d Mon Sep 17 00:00:00 2001 From: Marius Storhaug Date: Fri, 10 Jul 2026 22:50:52 +0200 Subject: [PATCH 3/7] chore: re-run pipeline against updated Process-PSModule branch (resolver preview) From 7d62d811197e233db1ab24c20a55d433e121d0a8 Mon Sep 17 00:00:00 2001 From: Marius Storhaug Date: Sat, 11 Jul 2026 10:55:47 +0200 Subject: [PATCH 4/7] ci: update Process-PSModule to v6.1.2 The Import-TestData plumbing and always-evaluate-version-labels fix are now released in Process-PSModule v6.1.2 (via PSModule/Process-PSModule#377, IPH v1.0.9 + Resolve-PSModuleVersion v1.1.4), so the temporary feat/import-testdata branch ref is replaced with the released tag. --- .github/workflows/Process-PSModule.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/Process-PSModule.yml b/.github/workflows/Process-PSModule.yml index 3685008..2d744da 100644 --- a/.github/workflows/Process-PSModule.yml +++ b/.github/workflows/Process-PSModule.yml @@ -27,7 +27,7 @@ permissions: jobs: Process-PSModule: - uses: PSModule/Process-PSModule/.github/workflows/workflow.yml@feat/import-testdata # E2E: temporary branch ref for the Import-TestData test + uses: PSModule/Process-PSModule/.github/workflows/workflow.yml@v6.1.2 secrets: APIKey: ${{ secrets.APIKey }} # E2E: push a secret (masked in logs) and a variable (not masked) into the module test jobs. From 344f3605bf77a8cb708f405551fc3dc15f3cdfbe Mon Sep 17 00:00:00 2001 From: Marius Storhaug Date: Sat, 11 Jul 2026 11:06:23 +0200 Subject: [PATCH 5/7] ci: pin Process-PSModule to commit SHA Per the GitHub Actions coding standard, uses: references are pinned to a full 40-character commit SHA with the human-readable version as a trailing comment. Replaces the v6.1.2 tag pin with its commit SHA (d4020f3). --- .github/workflows/Process-PSModule.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/Process-PSModule.yml b/.github/workflows/Process-PSModule.yml index 2d744da..78d5575 100644 --- a/.github/workflows/Process-PSModule.yml +++ b/.github/workflows/Process-PSModule.yml @@ -27,7 +27,7 @@ permissions: jobs: Process-PSModule: - uses: PSModule/Process-PSModule/.github/workflows/workflow.yml@v6.1.2 + uses: PSModule/Process-PSModule/.github/workflows/workflow.yml@d4020f3c9c3621cebae5d8bf4ffaf10f55c1784a # v6.1.2 secrets: APIKey: ${{ secrets.APIKey }} # E2E: push a secret (masked in logs) and a variable (not masked) into the module test jobs. From ed0e85149ab8027e9b2afdd2f6e1f2eb41322f1e Mon Sep 17 00:00:00 2001 From: Marius Storhaug Date: Sat, 11 Jul 2026 13:12:27 +0200 Subject: [PATCH 6/7] fix: update TestData formatting for consistency in Process-PSModule workflow --- .github/workflows/Process-PSModule.yml | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) diff --git a/.github/workflows/Process-PSModule.yml b/.github/workflows/Process-PSModule.yml index 78d5575..0aee102 100644 --- a/.github/workflows/Process-PSModule.yml +++ b/.github/workflows/Process-PSModule.yml @@ -30,8 +30,12 @@ jobs: uses: PSModule/Process-PSModule/.github/workflows/workflow.yml@d4020f3c9c3621cebae5d8bf4ffaf10f55c1784a # v6.1.2 secrets: APIKey: ${{ secrets.APIKey }} - # E2E: push a secret (masked in logs) and a variable (not masked) into the module test jobs. - # Import-TestData exposes each entry as $env:; asserted in tests/Environment.Tests.ps1. TestData: >- - { "secrets": { "TEST_SECRET": "${{ secrets.TEST_SECRET }}" }, - "variables": { "TEST_VARIABLE": ${{ toJSON(vars.TEST_VARIABLE) }} } } + { + "secrets": { + "TEST_SECRET": "${{ secrets.TEST_SECRET }}" + }, + "variables": { + "TEST_VARIABLE": "${{ vars.TEST_VARIABLE }}" + } + } From 7e88f3ec4c3a7644aa21598808632fd4c3b902eb Mon Sep 17 00:00:00 2001 From: Marius Storhaug Date: Sat, 11 Jul 2026 13:13:31 +0200 Subject: [PATCH 7/7] refactor: remove redundant comments in Environment.Tests.ps1 for clarity --- tests/Environment.Tests.ps1 | 9 --------- 1 file changed, 9 deletions(-) diff --git a/tests/Environment.Tests.ps1 b/tests/Environment.Tests.ps1 index 1544386..3b90a6b 100644 --- a/tests/Environment.Tests.ps1 +++ b/tests/Environment.Tests.ps1 @@ -14,12 +14,6 @@ param() Describe 'TestData is pushed into the module tests' { - # TEST_SECRET (from the "secrets" map, masked) and TEST_VARIABLE (from the "variables" map, not - # masked) are public non-secret fixtures that exist only to prove the calling workflow can push - # secrets and variables into the module test jobs. The calling workflow passes them through a - # single TestData object and Import-TestData (from Install-PSModuleHelpers) exposes them as - # environment variables; these tests confirm they arrive with the expected values. - It 'Exposes the secret from the "secrets" map' { $actual = [System.Environment]::GetEnvironmentVariable('TEST_SECRET') $actual | Should -Not -BeNullOrEmpty @@ -33,9 +27,6 @@ Describe 'TestData is pushed into the module tests' { } It 'Masks the secret in the log even when a test prints it in plain text' { - # Deliberately try to leak both values to the log with Write-Host. Because Import-TestData - # registered the secret via ::add-mask::, GitHub Actions redacts it to *** in the log, while - # the variable (not masked) is printed verbatim. Inspect the job log to see the difference. Write-Host "Secret in plain text: $env:TEST_SECRET" Write-Host "Variable in plain text: $env:TEST_VARIABLE" }