From 139d567362ac5142943a62e3cd7de942a3384b99 Mon Sep 17 00:00:00 2001 From: Marius Storhaug Date: Sat, 7 Oct 2023 19:37:19 +0200 Subject: [PATCH] Added releases --- .../Releases/Get-GitHubReleaseAll.ps1 | 46 ++++++++ .../Releases/Get-GitHubReleaseByID.ps1 | 44 ++++++++ .../Releases/Get-GitHubReleaseByTagName.ps1 | 42 +++++++ .../Releases/Get-GitHubReleaseLatest.ps1 | 39 +++++++ .../Releases/Releases/Get-GitHubRelease.ps1 | 80 +++++++++++++ .../Releases/Releases/New-GitHubRelease.ps1 | 97 ++++++++++++++++ .../Releases/New-GitHubReleaseNotes.ps1 | 106 ++++++++++++++++++ .../Releases/Remove-GitHubRelease.ps1 | 44 ++++++++ .../Releases/Releases/Set-GitHubRelease.ps1 | 94 ++++++++++++++++ tools/utilities/GitHubAPI.ps1 | 4 +- tools/utilities/Local-Testing.ps1 | 2 + 11 files changed, 596 insertions(+), 2 deletions(-) create mode 100644 src/GitHub/private/Releases/Releases/Get-GitHubReleaseAll.ps1 create mode 100644 src/GitHub/private/Releases/Releases/Get-GitHubReleaseByID.ps1 create mode 100644 src/GitHub/private/Releases/Releases/Get-GitHubReleaseByTagName.ps1 create mode 100644 src/GitHub/private/Releases/Releases/Get-GitHubReleaseLatest.ps1 create mode 100644 src/GitHub/public/Releases/Releases/Get-GitHubRelease.ps1 create mode 100644 src/GitHub/public/Releases/Releases/New-GitHubRelease.ps1 create mode 100644 src/GitHub/public/Releases/Releases/New-GitHubReleaseNotes.ps1 create mode 100644 src/GitHub/public/Releases/Releases/Remove-GitHubRelease.ps1 create mode 100644 src/GitHub/public/Releases/Releases/Set-GitHubRelease.ps1 diff --git a/src/GitHub/private/Releases/Releases/Get-GitHubReleaseAll.ps1 b/src/GitHub/private/Releases/Releases/Get-GitHubReleaseAll.ps1 new file mode 100644 index 000000000..a29ed01ef --- /dev/null +++ b/src/GitHub/private/Releases/Releases/Get-GitHubReleaseAll.ps1 @@ -0,0 +1,46 @@ +filter Get-GitHubReleaseAll { + <# + .SYNOPSIS + List releases + + .DESCRIPTION + This returns a list of releases, which does not include regular Git tags that have not been associated with a release. + To get a list of Git tags, use the [Repository Tags API](https://docs.github.com/rest/repos/repos#list-repository-tags). + Information about published releases are available to everyone. Only users with push access will receive listings for draft releases. + + .EXAMPLE + Get-GitHubReleaseAll -Owner 'octocat' -Repo 'hello-world' + + Gets all the releases for the repository 'hello-world' owned by 'octocat'. + + .NOTES + https://docs.github.com/rest/releases/releases#list-releases + + #> + [CmdletBinding()] + param ( + # The account owner of the repository. The name is not case sensitive. + [Parameter()] + [string] $Owner = (Get-GitHubConfig -Name Owner), + + # The name of the repository without the .git extension. The name is not case sensitive. + [Parameter()] + [string] $Repo = (Get-GitHubConfig -Name Repo), + + # The number of results per page (max 100). + [Parameter(ParameterSetName = 'AllUsers')] + [int] $PerPage = 30 + ) + + $body = $PSBoundParameters | ConvertFrom-HashTable | ConvertTo-HashTable -NameCasingStyle snake_case + Remove-HashtableEntries -Hashtable $body -RemoveNames 'Owner', 'Repo' + + $inputObject = @{ + APIEndpoint = "/repos/$Owner/$Repo/releases" + Method = 'GET' + Body = $body + } + + (Invoke-GitHubAPI @inputObject).Response + +} diff --git a/src/GitHub/private/Releases/Releases/Get-GitHubReleaseByID.ps1 b/src/GitHub/private/Releases/Releases/Get-GitHubReleaseByID.ps1 new file mode 100644 index 000000000..b5d57a318 --- /dev/null +++ b/src/GitHub/private/Releases/Releases/Get-GitHubReleaseByID.ps1 @@ -0,0 +1,44 @@ +filter Get-GitHubReleaseByID { + <# + .SYNOPSIS + Get a release + + .DESCRIPTION + **Note:** This returns an `upload_url` key corresponding to the endpoint for uploading release assets. + This key is a [hypermedia resource](https://docs.github.com/rest/overview/resources-in-the-rest-api#hypermedia). + + .EXAMPLE + Get-GitHubReleaseById -Owner 'octocat' -Repo 'hello-world' -ID '1234567' + + Gets the release with the id '1234567' for the repository 'hello-world' owned by 'octocat'. + + .NOTES + https://docs.github.com/rest/releases/releases#get-a-release + + #> + [CmdletBinding()] + param ( + # The account owner of the repository. The name is not case sensitive. + [Parameter()] + [string] $Owner = (Get-GitHubConfig -Name Owner), + + # The name of the repository without the .git extension. The name is not case sensitive. + [Parameter()] + [string] $Repo = (Get-GitHubConfig -Name Repo), + + # The unique identifier of the release. + [Parameter( + Mandatory + )] + [Alias('release_id')] + [string] $ID + ) + + $inputObject = @{ + APIEndpoint = "/repos/$Owner/$Repo/releases/$ID" + Method = 'GET' + } + + (Invoke-GitHubAPI @inputObject).Response + +} diff --git a/src/GitHub/private/Releases/Releases/Get-GitHubReleaseByTagName.ps1 b/src/GitHub/private/Releases/Releases/Get-GitHubReleaseByTagName.ps1 new file mode 100644 index 000000000..0b4e3b462 --- /dev/null +++ b/src/GitHub/private/Releases/Releases/Get-GitHubReleaseByTagName.ps1 @@ -0,0 +1,42 @@ +filter Get-GitHubReleaseByTagName { + <# + .SYNOPSIS + Get a release by tag name + + .DESCRIPTION + Get a published release with the specified tag. + + .EXAMPLE + Get-GitHubReleaseByTagName -Owner 'octocat' -Repo 'hello-world' -Tag 'v1.0.0' + + Gets the release with the tag 'v1.0.0' for the repository 'hello-world' owned by 'octocat'. + + .NOTES + https://docs.github.com/rest/releases/releases#get-a-release-by-tag-name + + #> + [CmdletBinding()] + param ( + # The account owner of the repository. The name is not case sensitive. + [Parameter()] + [string] $Owner = (Get-GitHubConfig -Name Owner), + + # The name of the repository without the .git extension. The name is not case sensitive. + [Parameter()] + [string] $Repo = (Get-GitHubConfig -Name Repo), + + # The name of the tag to get a release from. + [Parameter( + Mandatory + )] + [string] $Tag + ) + + $inputObject = @{ + APIEndpoint = "/repos/$Owner/$Repo/releases/tags/$Tag" + Method = 'GET' + } + + (Invoke-GitHubAPI @inputObject).Response + +} diff --git a/src/GitHub/private/Releases/Releases/Get-GitHubReleaseLatest.ps1 b/src/GitHub/private/Releases/Releases/Get-GitHubReleaseLatest.ps1 new file mode 100644 index 000000000..2391d72e2 --- /dev/null +++ b/src/GitHub/private/Releases/Releases/Get-GitHubReleaseLatest.ps1 @@ -0,0 +1,39 @@ +filter Get-GitHubReleaseLatest { + <# + .SYNOPSIS + Get the latest release + + .DESCRIPTION + View the latest published full release for the repository. + The latest release is the most recent non-prerelease, non-draft release, sorted by the `created_at` attribute. + The `created_at` attribute is the date of the commit used for the release, and not the date when the release was drafted or published. + + .EXAMPLE + Get-GitHubReleaseLatest -Owner 'octocat' -Repo 'hello-world' + + Gets the latest releases for the repository 'hello-world' owned by 'octocat'. + + .NOTES + https://docs.github.com/rest/releases/releases#get-the-latest-release + + #> + [CmdletBinding()] + param ( + # The account owner of the repository. The name is not case sensitive. + [Parameter()] + [string] $Owner = (Get-GitHubConfig -Name Owner), + + # The name of the repository without the .git extension. The name is not case sensitive. + [Parameter()] + [string] $Repo = (Get-GitHubConfig -Name Repo) + + ) + + $inputObject = @{ + APIEndpoint = "/repos/$Owner/$Repo/releases/latest" + Method = 'GET' + } + + (Invoke-GitHubAPI @inputObject).Response + +} diff --git a/src/GitHub/public/Releases/Releases/Get-GitHubRelease.ps1 b/src/GitHub/public/Releases/Releases/Get-GitHubRelease.ps1 new file mode 100644 index 000000000..c658ebff2 --- /dev/null +++ b/src/GitHub/public/Releases/Releases/Get-GitHubRelease.ps1 @@ -0,0 +1,80 @@ +filter Get-GitHubRelease { + <# + .SYNOPSIS + List releases + + .DESCRIPTION + This returns a list of releases, which does not include regular Git tags that have not been associated with a release. + To get a list of Git tags, use the [Repository Tags API](https://docs.github.com/rest/repos/repos#list-repository-tags). + Information about published releases are available to everyone. Only users with push access will receive listings for draft releases. + + .EXAMPLE + Get-GitHubRelease -Owner 'octocat' -Repo 'hello-world' + + Gets the releases for the repository 'hello-world' owned by 'octocat'. + + .EXAMPLE + Get-GitHubRelease -Owner 'octocat' -Repo 'hello-world' -Latest + + Gets the latest releases for the repository 'hello-world' owned by 'octocat'. + + .EXAMPLE + Get-GitHubRelease -Owner 'octocat' -Repo 'hello-world' -Tag 'v1.0.0' + + Gets the release with the tag 'v1.0.0' for the repository 'hello-world' owned by 'octocat'. + + .EXAMPLE + Get-GitHubRelease -Owner 'octocat' -Repo 'hello-world' -ID '1234567' + + Gets the release with the id '1234567' for the repository 'hello-world' owned by 'octocat'. + + .NOTES + https://docs.github.com/rest/releases/releases#list-releases + https://docs.github.com/rest/releases/releases#get-the-latest-release + + #> + [CmdletBinding(DefaultParameterSetName = 'All')] + param ( + # The account owner of the repository. The name is not case sensitive. + [Parameter()] + [string] $Owner = (Get-GitHubConfig -Name Owner), + + # The name of the repository without the .git extension. The name is not case sensitive. + [Parameter()] + [string] $Repo = (Get-GitHubConfig -Name Repo), + + # The number of results per page (max 100). + [Parameter(ParameterSetName = 'All')] + [int] $PerPage = 30, + + # Get the latest release only + [Parameter( + Mandatory, + ParameterSetName = 'Latest' + )] + [switch] $Latest, + + # The name of the tag to get a release from. + [Parameter( + Mandatory, + ParameterSetName = 'Tag' + )] + [switch] $Tag, + + # The unique identifier of the release. + [Parameter( + Mandatory, + ParameterSetName = 'Id' + )] + [Alias('release_id')] + [string] $ID + ) + + switch ($PSCmdlet.ParameterSetName) { + 'All' { Get-GitHubReleaseAll -Owner $Owner -Repo $Repo -PerPage $PerPage } + 'Latest' { Get-GitHubReleaseLatest -Owner $Owner -Repo $Repo } + 'Tag' { Get-GitHubReleaseByTagName -Owner $Owner -Repo $Repo -Tag $Tag } + 'Id' { Get-GitHubReleaseByID -Owner $Owner -Repo $Repo -ID $ID } + } + +} diff --git a/src/GitHub/public/Releases/Releases/New-GitHubRelease.ps1 b/src/GitHub/public/Releases/Releases/New-GitHubRelease.ps1 new file mode 100644 index 000000000..39e750ff4 --- /dev/null +++ b/src/GitHub/public/Releases/Releases/New-GitHubRelease.ps1 @@ -0,0 +1,97 @@ +filter New-GitHubRelease { + <# + .SYNOPSIS + Create a release + + .DESCRIPTION + Users with push access to the repository can create a release. + This endpoint triggers [notifications](https://docs.github.com/github/managing-subscriptions-and-notifications-on-github/about-notifications). + Creating content too quickly using this endpoint may result in secondary rate limiting. + See "[Secondary rate limits](https://docs.github.com/rest/overview/resources-in-the-rest-api#secondary-rate-limits)" + and "[Dealing with secondary rate limits](https://docs.github.com/rest/guides/best-practices-for-integrators#dealing-with-secondary-rate-limits)" for details. + + .EXAMPLE + New-GitHubRelease -Owner 'octocat' -Repo 'hello-world' -TagName 'v1.0.0' -TargetCommitish 'main' -Body 'Release notes' + + Creates a release for the repository 'octocat/hello-world' with the tag 'v1.0.0' and the target commitish 'main'. + + .NOTES + https://docs.github.com/rest/releases/releases#create-a-release + + #> + [OutputType([pscustomobject])] + [CmdletBinding()] + param ( + # The account owner of the repository. The name is not case sensitive. + [Parameter()] + [string] $Owner = (Get-GitHubConfig -Name Owner), + + # The name of the repository without the .git extension. The name is not case sensitive. + [Parameter()] + [string] $Repo = (Get-GitHubConfig -Name Repo), + + # The name of the tag. + [Parameter(Mandatory)] + [Alias('tag_name')] + [string] $TagName, + + # Specifies the commitish value that determines where the Git tag is created from. + # Can be any branch or commit SHA. Unused if the Git tag already exists. + # API Default: the repository's default branch. + [Parameter()] + [Alias('target_commitish')] + [string] $TargetCommitish, + + # The name of the release. + [Parameter()] + [string] $Name, + + # Text describing the contents of the tag. + [Parameter()] + [string] $Body, + + # Whether the release is a draft. + [Parameter()] + [switch] $Draft, + + # Whether to identify the release as a prerelease. + [Parameter()] + [switch] $Prerelease, + + # If specified, a discussion of the specified category is created and linked to the release. + # The value must be a category that already exists in the repository. + # For more information, see [Managing categories for discussions in your repository](https://docs.github.com/discussions/managing-discussions-for-your-community/managing-categories-for-discussions-in-your-repository). + [Parameter()] + [Alias('discussion_category_name')] + [string] $DiscussionCategoryName, + + # Whether to automatically generate the name and body for this release. If name is specified, the specified name will be used; otherwise,a name will be automatically generated. If body is specified, the body will be pre-pended to the automatically generated notes. + [Parameter()] + [Alias('generate_release_notes')] + [switch] $GenerateReleaseNotes, + + # Specifies whether this release should be set as the latest release for the repository. Drafts and prereleases cannot be set as latest. Defaults to true for newly published releases. legacy specifies that the latest release should be determined based on the release creation date and higher semantic version. + [Parameter()] + [Alias('make_latest')] + [ValidateSet('true', 'false', 'legacy')] + [string] $MakeLatest = 'true' + ) + + $requestBody = $PSBoundParameters | ConvertFrom-HashTable | ConvertTo-HashTable -NameCasingStyle snake_case + Remove-HashtableEntries -Hashtable $requestBody -RemoveNames 'Owner', 'Repo', 'GenerateReleaseNotes', 'Draft', 'Prerelease' + $requestBody = Join-Object -AsHashtable -Main $requestBody -Overrides @{ + generate_release_notes = $GenerateReleaseNotes.IsPresent + draft = $Draft.IsPresent + prerelease = $Prerelease.IsPresent + } + Remove-HashtableEntries -Hashtable $requestBody -NullOrEmptyValues + + $inputObject = @{ + APIEndpoint = "/repos/$Owner/$Repo/releases" + Method = 'POST' + Body = $requestBody + } + + (Invoke-GitHubAPI @inputObject).Response + +} diff --git a/src/GitHub/public/Releases/Releases/New-GitHubReleaseNotes.ps1 b/src/GitHub/public/Releases/Releases/New-GitHubReleaseNotes.ps1 new file mode 100644 index 000000000..841d53e1a --- /dev/null +++ b/src/GitHub/public/Releases/Releases/New-GitHubReleaseNotes.ps1 @@ -0,0 +1,106 @@ +filter New-GitHubReleaseNotes { + <# + .SYNOPSIS + List releases + + .DESCRIPTION + This returns a list of releases, which does not include regular Git tags that have not been associated with a release. + To get a list of Git tags, use the [Repository Tags API](https://docs.github.com/rest/repos/repos#list-repository-tags). + Information about published releases are available to everyone. Only users with push access will receive listings for draft releases. + + .EXAMPLE + $params = @{ + Owner = 'octocat' + Repo = 'hello-world' + TagName = 'v1.0.0' + } + New-GitHubReleaseNotes @params + + Creates a new release notes draft for the repository 'hello-world' owned by 'octocat' with the tag name 'v1.0.0'. + In this example the tag 'v1.0.0' has to exist in the repository. + The configuration file '.github/release.yml' or '.github/release.yaml' will be used. + + .EXAMPLE + $params = @{ + Owner = 'octocat' + Repo = 'hello-world' + TagName = 'v1.0.0' + TargetCommitish = 'main' + } + New-GitHubReleaseNotes @params + + Creates a new release notes draft for the repository 'hello-world' owned by 'octocat' with the tag name 'v1.0.0'. + In this example the tag 'v1.0.0' has to exist in the repository. + + + .EXAMPLE + $params = @{ + Owner = 'octocat' + Repo = 'hello-world' + TagName = 'v1.0.0' + TargetCommitish = 'main' + PreviousTagName = 'v0.9.2' + ConfigurationFilePath = '.github/custom_release_config.yml' + } + New-GitHubReleaseNotes @params + + Creates a new release notes draft for the repository 'hello-world' owned by 'octocat' with the tag name 'v1.0.0'. + The release notes will be based on the changes between the tags 'v0.9.2' and 'v1.0.0' and generated based on the + configuration file located in the repository at '.github/custom_release_config.yml'. + + .NOTES + https://docs.github.com/rest/releases/releases#list-releases + + #> + [OutputType([pscustomobject])] + [Alias('Generate-GitHubReleaseNotes')] + [CmdletBinding()] + param ( + # The account owner of the repository. The name is not case sensitive. + [Parameter()] + [string] $Owner = (Get-GitHubConfig -Name Owner), + + # The name of the repository without the .git extension. The name is not case sensitive. + [Parameter()] + [string] $Repo = (Get-GitHubConfig -Name Repo), + + # The tag name for the release. This can be an existing tag or a new one. + [Parameter(Mandatory)] + [Alias('tag_name')] + [string] $TagName, + + # Specifies the commitish value that will be the target for the release's tag. + # Required if the supplied tag_name does not reference an existing tag. + # Ignored if the tag_name already exists. + [Parameter()] + [Alias('target_commitish')] + [string] $TargetCommitish, + + # The name of the previous tag to use as the starting point for the release notes. + # Use to manually specify the range for the set of changes considered as part this release. + [Parameter()] + [Alias('previous_tag_name')] + [string] $PreviousTagName, + + + # Specifies a path to a file in the repository containing configuration settings used for generating the release notes. + # If unspecified, the configuration file located in the repository at '.github/release.yml' or '.github/release.yaml' will be used. + # If that is not present, the default configuration will be used. + [Parameter()] + [Alias('configuration_file_path')] + [string] $ConfigurationFilePath + + ) + + $body = $PSBoundParameters | ConvertFrom-HashTable | ConvertTo-HashTable -NameCasingStyle snake_case + Remove-HashtableEntries -Hashtable $body -RemoveNames 'Owner', 'Repo' + + $inputObject = @{ + APIEndpoint = "/repos/$Owner/$Repo/releases/generate-notes" + Method = 'POST' + Body = $body + } + + (Invoke-GitHubAPI @inputObject).Response + +} diff --git a/src/GitHub/public/Releases/Releases/Remove-GitHubRelease.ps1 b/src/GitHub/public/Releases/Releases/Remove-GitHubRelease.ps1 new file mode 100644 index 000000000..836fd519b --- /dev/null +++ b/src/GitHub/public/Releases/Releases/Remove-GitHubRelease.ps1 @@ -0,0 +1,44 @@ +filter Remove-GitHubRelease { + <# + .SYNOPSIS + Delete a release + + .DESCRIPTION + Users with push access to the repository can delete a release. + + .EXAMPLE + Remove-GitHubRelease -Owner 'octocat' -Repo 'hello-world' -ID '1234567' + + Deletes the release with the ID '1234567' for the repository 'octocat/hello-world'. + + .NOTES + https://docs.github.com/rest/releases/releases#delete-a-release + + #> + [OutputType([pscustomobject])] + [CmdletBinding()] + param ( + # The account owner of the repository. The name is not case sensitive. + [Parameter()] + [string] $Owner = (Get-GitHubConfig -Name Owner), + + # The name of the repository without the .git extension. The name is not case sensitive. + [Parameter()] + [string] $Repo = (Get-GitHubConfig -Name Repo), + + # The unique identifier of the release. + [Parameter( + Mandatory + )] + [Alias('release_id')] + [string] $ID + ) + + $inputObject = @{ + APIEndpoint = "/repos/$Owner/$Repo/releases/$ID" + Method = 'DELETE' + } + + (Invoke-GitHubAPI @inputObject).Response + +} diff --git a/src/GitHub/public/Releases/Releases/Set-GitHubRelease.ps1 b/src/GitHub/public/Releases/Releases/Set-GitHubRelease.ps1 new file mode 100644 index 000000000..f11e3ebda --- /dev/null +++ b/src/GitHub/public/Releases/Releases/Set-GitHubRelease.ps1 @@ -0,0 +1,94 @@ +filter Set-GitHubRelease { + <# + .SYNOPSIS + Update a release + + .DESCRIPTION + Users with push access to the repository can edit a release. + + .EXAMPLE + Set-GitHubRelease -Owner 'octocat' -Repo 'hello-world' -ID '1234567' -Body 'Release notes' + + Updates the release with the ID '1234567' for the repository 'octocat/hello-world' with the body 'Release notes'. + + .NOTES + https://docs.github.com/rest/releases/releases#update-a-release + + #> + [OutputType([pscustomobject])] + [CmdletBinding()] + param ( + # The account owner of the repository. The name is not case sensitive. + [Parameter()] + [string] $Owner = (Get-GitHubConfig -Name Owner), + + # The name of the repository without the .git extension. The name is not case sensitive. + [Parameter()] + [string] $Repo = (Get-GitHubConfig -Name Repo), + + # The unique identifier of the release. + [Parameter( + Mandatory + )] + [Alias('release_id')] + [string] $ID, + + # The name of the tag. + [Parameter(Mandatory)] + [Alias('tag_name')] + [string] $TagName, + + # Specifies the commitish value that determines where the Git tag is created from. + # Can be any branch or commit SHA. Unused if the Git tag already exists. + # API Default: the repository's default branch. + [Parameter()] + [Alias('target_commitish')] + [string] $TargetCommitish, + + # The name of the release. + [Parameter()] + [string] $Name, + + # Text describing the contents of the tag. + [Parameter()] + [string] $Body, + + # Whether the release is a draft. + [Parameter()] + [switch] $Draft, + + # Whether to identify the release as a prerelease. + [Parameter()] + [switch] $Prerelease, + + # If specified, a discussion of the specified category is created and linked to the release. + # The value must be a category that already exists in the repository. + # For more information, see [Managing categories for discussions in your repository](https://docs.github.com/discussions/managing-discussions-for-your-community/managing-categories-for-discussions-in-your-repository). + [Parameter()] + [Alias('discussion_category_name')] + [string] $DiscussionCategoryName, + + # Specifies whether this release should be set as the latest release for the repository. Drafts and prereleases cannot be set as latest. Defaults to true for newly published releases. legacy specifies that the latest release should be determined based on the release creation date and higher semantic version. + [Parameter()] + [Alias('make_latest')] + [ValidateSet('true', 'false', 'legacy')] + [string] $MakeLatest = 'true' + ) + + $requestBody = $PSBoundParameters | ConvertFrom-HashTable | ConvertTo-HashTable -NameCasingStyle snake_case + Remove-HashtableEntries -Hashtable $requestBody -RemoveNames 'Owner', 'Repo', 'Draft', 'Prerelease' + $requestBody = Join-Object -AsHashtable -Main $requestBody -Overrides @{ + draft = $Draft.IsPresent + prerelease = $Prerelease.IsPresent + } + Remove-HashtableEntries -Hashtable $requestBody -NullOrEmptyValues + + $inputObject = @{ + APIEndpoint = "/repos/$Owner/$Repo/releases/$ID" + Method = 'PATCH' + Body = $requestBody + } + + (Invoke-GitHubAPI @inputObject).Response + +} diff --git a/tools/utilities/GitHubAPI.ps1 b/tools/utilities/GitHubAPI.ps1 index 9338b3019..c1d03e154 100644 --- a/tools/utilities/GitHubAPI.ps1 +++ b/tools/utilities/GitHubAPI.ps1 @@ -21,8 +21,8 @@ $response = Invoke-RestMethod -Uri $APIDocURI -Method Get # @{n = 'PUT'; e = { (($_.value.psobject.Properties.Name) -contains 'PUT') } }, ` # @{n = 'PATCH'; e = { (($_.value.psobject.Properties.Name) -contains 'PATCH') } } | Format-Table -$path = '/rate_limit' -$method = 'get' +$path = '/repos/{owner}/{repo}/releases/{release_id}' +$method = 'delete' $response.paths.$path.$method $response.paths.$path.$method.tags | clip # -> Namespace/foldername $response.paths.$path.$method.operationId | clip # -> FunctionName diff --git a/tools/utilities/Local-Testing.ps1 b/tools/utilities/Local-Testing.ps1 index 039d6ed6b..a5b57e0b9 100644 --- a/tools/utilities/Local-Testing.ps1 +++ b/tools/utilities/Local-Testing.ps1 @@ -66,3 +66,5 @@ Add-GitHubUserSocials -AccountUrls 'https://www.github.com/MariusStorhaug' Get-GitHubUserEmail Add-GitHubUserEmail -Emails 'octocat@psmodule.io' Remove-GitHubUserEmail -Emails 'octocat@psmodule.io' + +Get-ChildItem -Path 'C:\Repos\GitHub\PSModule\Modules\GitHub\src\GitHub\private\Utilities' -File -Recurse -Force | Select-Object -ExpandProperty FullName | ForEach-Object { $null = . $_ }