Skip to content

Commit 3dbded6

Browse files
🩹 [Patch]: Always show 'Connection' log group (#24)
## Description This pull request includes changes to the `scripts/main.ps1` file to improve the logging mechanism by replacing `Write-Host` with `Write-Output` and adding a message for when no connection is provided. Improvements to logging: * Replaced `Write-Host` with `Write-Output` for better logging practices. [[1]](diffhunk://#diff-dc2e5a659836b1b73abb03421c567f5018c2755677c4a0aa764cb26117b68011L11-R12) [[2]](diffhunk://#diff-dc2e5a659836b1b73abb03421c567f5018c2755677c4a0aa764cb26117b68011L76-R98) * Added a message to indicate when no connection is provided. ## Type of change <!-- Use the check-boxes [x] on the options that are relevant. --> - [ ] 📖 [Docs] - [ ] 🪲 [Fix] - [x] 🩹 [Patch] - [ ] ⚠️ [Security fix] - [ ] 🚀 [Feature] - [ ] 🌟 [Breaking change] ## Checklist <!-- Use the check-boxes [x] on the options that are relevant. --> - [x] I have performed a self-review of my own code - [x] I have commented my code, particularly in hard-to-understand areas
1 parent 74496a5 commit 3dbded6

File tree

1 file changed

+11
-11
lines changed

1 file changed

+11
-11
lines changed

scripts/main.ps1

Lines changed: 11 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -8,8 +8,8 @@ begin {
88
process {
99
try {
1010
$env:PSMODULE_GITHUB_SCRIPT = $true
11-
Write-Host '┏━━━━━┫ GitHub-Script ┣━━━━━┓'
12-
Write-Host '::group:: - Setup GitHub PowerShell'
11+
Write-Output '┏━━━━━┫ GitHub-Script ┣━━━━━┓'
12+
Write-Output '::group:: - Setup GitHub PowerShell'
1313

1414
$Name = 'GitHub'
1515
$Version = [string]::IsNullOrEmpty($env:GITHUB_ACTION_INPUT_Version) ? $null : $env:GITHUB_ACTION_INPUT_Version
@@ -73,29 +73,29 @@ process {
7373
'Provided ClientID' = $providedClientID
7474
'Provided PrivateKey' = $providedPrivateKey
7575
} | Format-List
76-
Write-Host '::endgroup::'
76+
Write-Output '::endgroup::'
7777

7878
LogGroup ' - Installed modules' {
7979
Get-InstalledPSResource | Select-Object Name, Version, Prerelease | Sort-Object -Property Name | Format-Table -AutoSize
8080
}
8181

82-
if ($providedClientID -and $providedPrivateKey) {
83-
LogGroup ' - GitHub connection - GitHub App' {
82+
LogGroup ' - GitHub connection' {
83+
if ($providedClientID -and $providedPrivateKey) {
8484
Connect-GitHub -ClientID $env:GITHUB_ACTION_INPUT_ClientID -PrivateKey $env:GITHUB_ACTION_INPUT_PrivateKey -Silent -PassThru |
85-
Format-List
86-
}
87-
} elseif ($providedToken) {
88-
LogGroup ' - GitHub connection - Token' {
85+
Select-Object * | Format-List
86+
} elseif ($providedToken) {
8987
Connect-GitHub -Token $env:GITHUB_ACTION_INPUT_Token -Silent -PassThru |
90-
Format-List
88+
Select-Object * | Format-List
89+
} else {
90+
Write-Output 'No connection provided'
9191
}
9292
}
9393

9494
LogGroup ' - Configuration' {
9595
Get-GitHubConfig | Format-List
9696
}
9797

98-
Write-Host '┗━━━━━━━━━━━━━━━━━━━━━━━━━━━┛'
98+
Write-Output '┗━━━━━━━━━━━━━━━━━━━━━━━━━━━┛'
9999
} catch {
100100
throw $_
101101
}

0 commit comments

Comments
 (0)