From 9ee130e71dc9eeca7df7eb5dafe8da5cffaf6b5a Mon Sep 17 00:00:00 2001 From: Marius Storhaug Date: Thu, 26 Oct 2023 07:30:40 +0200 Subject: [PATCH] remove deployments --- .../Deployments/Get-GitHubEnvironment.ps1 | 37 -------------- .../Get-GitHubEnvironmentSecrets.ps1 | 49 ------------------- .../Deployments/Update-GitHubEnvironment.ps1 | 36 -------------- tools/utilities/GitHubAPI.ps1 | 4 +- 4 files changed, 2 insertions(+), 124 deletions(-) delete mode 100644 src/GitHub/public/Deployments/Get-GitHubEnvironment.ps1 delete mode 100644 src/GitHub/public/Deployments/Get-GitHubEnvironmentSecrets.ps1 delete mode 100644 src/GitHub/public/Deployments/Update-GitHubEnvironment.ps1 diff --git a/src/GitHub/public/Deployments/Get-GitHubEnvironment.ps1 b/src/GitHub/public/Deployments/Get-GitHubEnvironment.ps1 deleted file mode 100644 index 0cb07872..00000000 --- a/src/GitHub/public/Deployments/Get-GitHubEnvironment.ps1 +++ /dev/null @@ -1,37 +0,0 @@ -filter Get-GitHubEnvironment { - <# - .SYNOPSIS - Get GitHub environment - - .DESCRIPTION - Long description - - .PARAMETER Owner - Parameter description - - .PARAMETER Repo - Parameter description - - .EXAMPLE - An example - - .NOTES - https://docs.github.com/rest/reference/repos#get-all-environments - #> - [CmdletBinding()] - param ( - [Parameter()] - [string] $Owner = (Get-GitHubConfig -Name Owner), - - [Parameter()] - [string] $Repo = (Get-GitHubConfig -Name Repo) - ) - - $inputObject = @{ - APIEndpoint = "/repos/$Owner/$Repo/environments" - Method = 'GET' - } - - (Invoke-GitHubAPI @inputObject).Response - -} diff --git a/src/GitHub/public/Deployments/Get-GitHubEnvironmentSecrets.ps1 b/src/GitHub/public/Deployments/Get-GitHubEnvironmentSecrets.ps1 deleted file mode 100644 index 643eb716..00000000 --- a/src/GitHub/public/Deployments/Get-GitHubEnvironmentSecrets.ps1 +++ /dev/null @@ -1,49 +0,0 @@ -filter Get-GitHubEnvironmentSecrets { - <# - .SYNOPSIS - Get GitHub environment secrets - - .DESCRIPTION - Long description - - .PARAMETER Owner - Parameter description - - .PARAMETER Repo - Parameter description - - .PARAMETER EnvironmentName - Parameter description - - .EXAMPLE - An example - - .NOTES - https://docs.github.com/rest/reference/repos#get-all-environments - #> - [CmdletBinding()] - param ( - [Parameter()] - [string] $Owner = (Get-GitHubConfig -Name Owner), - - [Parameter()] - [string] $Repo = (Get-GitHubConfig -Name Repo), - - [Parameter( - Mandatory, - ValueFromPipelineByPropertyName - )] - [Alias('name')] - [string] $EnvironmentName - ) - - $RepoID = (Get-GitHubRepo).id - - $inputObject = @{ - APIEndpoint = "/repositories/$RepoID/environments/$EnvironmentName/secrets" - Method = 'GET' - } - - (Invoke-GitHubAPI @inputObject).Response - -} diff --git a/src/GitHub/public/Deployments/Update-GitHubEnvironment.ps1 b/src/GitHub/public/Deployments/Update-GitHubEnvironment.ps1 deleted file mode 100644 index c03cc78f..00000000 --- a/src/GitHub/public/Deployments/Update-GitHubEnvironment.ps1 +++ /dev/null @@ -1,36 +0,0 @@ -filter Update-GitHubEnvironment { - <# - .NOTES - https://docs.github.com/rest/reference/repos#create-or-update-an-environment - #> - [CmdletBinding()] - param ( - [Parameter()] - [string] $Owner = (Get-GitHubConfig -Name Owner), - - [Parameter()] - [string] $Repo = (Get-GitHubConfig -Name Repo), - - [Alias('environment_name')] - [Parameter( - Mandatory, - ValueFromPipelineByPropertyName - )] - [string] $Name - ) - - $body = @{ - owner = $Owner - repo = $Repo - environment_name = $Name - } - - $inputObject = @{ - APIEndpoint = "/repos/$Owner/$Repo/environments/$Name" - Method = 'PUT' - Body = $body - } - - (Invoke-GitHubAPI @inputObject).Response - -} diff --git a/tools/utilities/GitHubAPI.ps1 b/tools/utilities/GitHubAPI.ps1 index e5c20db2..272bfa51 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 = '/repos/{owner}/{repo}/actions/runs/{run_id}' -$method = 'delete' +$path = '/repositories/{repository_id}/environments/{environment_name}/secrets/{secret_name}' +$method = 'get' $response.paths.$path.$method $response.paths.$path.$method.tags | clip # -> Namespace/foldername $response.paths.$path.$method.operationId | clip # -> FunctionName