From 91b225913f688082bfd81fa3bf671f4d3c096f78 Mon Sep 17 00:00:00 2001 From: Marius Storhaug Date: Mon, 6 Oct 2025 02:27:20 +0200 Subject: [PATCH 1/2] =?UTF-8?q?=F0=9F=A9=B9=20[Patch]:=20Update=20GitHub?= =?UTF-8?q?=20Actions=20workflow=20permissions=20and=20add=20documentation?= =?UTF-8?q?=20linting=20step;=20enhance=20module=20test=20function=20with?= =?UTF-8?q?=20control=20notes?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .github/workflows/Action-Test.yml | 25 ++++++++++++++++++- .../module/PSModuleTest/PSModuleTest.psm1 | 6 +++++ .../public/SomethingElse/Set-PSModuleTest.ps1 | 6 +++++ 3 files changed, 36 insertions(+), 1 deletion(-) diff --git a/.github/workflows/Action-Test.yml b/.github/workflows/Action-Test.yml index e734696..23df0ab 100644 --- a/.github/workflows/Action-Test.yml +++ b/.github/workflows/Action-Test.yml @@ -15,7 +15,9 @@ concurrency: group: ${{ github.workflow }}-${{ github.ref }} cancel-in-progress: true -permissions: {} +permissions: + contents: read # to checkout the repo + statuses: write # to create commit status jobs: ActionTestDefault: @@ -24,6 +26,9 @@ jobs: steps: - name: Checkout repo uses: actions/checkout@v5 + with: + persist-credentials: false + fetch-depth: 0 - name: Upload module artifact uses: actions/upload-artifact@v4 @@ -38,3 +43,21 @@ jobs: with: Name: PSModuleTest WorkingDirectory: tests/srcTestRepo + + - name: Get changes + uses: PSModule/GitHub-Script@v1 + with: + Script: | + LogGroup "List files" { + Get-ChildItem -Recurse -File | Select-Object -ExpandProperty FullName | Sort-Object + } + LogGroup "Commit changes" { + git add tests/srcTestRepo/outputs/docs/ + git commit -m "Update documentation" + } + + - name: Lint documentation + uses: super-linter/super-linter/slim@7bba2eeb89d01dc9bfd93c497477a57e72c83240 # v8.2.0 + env: + GITHUB_TOKEN: ${{ github.token }} + VALIDATE_MARKDOWN: true diff --git a/tests/srcTestRepo/outputs/module/PSModuleTest/PSModuleTest.psm1 b/tests/srcTestRepo/outputs/module/PSModuleTest/PSModuleTest.psm1 index dfe05df..be31abb 100644 --- a/tests/srcTestRepo/outputs/module/PSModuleTest/PSModuleTest.psm1 +++ b/tests/srcTestRepo/outputs/module/PSModuleTest/PSModuleTest.psm1 @@ -314,6 +314,12 @@ function Set-PSModuleTest { Test-PSModule -Name 'World' "Hello, World!" + + .NOTES + Controls: + - :q : Quit + - :q! : Quit without saving + - :wq : Save and quit #> [Diagnostics.CodeAnalysis.SuppressMessageAttribute( 'PSUseShouldProcessForStateChangingFunctions', '', Scope = 'Function', diff --git a/tests/srcTestRepo/src/functions/public/SomethingElse/Set-PSModuleTest.ps1 b/tests/srcTestRepo/src/functions/public/SomethingElse/Set-PSModuleTest.ps1 index a87ac11..db379c1 100644 --- a/tests/srcTestRepo/src/functions/public/SomethingElse/Set-PSModuleTest.ps1 +++ b/tests/srcTestRepo/src/functions/public/SomethingElse/Set-PSModuleTest.ps1 @@ -7,6 +7,12 @@ Test-PSModule -Name 'World' "Hello, World!" + + .NOTES + Controls: + - :q : Quit + - :q! : Quit without saving + - :wq : Save and quit #> [Diagnostics.CodeAnalysis.SuppressMessageAttribute( 'PSUseShouldProcessForStateChangingFunctions', '', Scope = 'Function', From 25cc2d6769d8091a335d0d27d482a4b253643ae5 Mon Sep 17 00:00:00 2001 From: Marius Storhaug Date: Mon, 6 Oct 2025 02:34:06 +0200 Subject: [PATCH 2/2] =?UTF-8?q?=F0=9F=A9=B9=20[Patch]:=20Update=20New-Mark?= =?UTF-8?q?downHelp=20command=20to=20use=20UTF8=20encoding=20for=20output?= =?UTF-8?q?=20files?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- scripts/helpers/Build-PSModuleDocumentation.ps1 | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/scripts/helpers/Build-PSModuleDocumentation.ps1 b/scripts/helpers/Build-PSModuleDocumentation.ps1 index d979beb..5670eee 100644 --- a/scripts/helpers/Build-PSModuleDocumentation.ps1 +++ b/scripts/helpers/Build-PSModuleDocumentation.ps1 @@ -48,7 +48,7 @@ Write-Host '::group::Build docs - Generate markdown help - Raw' Install-PSModule -Path $ModuleOutputFolder Write-Host ($ModuleName | Get-Module) - $null = New-MarkdownHelp -Module $ModuleName -OutputFolder $DocsOutputFolder -Force -Verbose + $null = New-MarkdownHelp -Module $ModuleName -OutputFolder $DocsOutputFolder -Force -Encoding UTF8 Get-ChildItem -Path $DocsOutputFolder -Recurse -Force -Include '*.md' | ForEach-Object { $fileName = $_.Name Write-Host "::group:: - [$fileName]"