-
-
Notifications
You must be signed in to change notification settings - Fork 3
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
🩹 [Patch]: Change how to get logged on entity info (#154)
## Description - To get info about GitHub app installations, I have added Get-GitHubViewer that uses GraphQL for UAT,PAT,IAT logon types to get name, id and databaseid. This should result in having the correct name when running Connect-GitHubAccount. i.e. `✓ Logged in as github-actions[bot]!`. App type of login (using PEM and clientID) still uses Get-GitHubApp to get info about itself. ## 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
- Loading branch information
1 parent
68f62b5
commit 5a54835
Showing
5 changed files
with
68 additions
and
24 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,31 @@ | ||
function Get-GitHubViewer { | ||
<# | ||
.SYNOPSIS | ||
Gets the currently authenticated user. | ||
.DESCRIPTION | ||
Gets the currently authenticated user. | ||
.EXAMPLE | ||
Get-GithubViewer | ||
Gets the currently authenticated user. | ||
.NOTES | ||
[GraphQL API - Queries - Viewer](https://docs.github.com/en/graphql/reference/queries#viewer) | ||
#> | ||
[CmdletBinding()] | ||
param( | ||
[string[]] $Fields = @('login', 'id', 'databaseId') | ||
) | ||
|
||
$query = @" | ||
query { | ||
viewer { | ||
$($Fields -join "`n") | ||
} | ||
} | ||
"@ | ||
$results = Invoke-GitHubGraphQLQuery -Query $query | ||
return $results.data.viewer | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters