Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
22 changes: 15 additions & 7 deletions Coverage.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,19 +5,19 @@
<table>
<tr>
<td>Available functions</td>
<td>980</td>
<td>992</td>
</tr>
<tr>
<td>Covered functions</td>
<td>156</td>
<td>159</td>
</tr>
<tr>
<td>Missing functions</td>
<td>824</td>
<td>833</td>
</tr>
<tr>
<td>Coverage</td>
<td>15.92%</td>
<td>16.03%</td>
</tr>
</table>

Expand All @@ -30,10 +30,10 @@
| `/advisories/{ghsa_id}` | | :x: | | | |
| `/app` | | :white_check_mark: | | | |
| `/app-manifests/{code}/conversions` | | | | :x: | |
| `/app/hook/config` | | :white_check_mark: | :x: | | |
| `/app/hook/config` | | :white_check_mark: | :white_check_mark: | | |
| `/app/hook/deliveries` | | :white_check_mark: | | | |
| `/app/hook/deliveries/{delivery_id}` | | :x: | | | |
| `/app/hook/deliveries/{delivery_id}/attempts` | | | | :x: | |
| `/app/hook/deliveries/{delivery_id}` | | :white_check_mark: | | | |
| `/app/hook/deliveries/{delivery_id}/attempts` | | | | :white_check_mark: | |
| `/app/installation-requests` | | :x: | | | |
| `/app/installations` | | :white_check_mark: | | | |
| `/app/installations/{installation_id}` | :x: | :x: | | | |
Expand All @@ -52,6 +52,12 @@
| `/codes_of_conduct` | | :x: | | | |
| `/codes_of_conduct/{key}` | | :x: | | | |
| `/emojis` | | :white_check_mark: | | | |
| `/enterprises/{enterprise}/code-security/configurations` | | :x: | | :x: | |
| `/enterprises/{enterprise}/code-security/configurations/defaults` | | :x: | | | |
| `/enterprises/{enterprise}/code-security/configurations/{configuration_id}` | :x: | :x: | :x: | | |
| `/enterprises/{enterprise}/code-security/configurations/{configuration_id}/attach` | | | | :x: | |
| `/enterprises/{enterprise}/code-security/configurations/{configuration_id}/defaults` | | | | | :x: |
| `/enterprises/{enterprise}/code-security/configurations/{configuration_id}/repositories` | | :x: | | | |
| `/enterprises/{enterprise}/dependabot/alerts` | | :x: | | | |
| `/enterprises/{enterprise}/secret-scanning/alerts` | | :x: | | | |
| `/events` | | :white_check_mark: | | | |
Expand Down Expand Up @@ -348,6 +354,8 @@
| `/repos/{owner}/{repo}/check-suites/{check_suite_id}/rerequest` | | | | :x: | |
| `/repos/{owner}/{repo}/code-scanning/alerts` | | :x: | | | |
| `/repos/{owner}/{repo}/code-scanning/alerts/{alert_number}` | | :x: | :x: | | |
| `/repos/{owner}/{repo}/code-scanning/alerts/{alert_number}/autofix` | | :x: | | :x: | |
| `/repos/{owner}/{repo}/code-scanning/alerts/{alert_number}/autofix/commits` | | | | :x: | |
| `/repos/{owner}/{repo}/code-scanning/alerts/{alert_number}/instances` | | :x: | | | |
| `/repos/{owner}/{repo}/code-scanning/analyses` | | :x: | | | |
| `/repos/{owner}/{repo}/code-scanning/analyses/{analysis_id}` | :x: | :x: | | | |
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,60 @@
function Get-GitHubAppWebhookDeliveryByID {
<#
.SYNOPSIS
Get a delivery for an app webhook

.DESCRIPTION
Returns a delivery for the webhook configured for a GitHub App.

You must use a [JWT](https://docs.github.com/apps/building-github-apps/authenticating-with-github-apps/#authenticating-as-a-github-app)
to access this endpoint.


.EXAMPLE
Get-GitHubAppWebhookDeliveryByID -ID 123456

Returns the webhook configuration for the authenticated app.

.NOTES
[Get a delivery for an app webhook](https://docs.github.com/rest/apps/webhooks#get-a-delivery-for-an-app-webhook)
#>
[CmdletBinding()]
param(
# The ID of the delivery.
[Parameter(Mandatory)]
[Alias('DeliveryID', 'delivery_id')]
[string] $ID,

# The context to run the command in. Used to get the details for the API call.
# Can be either a string or a GitHubContext object.
[Parameter()]
[object] $Context = (Get-GitHubContext)
)

begin {
$stackPath = Get-PSCallStackPath
Write-Debug "[$stackPath] - Start"
$Context = Resolve-GitHubContext -Context $Context
Assert-GitHubContext -Context $Context -AuthType APP
}

process {
try {
$inputObject = @{
Context = $Context
APIEndpoint = "/app/hook/deliveries/$ID"
Method = 'GET'
}

Invoke-GitHubAPI @inputObject | ForEach-Object {
Write-Output $_.Response
}
} catch {
throw $_
}
}

end {
Write-Debug "[$stackPath] - End"
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,54 @@
function Get-GitHubAppWebhookDeliveryByList {
<#
.SYNOPSIS
List deliveries for an app webhook

.DESCRIPTION
Returns a list of webhook deliveries for the webhook configured for a GitHub App.

You must use a [JWT](https://docs.github.com/apps/building-github-apps/authenticating-with-github-apps/#authenticating-as-a-github-app)
to access this endpoint.

.EXAMPLE
Get-GitHubAppWebhookDeliveryByList

Returns the webhook configuration for the authenticated app.

.NOTES
[Get a webhook configuration for an app](https://docs.github.com/rest/apps/webhooks#get-a-webhook-configuration-for-an-app)
#>
[CmdletBinding()]
param(
# The context to run the command in. Used to get the details for the API call.
# Can be either a string or a GitHubContext object.
[Parameter()]
[object] $Context = (Get-GitHubContext)
)

begin {
$stackPath = Get-PSCallStackPath
Write-Debug "[$stackPath] - Start"
$Context = Resolve-GitHubContext -Context $Context
Assert-GitHubContext -Context $Context -AuthType APP
}

process {
try {
$inputObject = @{
Context = $Context
APIEndpoint = '/app/hook/deliveries'
Method = 'GET'
}

Invoke-GitHubAPI @inputObject | ForEach-Object {
Write-Output $_.Response
}
} catch {
throw $_
}
}

end {
Write-Debug "[$stackPath] - End"
}
}
Original file line number Diff line number Diff line change
@@ -1,24 +1,40 @@
function Get-GitHubAppWebhookDelivery {
<#
.SYNOPSIS
List deliveries for an app webhook
List deliveries for an app webhook or get a delivery for an app webhook by ID.

.DESCRIPTION
Returns a list of webhook deliveries for the webhook configured for a GitHub App.
Returns a list of webhook deliveries or a specific delivery for the webhook configured for a GitHub App.

You must use a [JWT](https://docs.github.com/apps/building-github-apps/authenticating-with-github-apps/#authenticating-as-a-github-app)
to access this endpoint.

.EXAMPLE
Get-GitHubAppWebhookDelivery

Returns the webhook configuration for the authenticated app.
Returns a list of webhook deliveries for the webhook for the authenticated app.

.EXAMPLE
Get-GitHubAppWebhookDelivery -ID 123456

Returns the webhook delivery with the ID `123456` for the authenticated app.

.NOTES
[Get a delivery for an app webhook](https://docs.github.com/rest/apps/webhooks#get-a-delivery-for-an-app-webhook)
[Get a webhook configuration for an app](https://docs.github.com/rest/apps/webhooks#get-a-webhook-configuration-for-an-app)
#>
[CmdletBinding()]
[CmdletBinding(DefaultParameterSetName = '__AllParameterSets')]
param(
# The ID of the delivery.
[Parameter(
Mandatory,
ParameterSetName = 'ByID',
ValueFromPipeline,
ValueFromPipelineByPropertyName
)]
[Alias('DeliveryID', 'delivery_id')]
[string] $ID,

# The context to run the command in. Used to get the details for the API call.
# Can be either a string or a GitHubContext object.
[Parameter()]
Expand All @@ -34,14 +50,13 @@

process {
try {
$inputObject = @{
Context = $Context
APIEndpoint = '/app/hook/deliveries'
Method = 'GET'
}

Invoke-GitHubAPI @inputObject | ForEach-Object {
Write-Output $_.Response
switch ($PSCmdlet.ParameterSetName) {
'ByID' {
Get-GitHubAppWebhookDeliveryByID -ID $ID -Context $Context
}
'__AllParameterSets' {
Get-GitHubAppWebhookDeliveryByList -Context $Context
}
}
} catch {
throw $_
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,66 @@
function Redeliver-GitHubAppWebhookDelivery {
<#
.SYNOPSIS
Redeliver a delivery for an app webhook

.DESCRIPTION
Redeliver a delivery for the webhook configured for a GitHub App.

You must use a [JWT](https://docs.github.com/apps/building-github-apps/authenticating-with-github-apps/#authenticating-as-a-github-app)
to access this endpoint.

.EXAMPLE
Redeliver-GitHubAppWebhookDelivery -ID 12345

Redelivers the delivery with the ID `12345`.

.NOTES
[Redeliver a delivery for an app webhook](https://docs.github.com/rest/apps/webhooks#redeliver-a-delivery-for-an-app-webhook)
#>
[OutputType([void])]
[CmdletBinding(SupportsShouldProcess)]
[Diagnostics.CodeAnalysis.SuppressMessageAttribute(
'PSUseApprovedVerbs', '', Scope = 'Function',
Justification = 'Redeliver is the only thing that makes sense when triggering a webhook delivery again.'
)]
param(
# The ID of the delivery.
[Parameter(Mandatory)]
[Alias('DeliveryID', 'delivery_id')]
[string] $ID,

# The context to run the command in. Used to get the details for the API call.
# Can be either a string or a GitHubContext object.
[Parameter()]
[object] $Context = (Get-GitHubContext)
)

begin {
$stackPath = Get-PSCallStackPath
Write-Debug "[$stackPath] - Start"
$Context = Resolve-GitHubContext -Context $Context
Assert-GitHubContext -Context $Context -AuthType APP
}

process {
try {
$inputObject = @{
Context = $Context
APIEndpoint = "/app/hook/deliveries/$ID/attempts"
Method = 'post'
}

if ($PSCmdlet.ShouldProcess('webhook delivery', 'Redeliver')) {
Invoke-GitHubAPI @inputObject | ForEach-Object {
Write-Output $_.Response
}
}
} catch {
throw $_
}
}

end {
Write-Debug "[$stackPath] - End"
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,84 @@
function Update-GitHubAppWebhookConfiguration {
<#
.SYNOPSIS
Update a webhook configuration for an app

.DESCRIPTION
Updates the webhook configuration for a GitHub App. For more information about configuring a webhook for your app, see
"[Creating a GitHub App](/developers/apps/creating-a-github-app)."

You must use a [JWT](https://docs.github.com/apps/building-github-apps/authenticating-with-github-apps/#authenticating-as-a-github-app)
to access this endpoint.

.EXAMPLE
Update-GitHubAppWebhookConfiguration -URL 'https://example.com' -ContentType 'json' -Secret 'mysecret' -InsecureSSL

Updates the webhook configuration for the authenticated app to deliver payloads to `https://example.com` with a `json` content type
and a secret of `mysecret` disabling SSL verification when delivering payloads.

.NOTES
[Update a webhook configuration for an app](https://docs.github.com/rest/apps/webhooks#update-a-webhook-configuration-for-an-app)
#>
[OutputType([void])]
[CmdletBinding(SupportsShouldProcess)]
param(
# The URL to which the payloads will be delivered.
[Parameter()]
[string] $URL,

# The media type used to serialize the payloads. Supported values include `json` and `form`.
[Parameter()]
[ValidateSet('json', 'form')]
[string] $ContentType,

# If provided, the `secret` will be used as the `key` to generate the HMAC hex digest value for delivery signature headers.
[Parameter()]
[string] $Secret,

# Determines whether the SSL certificate of the host for URL will be verified when delivering payloads.
# We strongly recommend not setting this as you are subject to man-in-the-middle and other attacks.
[switch] $InsecureSSL,

# The context to run the command in. Used to get the details for the API call.
# Can be either a string or a GitHubContext object.
[Parameter()]
[object] $Context = (Get-GitHubContext)
)

begin {
$stackPath = Get-PSCallStackPath
Write-Debug "[$stackPath] - Start"
$Context = Resolve-GitHubContext -Context $Context
Assert-GitHubContext -Context $Context -AuthType APP
}

process {
try {
$body = @{
url = $URL
content_type = $ContentType
secret = $Secret
insecure_ssl = $InsecureSSL ? 1 : 0
}

$inputObject = @{
Context = $Context
APIEndpoint = '/app/hook/config'
Method = 'PATCH'
Body = $body
}

if ($PSCmdlet.ShouldProcess('webhook configuration', 'Update')) {
Invoke-GitHubAPI @inputObject | ForEach-Object {
Write-Output $_.Response
}
}
} catch {
throw $_
}
}

end {
Write-Debug "[$stackPath] - End"
}
}