Skip to content

Commit 46f54a0

Browse files
πŸš€ [Add]: Implement Revoke-GitHubAppInstallationAccessToken function for revoking installation access tokens in GitHub App.
πŸš€ [Add]: Create Resolve-GitHubContext filter to resolve context into GitHubContext object for improved context handling. πŸš€ [Add]: Introduce Set-GitHubContext function to set and store GitHub context in the vault for API authentication. πŸš€ [Update]: Enhance Disconnect-GitHubAccount function to support wildcard context resolution for improved usability. πŸš€ [Add]: Add Get-GitHubToken function to retrieve GitHub tokens from environment variables as plaintext or secure string.
1 parent 128418e commit 46f54a0

File tree

5 files changed

+12
-9
lines changed

5 files changed

+12
-9
lines changed

β€Žsrc/functions/public/Auth/Disconnect-GitHubAccount.ps1β€Ž

Lines changed: 12 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -43,6 +43,7 @@
4343
# The context to run the command with.
4444
# Can be either a string or a GitHubContext object.
4545
[Parameter(ValueFromPipeline)]
46+
[SupportsWildcards()]
4647
[object[]] $Context
4748
)
4849

@@ -55,7 +56,14 @@
5556
if (-not $Context) {
5657
$Context = Get-GitHubContext
5758
}
58-
foreach ($contextItem in $Context) {
59+
if ($Context.Contains('*')) {
60+
$Context = Get-GitHubContext -Name $Context
61+
}
62+
$moduleName = $script:Module.Name
63+
$moduleVersion = $script:PSModuleInfo.ModuleVersion
64+
$Context | ForEach-Object -ThrottleLimit $ThrottleLimit -Parallel {
65+
Import-Module -Name $using:moduleName -RequiredVersion $using:moduleVersion -Force -ErrorAction Stop
66+
$contextItem = $_
5967
$contextItem = Resolve-GitHubContext -Context $contextItem
6068

6169
$contextToken = Get-GitHubAccessToken -Context $contextItem -AsPlainText
@@ -85,14 +93,9 @@
8593
}
8694

8795
if (-not $Silent) {
88-
if ($script:IsGitHubActions) {
89-
$green = $PSStyle.Foreground.Green
90-
$reset = $PSStyle.Reset
91-
Write-Host "$greenβœ“$reset Logged out of GitHub! [$contextItem]"
92-
} else {
93-
Write-Host 'βœ“ ' -ForegroundColor Green -NoNewline
94-
Write-Host "Logged out of GitHub! [$contextItem]"
95-
}
96+
$green = $PSStyle.Foreground.Green
97+
$reset = $PSStyle.Reset
98+
Write-Host "$greenβœ“$reset Logged out of GitHub! [$contextItem]"
9699
}
97100
}
98101
}

0 commit comments

Comments
Β (0)