diff --git a/.github/workflows/Process-PSModule.yml b/.github/workflows/Process-PSModule.yml index 95c66fa..20afc36 100644 --- a/.github/workflows/Process-PSModule.yml +++ b/.github/workflows/Process-PSModule.yml @@ -27,6 +27,14 @@ permissions: jobs: Process-PSModule: - uses: PSModule/Process-PSModule/.github/workflows/workflow.yml@60bdf8a5a4c92c53fcf2a8d23f7d5f5c93e6864e # v5.4.3 + uses: PSModule/Process-PSModule/.github/workflows/workflow.yml@d4020f3c9c3621cebae5d8bf4ffaf10f55c1784a # v6.1.2 secrets: APIKey: ${{ secrets.APIKey }} + # EXPERIMENT conclusion: SECRETS cannot be bulk-dumped. toJSON(secrets) always carries + # github_token, which Import-TestData rejects (reserved GITHUB_ prefix); and pre-filtering it + # in a prep job is blocked by GitHub's "skip output may contain secret" guard on job outputs. + # So secrets must be named explicitly. VARIABLES, however, bulk-pass fine via toJSON(vars): + # no github_token, not secret, and passed inline (not through a job output). + TestData: >- + { "secrets": { "TEST_SECRET": "${{ secrets.TEST_SECRET }}" }, + "variables": ${{ toJSON(vars) }} } 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..4fae86c --- /dev/null +++ b/tests/Environment.Tests.ps1 @@ -0,0 +1,40 @@ +[Diagnostics.CodeAnalysis.SuppressMessageAttribute( + 'PSReviewUnusedParameter', '', + Justification = 'Required for Pester tests' +)] +[Diagnostics.CodeAnalysis.SuppressMessageAttribute( + '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() + +Describe 'TestData exposes all secrets and variables' { + # EXPERIMENT: the calling workflow now passes every secret and every variable through the single + # TestData object via toJSON(secrets)/toJSON(vars). Import-TestData (from Install-PSModuleHelpers) + # exposes each entry as an environment variable. These tests iterate every environment variable + # visible to the job and print it, so the job log shows exactly what reached the module tests. + # GitHub Actions redacts any registered secret value to *** in the log; plain variables print + # verbatim. Inspect the job log to see which names arrived and how they are rendered. + + It 'Iterates every environment variable and prints what the job can see' { + $all = Get-ChildItem env: | Sort-Object Name + Write-Host "===== BEGIN environment dump ($($all.Count) variables) =====" + foreach ($entry in $all) { + Write-Host ("{0} = {1}" -f $entry.Name, $entry.Value) + } + Write-Host '===== END environment dump =====' + $all.Count | Should -BeGreaterThan 0 + } + + It 'Reports the fixture secret and variable arrived' { + # These two fixtures are part of the full dump (a repo secret and a repo variable). If the + # full enumeration worked, both are present; the secret prints as *** because it is masked. + Write-Host "TEST_SECRET = $env:TEST_SECRET" + Write-Host "TEST_VARIABLE = $env:TEST_VARIABLE" + } +}