Skip to content

Commit 205c107

Browse files
🪲 [Fix]: Rename and allow pipeline input on function to get installation token (#139)
## Description - Renamed `Get-GitHubAppInstallationAccessToken` to `New-GitHubAppInstallationAccessToken`, aligning with that this is a post method, and not just a get. - Allowing the function to also take `Get-GitHubAppInstallation` results as pipeline input. ## Type of change <!-- Use the check-boxes [x] on the options that are relevant. --> - [ ] 📖 [Docs] - [x] 🪲 [Fix] - [ ] 🩹 [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 c9bc7db commit 205c107

File tree

2 files changed

+20
-6
lines changed

2 files changed

+20
-6
lines changed

src/functions/public/Actions/Stop-GitHubWorkflowRun.ps1

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -42,5 +42,4 @@
4242
Write-Output $_.Response
4343
}
4444
}
45-
4645
}

src/functions/public/Apps/Get-GitHubAppInstallationAccessToken.ps1 renamed to src/functions/public/Apps/New-GitHubAppInstallationAccessToken.ps1

Lines changed: 20 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
function Get-GitHubAppInstallationAccessToken {
1+
filter New-GitHubAppInstallationAccessToken {
22
<#
33
.SYNOPSIS
44
Create an installation access token for an app
@@ -28,19 +28,34 @@
2828
to access this endpoint.
2929
3030
.EXAMPLE
31-
Get-GitHubAppInstallationAccessToken -InstallationID 12345678
31+
New-GitHubAppInstallationAccessToken -InstallationID 12345678
3232
33-
Gets an installation access token for the installation with the ID `12345678`.
33+
Creates an installation access token for the installation with the ID `12345678`.
34+
35+
.EXAMPLE
36+
Connect-GitHub -ClientID $ClientID -PrivateKey $PrivateKey -Verbose
37+
Get-GitHubAppInstallation | New-GitHubAppInstallationAccessToken
38+
39+
Gets the GitHub App installations and creates an installation access token for each installation.
3440
3541
.NOTES
3642
[Create an installation access token for an app](https://docs.github.com/rest/apps/apps#create-an-installation-access-token-for-an-app)
3743
#>
44+
[Diagnostics.CodeAnalysis.SuppressMessageAttribute(
45+
'PSUseShouldProcessForStateChangingFunctions', '',
46+
Justification = 'No state is changed.'
47+
)]
3848
[CmdletBinding()]
3949
param (
4050
# The unique identifier of the installation.
4151
# Example: '12345678'
42-
[Parameter(Mandatory)]
43-
[string] $InstallationID
52+
[Parameter(
53+
Mandatory,
54+
ValueFromPipeline,
55+
ValueFromPipelineByPropertyName
56+
)]
57+
[Alias('ID')]
58+
[int] $InstallationID
4459
)
4560

4661
$inputObject = @{

0 commit comments

Comments
 (0)