-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathinfo.ps1
More file actions
67 lines (53 loc) · 2.19 KB
/
info.ps1
File metadata and controls
67 lines (53 loc) · 2.19 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
#Requires -Modules GitHub
[CmdletBinding()]
param()
begin {
$scriptName = $MyInvocation.MyCommand.Name
Write-Debug "[$scriptName] - Start"
}
process {
try {
$fenceTitle = $env:PSMODULE_GITHUB_SCRIPT_INPUT_Name
Write-Debug "[$scriptName] - ShowInfo: $env:PSMODULE_GITHUB_SCRIPT_INPUT_ShowInfo"
if ($env:PSMODULE_GITHUB_SCRIPT_INPUT_ShowInfo -ne 'true') {
return
}
$fenceStart = "┏━━┫ $fenceTitle - Info ┣━━━━━━━━┓"
Write-Output $fenceStart
LogGroup ' - Installed modules' {
Get-InstalledPSResource | Select-Object Name, Version, Prerelease | Sort-Object -Property Name | Format-Table -AutoSize | Out-String
}
LogGroup ' - GitHub connection - Default' {
$context = Get-GitHubContext
$context | Format-List | Out-String
Write-Verbose "Token? [$([string]::IsNullOrEmpty($env:PSMODULE_GITHUB_SCRIPT_INPUT_Token))]"
Write-Verbose "AuthType? [$($context.AuthType)] - [$($context.AuthType -ne 'APP')]"
Write-Verbose "gh auth? [$($context.AuthType -ne 'APP' -and -not [string]::IsNullOrEmpty($env:PSMODULE_GITHUB_SCRIPT_INPUT_Token))]"
if ($context.AuthType -ne 'APP' -and -not [string]::IsNullOrEmpty($env:PSMODULE_GITHUB_SCRIPT_INPUT_Token)) {
Write-Output 'GitHub CLI status:'
$before = $LASTEXITCODE
gh auth status
if ($LASTEXITCODE -ne $before) {
Write-Warning "LASTEXITCODE has changed [$LASTEXITCODE]"
$global:LASTEXITCODE = $before
}
}
}
LogGroup ' - GitHub connection - List' {
Get-GitHubContext -ListAvailable | Format-Table | Out-String
}
LogGroup ' - Configuration' {
Get-GitHubConfig | Format-List | Out-String
}
LogGroup ' - Event Information' {
Get-GitHubEventData | Format-List | Out-String
}
$fenceEnd = '┗' + ('━' * ($fenceStart.Length - 2)) + '┛'
Write-Output $fenceEnd
} catch {
throw $_
}
}
end {
Write-Debug "[$scriptName] - End"
}