File tree Expand file tree Collapse file tree 4 files changed +48
-43
lines changed
Expand file tree Collapse file tree 4 files changed +48
-43
lines changed Original file line number Diff line number Diff line change 5858 Name : PSModuleTest
5959 WorkingDirectory : tests/srcTestRepo
6060
61- - name : Check step summary is empty
62- shell : pwsh
63- run : |
64- $summary = Get-Content $env:GITHUB_STEP_SUMMARY -Raw
65- Write-Host "Step summary:"
66- Write-Host "[$summary]"
67- if (-not [string]::IsNullOrEmpty($summary)) {
68- throw "Step summary is not empty: $summary"
69- }
70- Write-Host "Step summary is empty as expected."
71-
7261 - name : Lint documentation
7362 uses :
super-linter/super-linter/[email protected] 7463 env :
9685 Name : PSModuleTest
9786 WorkingDirectory : tests/srcTestRepo
9887 ShowSummaryOnSuccess : true
99-
100- - name : Check step summary is not empty
101- shell : pwsh
102- run : |
103- $summary = Get-Content $env:GITHUB_STEP_SUMMARY -Raw
104- Write-Host "Step summary:"
105- Write-Host "[$summary]"
106- if ([string]::IsNullOrEmpty($summary)) {
107- throw "Step summary is empty, but expected not to be."
108- }
109- Write-Host "Step summary is not empty as expected."
Original file line number Diff line number Diff line change @@ -9,14 +9,14 @@ inputs:
99 Name :
1010 description : Name of the module to process.
1111 required : false
12- WorkingDirectory :
13- description : The working directory where the script will run from.
14- required : false
15- default : ' .'
1612 ShowSummaryOnSuccess :
1713 description : Show GitHub Step Summary even when all commands succeed.
1814 required : false
1915 default : ' false'
16+ WorkingDirectory :
17+ description : The working directory where the script will run from.
18+ required : false
19+ default : ' .'
2020
2121runs :
2222 using : composite
2727 - name : Document-PSModule
2828 shell : pwsh
2929 env :
30- GITHUB_ACTION_INPUT_Name : ${{ inputs.Name }}
31- GITHUB_ACTION_INPUT_ShowSummaryOnSuccess : ${{ inputs.ShowSummaryOnSuccess }}
30+ DOCUMENT_PSMODULE_INPUT_Name : ${{ inputs.Name }}
31+ DOCUMENT_PSMODULE_INPUT_ShowSummaryOnSuccess : ${{ inputs.ShowSummaryOnSuccess }}
3232 working-directory : ${{ inputs.WorkingDirectory }}
3333 run : |
3434 # Build-PSModuleDocumentation
Original file line number Diff line number Diff line change 11function Build-PSModuleDocumentation {
22 <#
3- . SYNOPSIS
4- Builds a module.
3+ . SYNOPSIS
4+ Builds a module.
55
6- . DESCRIPTION
7- Builds a module.
6+ . DESCRIPTION
7+ Builds a module.
88 #>
99 [CmdletBinding ()]
1010 [Diagnostics.CodeAnalysis.SuppressMessageAttribute (
9393 $failedCommands = $commandResults | Where-Object { $_.Status -eq ' Failed' }
9494 $successfulCommands = $commandResults | Where-Object { $_.Status -eq ' Success' }
9595 $hasFailures = $failedCommands.Count -gt 0
96- $shouldShowSummary = $hasFailures -or $ ShowSummaryOnSuccess
96+ $shouldShowSummary = $ShowSummaryOnSuccess
9797
98- # Generate summary if there are failures OR if ShowSummaryOnSuccess is enabled
98+ # Generate summary if ShowSummaryOnSuccess is enabled
9999 if ($shouldShowSummary ) {
100100 $statusIcon = $hasFailures ? ' ❌' : ' ✅'
101101 $statusText = $hasFailures ? ' Failed' : ' Succeeded'
111111|---------|---------|
112112| $successCount | $failureCount |
113113
114- ## Command status
114+ "@
115+
116+ if ($failedCommands ) {
117+ $summaryContent += @"
118+
119+ <details><summary>Failed</summary>
120+
121+ <p>
122+
123+ $ ( ($failedCommands | ForEach-Object { " - `` $ ( $_.CommandName ) `` `n " }) -join ' ' )
124+
125+ </p>
126+
127+ </details>
128+
129+ "@
130+ }
131+
132+ if ($successfulCommands ) {
133+ $summaryContent += @"
134+
135+ <details><summary>Succeeded</summary>
115136
116- | Command | Status |
117- |---------|--------|
118- $ ( ($commandResults | ForEach-Object { " | `` $ ( $_.CommandName ) `` | $ ( $_.Status ) |`n " }) -join ' ' )
137+ <p>
138+
139+ $ ( ($successfulCommands | ForEach-Object { " - `` $ ( $_.CommandName ) `` `n " }) -join ' ' )
140+
141+ </p>
142+
143+ </details>
119144
120145"@
146+ }
121147
122148
123149 $summaryContent | Out-File - FilePath $env: GITHUB_STEP_SUMMARY - Encoding utf8 - Append
Original file line number Diff line number Diff line change 33 Justification = ' Want to just write to the console, not the pipeline.'
44)]
55[CmdletBinding ()]
6- param ()
6+ param (
7+ [string ]$Name = $env: DOCUMENT_PSMODULE_INPUT_Name ,
8+ [bool ]$ShowSummaryOnSuccess = $env: DOCUMENT_PSMODULE_INPUT_ShowSummaryOnSuccess -eq ' true'
9+ )
710
811$PSStyle.OutputRendering = ' Ansi'
912
@@ -37,18 +40,16 @@ Get-ChildItem -Path $path -Filter '*.ps1' -Recurse | Resolve-Path -Relative | Fo
3740
3841Write-Host ' ::group::Loading inputs'
3942$env: GITHUB_REPOSITORY_NAME = $env: GITHUB_REPOSITORY -replace ' .+/'
40- $moduleName = [string ]::IsNullOrEmpty($env: GITHUB_ACTION_INPUT_Name ) ? $env: GITHUB_REPOSITORY_NAME : $env: GITHUB_ACTION_INPUT_Name
41- $showSummaryOnSuccess = $env: GITHUB_ACTION_INPUT_ShowSummaryOnSuccess -eq ' true'
4243$moduleSourceFolderPath = Resolve-Path - Path ' src' | Select-Object - ExpandProperty Path
4344$modulesOutputFolderPath = Join-Path - Path . - ChildPath ' outputs/module'
4445$docsOutputFolderPath = Join-Path - Path . - ChildPath ' outputs/docs'
4546
4647$params = @ {
47- ModuleName = $moduleName
48+ ModuleName = [ string ]::IsNullOrEmpty( $Name ) ? $ env: GITHUB_REPOSITORY_NAME : $Name
4849 ModuleSourceFolderPath = $moduleSourceFolderPath
4950 ModulesOutputFolderPath = $modulesOutputFolderPath
5051 DocsOutputFolderPath = $docsOutputFolderPath
51- ShowSummaryOnSuccess = $showSummaryOnSuccess
52+ ShowSummaryOnSuccess = $ShowSummaryOnSuccess
5253}
5354
5455[pscustomobject ]$params | Format-List | Out-String
You can’t perform that action at this time.
0 commit comments