diff --git a/.github/workflows/Process-PSModule.yml b/.github/workflows/Process-PSModule.yml index 95c66fa..0aee102 100644 --- a/.github/workflows/Process-PSModule.yml +++ b/.github/workflows/Process-PSModule.yml @@ -27,6 +27,15 @@ 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 }} + TestData: >- + { + "secrets": { + "TEST_SECRET": "${{ secrets.TEST_SECRET }}" + }, + "variables": { + "TEST_VARIABLE": "${{ 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..3b90a6b --- /dev/null +++ b/tests/Environment.Tests.ps1 @@ -0,0 +1,33 @@ +[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 is pushed into the module tests' { + 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' + } + + It 'Masks the secret in the log even when a test prints it in plain text' { + Write-Host "Secret in plain text: $env:TEST_SECRET" + Write-Host "Variable in plain text: $env:TEST_VARIABLE" + } +}