Skip to content

Commit d903474

Browse files
🩹 [Patch]: Replace LogGroup with Set-GitHubLogGroup for consistent logging in build scripts
1 parent 19502ec commit d903474

File tree

6 files changed

+21
-21
lines changed

6 files changed

+21
-21
lines changed

‎scripts/helpers/Build-PSModule.ps1‎

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,7 @@
3030
[string] $ModuleOutputFolderPath
3131
)
3232

33-
LogGroup "Building module [$ModuleName]" {
33+
Set-GitHubLogGroup "Building module [$ModuleName]" {
3434
$moduleSourceFolder = Get-Item -Path $ModuleSourceFolderPath
3535
$moduleOutputFolder = New-Item -Path $ModuleOutputFolderPath -Name $ModuleName -ItemType Directory -Force
3636
[pscustomobject]@{
@@ -44,7 +44,7 @@
4444
Build-PSModuleRootModule -ModuleName $ModuleName -ModuleOutputFolder $moduleOutputFolder
4545
Update-PSModuleManifestAliasesToExport -ModuleName $ModuleName -ModuleSourceFolder $moduleSourceFolder -ModuleOutputFolder $moduleOutputFolder
4646

47-
LogGroup 'Build manifest file - Final Result' {
47+
Set-GitHubLogGroup 'Build manifest file - Final Result' {
4848
$outputManifestPath = Join-Path -Path $ModuleOutputFolder -ChildPath "$ModuleName.psd1"
4949
Show-FileContent -Path $outputManifestPath
5050
}

‎scripts/helpers/Build/Build-PSModuleBase.ps1‎

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -33,15 +33,15 @@
3333
[System.IO.DirectoryInfo] $ModuleOutputFolder
3434
)
3535

36-
LogGroup 'Build base' {
36+
Set-GitHubLogGroup 'Build base' {
3737
$relModuleSourceFolder = $ModuleSourceFolder | Resolve-Path -Relative
3838
$relModuleOutputFolder = $ModuleOutputFolder | Resolve-Path -Relative
3939
Write-Host "Copying files from [$relModuleSourceFolder] to [$relModuleOutputFolder]"
4040
Copy-Item -Path "$ModuleSourceFolder\*" -Destination $ModuleOutputFolder -Recurse -Force -Exclude "$ModuleName.psm1"
4141
$null = New-Item -Path $ModuleOutputFolder -Name "$ModuleName.psm1" -ItemType File -Force
4242
}
4343

44-
LogGroup 'Build base - Result' {
44+
Set-GitHubLogGroup 'Build base - Result' {
4545
Get-ChildItem -Path $ModuleOutputFolder -Recurse -Force | Resolve-Path -Relative | Sort-Object
4646
}
4747
}

‎scripts/helpers/Build/Build-PSModuleManifest.ps1‎

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,7 @@
3333
[System.IO.DirectoryInfo] $ModuleOutputFolder
3434
)
3535

36-
LogGroup 'Build manifest file' {
36+
Set-GitHubLogGroup 'Build manifest file' {
3737
$sourceManifestFilePath = Join-Path -Path $ModuleOutputFolder -ChildPath "$ModuleName.psd1"
3838
Write-Host "[SourceManifestFilePath] - [$sourceManifestFilePath]"
3939
if (-not (Test-Path -Path $sourceManifestFilePath)) {
@@ -442,23 +442,23 @@
442442
New-ModuleManifest -Path $outputManifestPath @manifest
443443
}
444444

445-
LogGroup 'Build manifest file - Result - Before format' {
445+
Set-GitHubLogGroup 'Build manifest file - Result - Before format' {
446446
Show-FileContent -Path $outputManifestPath
447447
}
448448

449-
LogGroup 'Build manifest file - Format' {
449+
Set-GitHubLogGroup 'Build manifest file - Format' {
450450
Set-ModuleManifest -Path $outputManifestPath
451451
}
452452

453-
LogGroup 'Build manifest file - Result - After format' {
453+
Set-GitHubLogGroup 'Build manifest file - Result - After format' {
454454
Show-FileContent -Path $outputManifestPath
455455
}
456456

457-
LogGroup 'Build manifest file - Validate - Install module dependencies' {
457+
Set-GitHubLogGroup 'Build manifest file - Validate - Install module dependencies' {
458458
Resolve-PSModuleDependency -ManifestFilePath $outputManifestPath
459459
}
460460

461-
LogGroup 'Build manifest file - Validate - Test manifest file' {
461+
Set-GitHubLogGroup 'Build manifest file - Validate - Test manifest file' {
462462
Test-ModuleManifest -Path $outputManifestPath | Format-List | Out-String
463463
}
464464
}

‎scripts/helpers/Build/Build-PSModuleRootModule.ps1‎

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -51,7 +51,7 @@
5151
# Get the path separator for the current OS
5252
$pathSeparator = [System.IO.Path]::DirectorySeparatorChar
5353

54-
LogGroup 'Build root module' {
54+
Set-GitHubLogGroup 'Build root module' {
5555
$rootModuleFile = New-Item -Path $ModuleOutputFolder -Name "$ModuleName.psm1" -Force
5656

5757
#region - Analyze source files
@@ -254,26 +254,26 @@ Export-ModuleMember @exports
254254

255255
}
256256

257-
LogGroup 'Build root module - Result - Before format' {
257+
Set-GitHubLogGroup 'Build root module - Result - Before format' {
258258
Write-Host (Show-FileContent -Path $rootModuleFile)
259259
}
260260

261-
LogGroup 'Build root module - Format' {
261+
Set-GitHubLogGroup 'Build root module - Format' {
262262
$AllContent = Get-Content -Path $rootModuleFile -Raw
263263
$settings = Join-Path -Path $PSScriptRoot 'PSScriptAnalyzer.Tests.psd1'
264264
Invoke-Formatter -ScriptDefinition $AllContent -Settings $settings |
265265
Out-File -FilePath $rootModuleFile -Encoding utf8BOM -Force
266266
}
267267

268-
LogGroup 'Build root module - Result - After format' {
268+
Set-GitHubLogGroup 'Build root module - Result - After format' {
269269
Write-Host (Show-FileContent -Path $rootModuleFile)
270270
}
271271

272-
# LogGroup 'Build root module - Validate - Import' {
272+
# Set-GitHubLogGroup 'Build root module - Validate - Import' {
273273
# Install-PSModule -Path $ModuleOutputFolder
274274
# }
275275

276-
# LogGroup 'Build root module - Validate - File list' {
276+
# Set-GitHubLogGroup 'Build root module - Validate - File list' {
277277
# Get-ChildItem -Path $ModuleOutputFolder -Recurse -Force | Resolve-Path -Relative | Sort-Object
278278
# }
279279
}

‎scripts/helpers/Build/Update-PSModuleManifestAliasesToExport.ps1‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@
2929
[Parameter(Mandatory)]
3030
[System.IO.DirectoryInfo] $ModuleOutputFolder
3131
)
32-
LogGroup 'Updating aliases to export in module manifest' {
32+
Set-GitHubLogGroup 'Updating aliases to export in module manifest' {
3333
Write-Host "Module name: [$ModuleName]"
3434
Write-Host "Module output folder: [$ModuleSourceFolder]"
3535

‎scripts/main.ps1‎

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66
param()
77

88
$path = (Join-Path -Path $PSScriptRoot -ChildPath 'helpers') | Get-Item | Resolve-Path -Relative
9-
LogGroup "Loading helper scripts from [$path]" {
9+
Set-GitHubLogGroup "Loading helper scripts from [$path]" {
1010
Get-ChildItem -Path $path -Filter '*.ps1' -Recurse | Resolve-Path -Relative | ForEach-Object {
1111
Write-Host "$_"
1212
. $_
@@ -15,7 +15,7 @@ LogGroup "Loading helper scripts from [$path]" {
1515

1616
$env:GITHUB_REPOSITORY_NAME = $env:GITHUB_REPOSITORY -replace '.+/'
1717

18-
LogGroup 'Loading inputs' {
18+
Set-GitHubLogGroup 'Loading inputs' {
1919
$moduleName = if ([string]::IsNullOrEmpty($env:PSMODULE_BUILD_PSMODULE_INPUT_Name)) {
2020
$env:GITHUB_REPOSITORY_NAME
2121
} else {
@@ -30,14 +30,14 @@ LogGroup 'Loading inputs' {
3030
} | Format-List | Out-String
3131
}
3232

33-
LogGroup 'Build local scripts' {
33+
Set-GitHubLogGroup 'Build local scripts' {
3434
Write-Host 'Execution order:'
3535
$scripts = Get-ChildItem -Filter '*build.ps1' -Recurse | Sort-Object -Property Name | Resolve-Path -Relative
3636
$scripts | ForEach-Object {
3737
Write-Host " - $_"
3838
}
3939
$scripts | ForEach-Object {
40-
LogGroup "Build local scripts - [$_]" {
40+
Set-GitHubLogGroup "Build local scripts - [$_]" {
4141
. $_
4242
}
4343
}

0 commit comments

Comments
 (0)