diff --git a/.github/workflows/Nightly-Run.yml b/.github/workflows/Nightly-Run.yml index 4469a9064..9b8e9f5d5 100644 --- a/.github/workflows/Nightly-Run.yml +++ b/.github/workflows/Nightly-Run.yml @@ -10,13 +10,15 @@ permissions: pull-requests: write statuses: write -env: - TEST_APP_CLIENT_ID: ${{ secrets.TEST_APP_CLIENT_ID }} - TEST_APP_PRIVATE_KEY: ${{ secrets.TEST_APP_PRIVATE_KEY }} - TEST_FG_PAT: ${{ secrets.TEST_FG_PAT }} - TEST_PAT: ${{ secrets.TEST_PAT }} - jobs: Process-PSModule: uses: PSModule/Process-PSModule/.github/workflows/CI.yml@v3 - secrets: inherit + secrets: + APIKey: ${{ secrets.APIKey }} + TEST_APP_ENT_CLIENT_ID: ${{ secrets.TEST_APP_ENT_CLIENT_ID }} + TEST_APP_ENT_PRIVATE_KEY: ${{ secrets.TEST_APP_ENT_PRIVATE_KEY }} + TEST_APP_ORG_CLIENT_ID: ${{ secrets.TEST_APP_ORG_CLIENT_ID }} + TEST_APP_ORG_PRIVATE_KEY: ${{ secrets.TEST_APP_ORG_PRIVATE_KEY }} + TEST_USER_ORG_FG_PAT: ${{ secrets.TEST_USER_ORG_FG_PAT }} + TEST_USER_USER_FG_PAT: ${{ secrets.TEST_USER_USER_FG_PAT }} + TEST_USER_PAT: ${{ secrets.TEST_USER_PAT }} diff --git a/.github/workflows/Process-PSModule.yml b/.github/workflows/Process-PSModule.yml index 0739b4def..3d703e6a5 100644 --- a/.github/workflows/Process-PSModule.yml +++ b/.github/workflows/Process-PSModule.yml @@ -24,17 +24,18 @@ permissions: pages: write id-token: write -env: - TEST_APP_CLIENT_ID: ${{ secrets.TEST_APP_CLIENT_ID }} - TEST_APP_PRIVATE_KEY: ${{ secrets.TEST_APP_PRIVATE_KEY }} - TEST_FG_PAT: ${{ secrets.TEST_FG_PAT }} - TEST_PAT: ${{ secrets.TEST_PAT }} - jobs: Process-PSModule: uses: PSModule/Process-PSModule/.github/workflows/workflow.yml@v3 - secrets: inherit + secrets: + APIKey: ${{ secrets.APIKey }} + TEST_APP_ENT_CLIENT_ID: ${{ secrets.TEST_APP_ENT_CLIENT_ID }} + TEST_APP_ENT_PRIVATE_KEY: ${{ secrets.TEST_APP_ENT_PRIVATE_KEY }} + TEST_APP_ORG_CLIENT_ID: ${{ secrets.TEST_APP_ORG_CLIENT_ID }} + TEST_APP_ORG_PRIVATE_KEY: ${{ secrets.TEST_APP_ORG_PRIVATE_KEY }} + TEST_USER_ORG_FG_PAT: ${{ secrets.TEST_USER_ORG_FG_PAT }} + TEST_USER_USER_FG_PAT: ${{ secrets.TEST_USER_USER_FG_PAT }} + TEST_USER_PAT: ${{ secrets.TEST_USER_PAT }} with: - SkipTests: SourceCode Debug: true Verbose: true diff --git a/src/functions/public/Auth/Update-GitHubUserAccessToken.ps1 b/src/functions/private/Auth/DeviceFlow/Update-GitHubUserAccessToken.ps1 similarity index 92% rename from src/functions/public/Auth/Update-GitHubUserAccessToken.ps1 rename to src/functions/private/Auth/DeviceFlow/Update-GitHubUserAccessToken.ps1 index bbce1c0c2..ccf985237 100644 --- a/src/functions/public/Auth/Update-GitHubUserAccessToken.ps1 +++ b/src/functions/private/Auth/DeviceFlow/Update-GitHubUserAccessToken.ps1 @@ -1,6 +1,4 @@ -#Requires -Modules @{ ModuleName = 'Context'; RequiredVersion = '5.0.5' } - -function Update-GitHubUserAccessToken { +function Update-GitHubUserAccessToken { <# .SYNOPSIS Updates the GitHub access token. @@ -21,12 +19,11 @@ function Update-GitHubUserAccessToken { .NOTES [Refreshing user access tokens](https://docs.github.com/en/apps/creating-github-apps/authenticating-with-a-github-app/refreshing-user-access-tokens) #> + [CmdletBinding(SupportsShouldProcess)] [OutputType([securestring])] - [Diagnostics.CodeAnalysis.SuppressMessageAttribute('PSAvoidLongLines', '', Justification = 'Long links for documentation.')] [Diagnostics.CodeAnalysis.SuppressMessageAttribute('PSAvoidUsingWriteHost', '', Justification = 'Is the CLI part of the module.')] - [Diagnostics.CodeAnalysis.SuppressMessageAttribute('PSAvoidUsingConvertToSecureStringWithPlainText', '', - Justification = 'The tokens are recieved as clear text. Mitigating exposure by removing variables and performing garbage collection.')] - [CmdletBinding(SupportsShouldProcess)] + [Diagnostics.CodeAnalysis.SuppressMessageAttribute('PSAvoidUsingConvertToSecureStringWithPlainText', '', Justification = 'The tokens are recieved as clear text. Mitigating exposure by removing variables and performing garbage collection.')] + [Diagnostics.CodeAnalysis.SuppressMessageAttribute('PSAvoidLongLines', '', Scope = 'Function', Justification = 'Reason for suppressing')] 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. diff --git a/src/functions/private/License/Get-GitHubLicenseList.ps1 b/src/functions/private/License/Get-GitHubLicenseList.ps1 index 42506ae1b..718f95b42 100644 --- a/src/functions/private/License/Get-GitHubLicenseList.ps1 +++ b/src/functions/private/License/Get-GitHubLicenseList.ps1 @@ -20,9 +20,10 @@ [OutputType([string[]])] [CmdletBinding()] param( - # The context to run the command in. + # 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()] - [string] $Context + [object] $Context = (Get-GitHubContext) ) begin { diff --git a/src/functions/private/License/Get-GitHubRepositoryLicense.ps1 b/src/functions/private/License/Get-GitHubRepositoryLicense.ps1 index e4e60901f..e3c066468 100644 --- a/src/functions/private/License/Get-GitHubRepositoryLicense.ps1 +++ b/src/functions/private/License/Get-GitHubRepositoryLicense.ps1 @@ -15,7 +15,7 @@ Get the license for the Hello-World repository from the octocat account. .NOTES - https://docs.github.com/rest/licenses/licenses#get-the-license-for-a-repository + [Get the license for a repository](https://docs.github.com/rest/licenses/licenses#get-the-license-for-a-repository) #> [CmdletBinding()] @@ -28,6 +28,11 @@ [Parameter()] [string] $Repo, + # The type of data to return. Can be either 'raw' or 'html'. + [Parameter()] + [ValidateSet('raw', 'html')] + [string] $Type = 'raw', + # 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()] @@ -49,6 +54,11 @@ $Repo = $Context.Repo } Write-Debug "Repo: [$Repo]" + + $contentType = switch ($Type) { + 'raw' { 'application/vnd.github.raw+json' } + 'html' { 'application/vnd.github.html+json' } + } } process { @@ -56,7 +66,7 @@ $inputObject = @{ Context = $Context APIEndpoint = "/repos/$Owner/$Repo/license" - Accept = 'application/vnd.github+json' + ContentType = $contentType Method = 'GET' } diff --git a/src/functions/private/Repositories/Repositories/Get-GitHubMyRepositories.ps1 b/src/functions/private/Repositories/Repositories/Get-GitHubMyRepositories.ps1 index da8719bc8..acdfb5eb4 100644 --- a/src/functions/private/Repositories/Repositories/Get-GitHubMyRepositories.ps1 +++ b/src/functions/private/Repositories/Repositories/Get-GitHubMyRepositories.ps1 @@ -123,21 +123,26 @@ process { try { $body = @{ - type = $Type sort = $Sort direction = $Direction per_page = $PerPage } - - if ($PSBoundParameters.ContainsKey('Affiliation')) { - $body['affiliation'] = $Affiliation -join ',' - } if ($PSBoundParameters.ContainsKey('Since')) { $body['since'] = $Since.ToString('yyyy-MM-ddTHH:mm:ssZ') } if ($PSBoundParameters.ContainsKey('Before')) { $body['before'] = $Before.ToString('yyyy-MM-ddTHH:mm:ssZ') } + Write-Debug "ParamSet: [$($PSCmdlet.ParameterSetName)]" + switch ($PSCmdlet.ParameterSetName) { + 'Aff-Vis' { + $body['affiliation'] = $Affiliation -join ',' + $body['visibility'] = $Visibility + } + 'Type' { + $body['type'] = $Type + } + } $inputObject = @{ Context = $Context diff --git a/src/functions/private/Teams/Get-GitHubRESTTeamByName.ps1 b/src/functions/private/Teams/Get-GitHubRESTTeamByName.ps1 index 437c83b70..a7fc5d519 100644 --- a/src/functions/private/Teams/Get-GitHubRESTTeamByName.ps1 +++ b/src/functions/private/Teams/Get-GitHubRESTTeamByName.ps1 @@ -1,4 +1,4 @@ -function Get-GitHubTeamByName { +function Get-GitHubRESTTeamByName { <# .SYNOPSIS Get a team by name @@ -8,7 +8,7 @@ and replaces spaces with a - separator. For example, "My TEam Näme" would become my-team-name. .EXAMPLE - Get-GitHubTeamByName -Organization 'github' -Name 'my-team-name' + Get-GitHubRESTTeamByName -Organization 'github' -Name 'my-team-name' #> [OutputType([void])] [CmdletBinding()] diff --git a/src/functions/private/Teams/Get-GitHubRESTTeamListByOrg.ps1 b/src/functions/private/Teams/Get-GitHubRESTTeamListByOrg.ps1 index fb8cf4ec1..4575a53b2 100644 --- a/src/functions/private/Teams/Get-GitHubRESTTeamListByOrg.ps1 +++ b/src/functions/private/Teams/Get-GitHubRESTTeamListByOrg.ps1 @@ -1,4 +1,4 @@ -function Get-GitHubTeamListByOrg { +function Get-GitHubRESTTeamListByOrg { <# .SYNOPSIS List teams @@ -7,7 +7,7 @@ Lists all teams in an organization that are visible to the authenticated user. .EXAMPLE - Get-GitHubTeamListByOrg -Organization 'github' + Get-GitHubRESTTeamListByOrg -Organization 'github' .NOTES [List teams](https://docs.github.com/rest/teams/teams#list-teams) diff --git a/src/functions/private/Utilities/PowerShell/Get-PSCallStackPath.ps1 b/src/functions/private/Utilities/PowerShell/Get-PSCallStackPath.ps1 index ab2b3e97e..8fe32f238 100644 --- a/src/functions/private/Utilities/PowerShell/Get-PSCallStackPath.ps1 +++ b/src/functions/private/Utilities/PowerShell/Get-PSCallStackPath.ps1 @@ -13,7 +13,8 @@ Get-PSCallStackPath First-Function\Second-Function\Third-Function - Shows the call stack of the last function called, Third-Function, with the first () and last (Get-PSCallStackPath) functions removed. + Shows the call stack of the last function called, Third-Function, with the first () + and last (Get-PSCallStackPath) functions removed. .EXAMPLE Get-PSCallStackPath -SkipFirst 0 diff --git a/src/functions/public/API/Invoke-GitHubAPI.ps1 b/src/functions/public/API/Invoke-GitHubAPI.ps1 index af1dd5cc1..74a402946 100644 --- a/src/functions/public/API/Invoke-GitHubAPI.ps1 +++ b/src/functions/public/API/Invoke-GitHubAPI.ps1 @@ -95,12 +95,12 @@ process { $Token = $Context.Token - Write-Debug "Token : [$Token]" + Write-Debug "Token : [$Token]" if ([string]::IsNullOrEmpty($TokenType)) { $TokenType = $Context.TokenType } - Write-Debug "TokenType : [$($Context.TokenType)]" + Write-Debug "TokenType : [$($Context.TokenType)]" if ([string]::IsNullOrEmpty($ApiBaseUri)) { $ApiBaseUri = $Context.ApiBaseUri @@ -194,6 +194,9 @@ 'text/plain' { $results = $response.Content } + 'text/html' { + $results = $response.Content + } 'application/octocat-stream' { [byte[]]$byteArray = $response.Content $results = [System.Text.Encoding]::UTF8.GetString($byteArray) @@ -227,6 +230,9 @@ $headers = [pscustomobject]$headers $sortedProperties = $headers.PSObject.Properties.Name | Sort-Object $headers = $headers | Select-Object $sortedProperties + Write-Debug 'Response headers:' + $headers | Out-String -Stream | ForEach-Object { Write-Debug $_ } + Write-Debug '---------------------------' $errordetails = $failure.ErrorDetails | ConvertFrom-Json -AsHashtable $errorResult = [ordered]@{ @@ -239,13 +245,13 @@ $APICall.Headers = $APICall.Headers | ConvertTo-Json $APICall.Method = $APICall.Method.ToString() - Write-Error '----------------------------------' - Write-Error 'Error details:' - $errorResult | Format-Table -AutoSize -HideTableHeaders | Out-String -Stream | ForEach-Object { Write-Error $_ } - Write-Error '----------------------------------' - Write-Debug 'Response headers:' - $headers | Out-String -Stream | ForEach-Object { Write-Debug $_ } - Write-Debug '---------------------------' + $errorResult = @" +---------------------------------- +Error details: +$($errorResult | Format-Table -AutoSize -HideTableHeaders | Out-String) +---------------------------------- +"@ + Write-Error $errorResult throw $failure.Exception.Message } } diff --git a/src/functions/public/Actions/Disable-GitHubWorkflow.ps1 b/src/functions/public/Actions/Disable-GitHubWorkflow.ps1 index 62baac086..172263a5a 100644 --- a/src/functions/public/Actions/Disable-GitHubWorkflow.ps1 +++ b/src/functions/public/Actions/Disable-GitHubWorkflow.ps1 @@ -3,6 +3,7 @@ .NOTES [Disable a workflow](https://docs.github.com/en/rest/actions/workflows#disable-a-workflow) #> + #SkipTest:FunctionTest:Will add a test for this function in a future PR [CmdletBinding()] param( # The account owner of the repository. The name is not case sensitive. diff --git a/src/functions/public/Actions/Enable-GitHubWorkflow.ps1 b/src/functions/public/Actions/Enable-GitHubWorkflow.ps1 index 45c72dfba..511bb9a41 100644 --- a/src/functions/public/Actions/Enable-GitHubWorkflow.ps1 +++ b/src/functions/public/Actions/Enable-GitHubWorkflow.ps1 @@ -3,6 +3,7 @@ .NOTES [Enable a workflow](https://docs.github.com/en/rest/actions/workflows#enable-a-workflow) #> + #SkipTest:FunctionTest:Will add a test for this function in a future PR [CmdletBinding()] param( [Parameter()] diff --git a/src/functions/public/Actions/Get-GitHubWorkflow.ps1 b/src/functions/public/Actions/Get-GitHubWorkflow.ps1 index fb86ae7b4..132daed5f 100644 --- a/src/functions/public/Actions/Get-GitHubWorkflow.ps1 +++ b/src/functions/public/Actions/Get-GitHubWorkflow.ps1 @@ -21,6 +21,7 @@ .NOTES [List repository workflows](https://docs.github.com/rest/actions/workflows?apiVersion=2022-11-28#list-repository-workflows) #> + #SkipTest:FunctionTest:Will add a test for this function in a future PR [CmdletBinding(DefaultParameterSetName = 'ByName')] param( [Parameter()] diff --git a/src/functions/public/Actions/Get-GitHubWorkflowRun.ps1 b/src/functions/public/Actions/Get-GitHubWorkflowRun.ps1 index ca87abfd7..a43c41e0e 100644 --- a/src/functions/public/Actions/Get-GitHubWorkflowRun.ps1 +++ b/src/functions/public/Actions/Get-GitHubWorkflowRun.ps1 @@ -36,6 +36,7 @@ [List workflow runs for a workflow](https://docs.github.com/rest/actions/workflow-runs?apiVersion=2022-11-28#list-workflow-runs-for-a-workflow) [List workflow runs for a repository](https://docs.github.com/rest/actions/workflow-runs?apiVersion=2022-11-28#list-workflow-runs-for-a-repository) #> + #SkipTest:FunctionTest:Will add a test for this function in a future PR [CmdletBinding(DefaultParameterSetName = '__AllParameterSets')] [Diagnostics.CodeAnalysis.SuppressMessageAttribute('PSAvoidLongLines', '', Justification = 'Contains a long link.')] [Diagnostics.CodeAnalysis.SuppressMessageAttribute('PSAvoidAssignmentToAutomaticVariable', 'Event', diff --git a/src/functions/public/Actions/Get-GitHubWorkflowUsage.ps1 b/src/functions/public/Actions/Get-GitHubWorkflowUsage.ps1 index 47fa47ad3..584bec134 100644 --- a/src/functions/public/Actions/Get-GitHubWorkflowUsage.ps1 +++ b/src/functions/public/Actions/Get-GitHubWorkflowUsage.ps1 @@ -12,6 +12,7 @@ .NOTES [Get workflow usage](https://docs.github.com/en/rest/actions/workflows#get-workflow-usage) #> + #SkipTest:FunctionTest:Will add a test for this function in a future PR [CmdletBinding( DefaultParameterSetName = 'ByName' )] diff --git a/src/functions/public/Actions/Remove-GitHubWorkflowRun.ps1 b/src/functions/public/Actions/Remove-GitHubWorkflowRun.ps1 index 230f5094c..14b36045e 100644 --- a/src/functions/public/Actions/Remove-GitHubWorkflowRun.ps1 +++ b/src/functions/public/Actions/Remove-GitHubWorkflowRun.ps1 @@ -16,6 +16,7 @@ .NOTES [Delete a workflow run](https://docs.github.com/rest/actions/workflow-runs#delete-a-workflow-run) #> + #SkipTest:FunctionTest:Will add a test for this function in a future PR [CmdletBinding(SupportsShouldProcess)] param( # The account owner of the repository. The name is not case sensitive. diff --git a/src/functions/public/Actions/Start-GitHubWorkflow.ps1 b/src/functions/public/Actions/Start-GitHubWorkflow.ps1 index 67cae215c..6609c9c27 100644 --- a/src/functions/public/Actions/Start-GitHubWorkflow.ps1 +++ b/src/functions/public/Actions/Start-GitHubWorkflow.ps1 @@ -17,6 +17,7 @@ .NOTES [Create a workflow dispatch event](https://docs.github.com/en/rest/actions/workflows#create-a-workflow-dispatch-event) #> + #SkipTest:FunctionTest:Will add a test for this function in a future PR [CmdletBinding(SupportsShouldProcess)] param( # The account owner of the repository. The name is not case sensitive. diff --git a/src/functions/public/Actions/Start-GitHubWorkflowReRun.ps1 b/src/functions/public/Actions/Start-GitHubWorkflowReRun.ps1 index 183775e2e..4871bfbe3 100644 --- a/src/functions/public/Actions/Start-GitHubWorkflowReRun.ps1 +++ b/src/functions/public/Actions/Start-GitHubWorkflowReRun.ps1 @@ -12,6 +12,7 @@ .NOTES [Re-run a workflow](https://docs.github.com/en/rest/actions/workflow-runs#re-run-a-workflow) #> + #SkipTest:FunctionTest:Will add a test for this function in a future PR [CmdletBinding(SupportsShouldProcess)] param( # The account owner of the repository. The name is not case sensitive. diff --git a/src/functions/public/Actions/Stop-GitHubWorkflowRun.ps1 b/src/functions/public/Actions/Stop-GitHubWorkflowRun.ps1 index 57ee67c68..ff3c6c0df 100644 --- a/src/functions/public/Actions/Stop-GitHubWorkflowRun.ps1 +++ b/src/functions/public/Actions/Stop-GitHubWorkflowRun.ps1 @@ -14,6 +14,7 @@ .NOTES [Cancel a workflow run](https://docs.github.com/en/rest/actions/workflow-runs#cancel-a-workflow-run) #> + #SkipTest:FunctionTest:Will add a test for this function in a future PR [CmdletBinding(SupportsShouldProcess)] [alias('Cancel-GitHubWorkflowRun')] param( diff --git a/src/functions/public/Apps/GitHub Apps/New-GitHubAppInstallationAccessToken.ps1 b/src/functions/public/Apps/GitHub Apps/New-GitHubAppInstallationAccessToken.ps1 index 3e09fe391..2b9cf17c6 100644 --- a/src/functions/public/Apps/GitHub Apps/New-GitHubAppInstallationAccessToken.ps1 +++ b/src/functions/public/Apps/GitHub Apps/New-GitHubAppInstallationAccessToken.ps1 @@ -33,7 +33,7 @@ Creates an installation access token for the installation with the ID `12345678`. .EXAMPLE - Connect-GitHub -ClientID $ClientID -PrivateKey $PrivateKey -Verbose + Connect-GitHub -ClientID $ClientID -PrivateKey $PrivateKey Get-GitHubAppInstallation | New-GitHubAppInstallationAccessToken Gets the GitHub App installations and creates an installation access token for each installation. diff --git a/src/functions/public/Apps/Webhooks/Redeliver-GitHubAppWebhookDelivery.ps1 b/src/functions/public/Apps/Webhooks/Invoke-GitHubAppWebhookReDelivery.ps1 similarity index 100% rename from src/functions/public/Apps/Webhooks/Redeliver-GitHubAppWebhookDelivery.ps1 rename to src/functions/public/Apps/Webhooks/Invoke-GitHubAppWebhookReDelivery.ps1 diff --git a/src/functions/public/Apps/Webhooks/Update-GitHubAppWebhookConfiguration.ps1 b/src/functions/public/Apps/Webhooks/Update-GitHubAppWebhookConfiguration.ps1 index 5bf4316c1..734027fd6 100644 --- a/src/functions/public/Apps/Webhooks/Update-GitHubAppWebhookConfiguration.ps1 +++ b/src/functions/public/Apps/Webhooks/Update-GitHubAppWebhookConfiguration.ps1 @@ -58,8 +58,9 @@ url = $URL content_type = $ContentType secret = $Secret - insecure_ssl = $InsecureSSL ? 1 : 0 + insecure_ssl = $PSBoundParameters.ContainsKey($InsecureSSL) ? ($InsecureSSL ? 1 : 0) : $null } + $body | Remove-HashtableEntry -NullOrEmptyValues $inputObject = @{ Context = $Context diff --git a/src/functions/public/Auth/Connect-GitHubApp.ps1 b/src/functions/public/Auth/Connect-GitHubApp.ps1 index 0942fb41b..d2ba3e23c 100644 --- a/src/functions/public/Auth/Connect-GitHubApp.ps1 +++ b/src/functions/public/Auth/Connect-GitHubApp.ps1 @@ -1,4 +1,4 @@ -function Connect-GitHubApp { +function Connect-GitHubApp { <# .SYNOPSIS Connects to GitHub as a installation using a GitHub App. diff --git a/src/functions/public/Branches/Get-GitHubRepoBranch.ps1 b/src/functions/public/Branches/Get-GitHubRepoBranch.ps1 index eea9e1b8e..5a1a8b59a 100644 --- a/src/functions/public/Branches/Get-GitHubRepoBranch.ps1 +++ b/src/functions/public/Branches/Get-GitHubRepoBranch.ps1 @@ -14,6 +14,7 @@ .NOTES [List branches](https://docs.github.com/rest/branches/branches#list-branches) #> + #SkipTest:FunctionTest:Will add a test for this function in a future PR [CmdletBinding()] param( # The account owner of the repository. The name is not case sensitive. diff --git a/src/functions/public/Commands/Set-GitHubOutput.ps1 b/src/functions/public/Commands/Set-GitHubOutput.ps1 index b29f7a575..f3d54d5f2 100644 --- a/src/functions/public/Commands/Set-GitHubOutput.ps1 +++ b/src/functions/public/Commands/Set-GitHubOutput.ps1 @@ -60,7 +60,8 @@ Write-Verbose "Output: [$Name] = [$Value]" - # If the script is running in a GitHub composite action, accumulate the output under the 'result' key, else append the key-value pair directly. + # If the script is running in a GitHub composite action, accumulate the output under the 'result' key, + # else append the key-value pair directly. if ($env:PSMODULE_GITHUB_SCRIPT) { if (-not $outputs.result) { $outputs.result = @{ diff --git a/src/functions/public/Enterprise/Get-GitHubEnterpriseInstallableOrganization.ps1 b/src/functions/public/Enterprise/Get-GitHubEnterpriseInstallableOrganization.ps1 index 526e69389..d0fe0ffb5 100644 --- a/src/functions/public/Enterprise/Get-GitHubEnterpriseInstallableOrganization.ps1 +++ b/src/functions/public/Enterprise/Get-GitHubEnterpriseInstallableOrganization.ps1 @@ -12,6 +12,7 @@ .EXAMPLE Get-GitHubEnterpriseInstallableOrganization -Enterprise 'msx' #> + #SkipTest:FunctionTest:Will add a test for this function in a future PR [CmdletBinding()] param( # The enterprise slug or ID. diff --git a/src/functions/public/Enterprise/Get-GitHubEnterpriseOrganization.ps1 b/src/functions/public/Enterprise/Get-GitHubEnterpriseOrganization.ps1 index adbb0debb..e932623f9 100644 --- a/src/functions/public/Enterprise/Get-GitHubEnterpriseOrganization.ps1 +++ b/src/functions/public/Enterprise/Get-GitHubEnterpriseOrganization.ps1 @@ -9,6 +9,7 @@ .EXAMPLE Get-GitHubEnterpriseOrganization -Enterprise 'msx' #> + #SkipTest:FunctionTest:Will add a test for this function in a future PR [CmdletBinding()] param( [Parameter()] diff --git a/src/functions/public/Enterprise/Install-GitHubAppOnEnterpriseOrganization.ps1 b/src/functions/public/Enterprise/Install-GitHubAppOnEnterpriseOrganization.ps1 index 3b6d6df52..3d04b23c5 100644 --- a/src/functions/public/Enterprise/Install-GitHubAppOnEnterpriseOrganization.ps1 +++ b/src/functions/public/Enterprise/Install-GitHubAppOnEnterpriseOrganization.ps1 @@ -1,16 +1,17 @@ function Install-GitHubAppOnEnterpriseOrganization { <# - .SYNOPSIS - Install an app on an Enterprise-owned organization + .SYNOPSIS + Install an app on an Enterprise-owned organization - .DESCRIPTION - Installs the provided GitHub App on the specified organization owned by the enterprise. + .DESCRIPTION + Installs the provided GitHub App on the specified organization owned by the enterprise. - The authenticated GitHub App must be installed on the enterprise and be granted the Enterprise/organization_installations (write) permission. + The authenticated GitHub App must be installed on the enterprise and be granted the Enterprise/organization_installations (write) permission. - .EXAMPLE - Install-GitHubAppOnEnterpriseOrganization -Enterprise 'msx' -Organization 'org' -ClientID '123456' + .EXAMPLE + Install-GitHubAppOnEnterpriseOrganization -Enterprise 'msx' -Organization 'org' -ClientID '123456' #> + #SkipTest:FunctionTest:Will add a test for this function in a future PR [CmdletBinding()] param( # The enterprise slug or ID. diff --git a/src/functions/public/Git/Set-GitHubGitConfig.ps1 b/src/functions/public/Git/Set-GitHubGitConfig.ps1 index 3778ca7b7..f224edf05 100644 --- a/src/functions/public/Git/Set-GitHubGitConfig.ps1 +++ b/src/functions/public/Git/Set-GitHubGitConfig.ps1 @@ -28,6 +28,7 @@ $stackPath = Get-PSCallStackPath Write-Debug "[$stackPath] - Start" $Context = Resolve-GitHubContext -Context $Context + Assert-GitHubContext -Context $Context -AuthType IAT } process { diff --git a/src/functions/public/Gitignore/Get-GitHubGitignore.ps1 b/src/functions/public/Gitignore/Get-GitHubGitignore.ps1 index 70ae5b2f1..7fca1570e 100644 --- a/src/functions/public/Gitignore/Get-GitHubGitignore.ps1 +++ b/src/functions/public/Gitignore/Get-GitHubGitignore.ps1 @@ -22,7 +22,6 @@ filter Get-GitHubGitignore { .NOTES [Get a gitignore template](https://docs.github.com/rest/gitignore/gitignore#get-a-gitignore-template) [Get all gitignore templates](https://docs.github.com/rest/gitignore/gitignore#get-all-gitignore-templates) - #> [CmdletBinding(DefaultParameterSetName = 'List')] param( diff --git a/src/functions/public/GraphQL/Invoke-GitHubGraphQLQuery.ps1 b/src/functions/public/GraphQL/Invoke-GitHubGraphQLQuery.ps1 index 49e6a8871..a34a49d2d 100644 --- a/src/functions/public/GraphQL/Invoke-GitHubGraphQLQuery.ps1 +++ b/src/functions/public/GraphQL/Invoke-GitHubGraphQLQuery.ps1 @@ -12,11 +12,14 @@ .NOTES [GitHub GraphQL API documentation](https://docs.github.com/graphql) #> + [CmdletBinding()] param( # The GraphQL query to execute. + [Parameter(Mandatory)] [string] $Query, # The variables to pass to the query. + [Parameter()] [hashtable] $Variables, # The context to run the command in. Used to get the details for the API call. diff --git a/src/functions/public/License/Get-GitHubLicense.ps1 b/src/functions/public/License/Get-GitHubLicense.ps1 index 1b3bd66b3..7f5953a61 100644 --- a/src/functions/public/License/Get-GitHubLicense.ps1 +++ b/src/functions/public/License/Get-GitHubLicense.ps1 @@ -32,7 +32,6 @@ filter Get-GitHubLicense { [Get a license](https://docs.github.com/rest/licenses/licenses#get-a-license) [Get all commonly used licenses](https://docs.github.com/rest/licenses/licenses#get-all-commonly-used-licenses) [Get the license for a repository](https://docs.github.com/rest/licenses/licenses#get-the-license-for-a-repository) - #> [CmdletBinding(DefaultParameterSetName = 'List')] param( @@ -44,28 +43,16 @@ filter Get-GitHubLicense { [Parameter(ParameterSetName = 'Repository')] [string] $Repo, + # The license keyword, license name, or license SPDX ID. For example, mit or mpl-2.0. + [Parameter(ParameterSetName = 'Name')] + [string] $Name, + # 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) ) - dynamicparam { - $DynamicParamDictionary = New-DynamicParamDictionary - - $dynParam = @{ - Name = 'Name' - ParameterSetName = 'Name' - Type = [string] - Mandatory = $true - ValidateSet = Get-GitHubLicenseList | Select-Object -ExpandProperty Name - DynamicParamDictionary = $DynamicParamDictionary - } - New-DynamicParam @dynParam - - return $DynamicParamDictionary - } - begin { $stackPath = Get-PSCallStackPath Write-Debug "[$stackPath] - Start" @@ -84,7 +71,6 @@ filter Get-GitHubLicense { process { try { - $Name = $PSBoundParameters['Name'] switch ($PSCmdlet.ParameterSetName) { 'List' { Get-GitHubLicenseList -Context $Context @@ -105,3 +91,12 @@ filter Get-GitHubLicense { Write-Debug "[$stackPath] - End" } } + +Register-ArgumentCompleter -CommandName Get-GitHubLicense -ParameterName Name -ScriptBlock { + param($commandName, $parameterName, $wordToComplete, $commandAst, $fakeBoundParameter) + $null = $commandName, $parameterName, $wordToComplete, $commandAst, $fakeBoundParameter + $names = Get-GitHubLicenseList | Select-Object -ExpandProperty Name | Where-Object { $_ -like "$wordToComplete*" } + $names | ForEach-Object { + [System.Management.Automation.CompletionResult]::new($_, $_, 'ParameterValue', $_) + } +} diff --git a/src/functions/public/Markdown/Get-GitHubMarkdown.ps1 b/src/functions/public/Markdown/Get-GitHubMarkdown.ps1 index bf7a64ddb..5c8633833 100644 --- a/src/functions/public/Markdown/Get-GitHubMarkdown.ps1 +++ b/src/functions/public/Markdown/Get-GitHubMarkdown.ps1 @@ -24,12 +24,12 @@ ValueFromPipeline, ValueFromPipelineByPropertyName )] - [switch] $Text, + [string] $Text, # The rendering mode. [Parameter()] [ValidateSet('markdown', 'gfm')] - [string] $Mode, + [string] $Mode = 'markdown', # The repository context to use when creating references in `gfm` mode. For example, setting `context` to `octo-org/octo-repo` will change the # text `#42` into an HTML link to issue 42 in the `octo-org/octo-repo` repository. diff --git a/src/functions/public/Markdown/Get-GitHubMarkdownRaw.ps1 b/src/functions/public/Markdown/Get-GitHubMarkdownRaw.ps1 index e6cd88509..cbdf5c1a6 100644 --- a/src/functions/public/Markdown/Get-GitHubMarkdownRaw.ps1 +++ b/src/functions/public/Markdown/Get-GitHubMarkdownRaw.ps1 @@ -15,7 +15,7 @@ Render the Markdown text 'Hello, world!' in raw mode. .NOTES - [Render a Markdown document in raw mode](https://docs.github.com/rest/reference/meta#github-api-root) + [Render a Markdown document in raw mode](https://docs.github.com/rest/markdown/markdown#render-a-markdown-document-in-raw-mode) #> [CmdletBinding()] param( @@ -38,12 +38,15 @@ process { try { + $body = @{ + text = $Text + } $inputObject = @{ Context = $Context APIEndpoint = '/markdown/raw' ContentType = 'text/plain' - Body = $Text Method = 'POST' + Body = $body } Invoke-GitHubAPI @inputObject | ForEach-Object { diff --git a/src/functions/public/Organization/Get-GitHubOrganization.ps1 b/src/functions/public/Organization/Get-GitHubOrganization.ps1 index 962f71944..76e148135 100644 --- a/src/functions/public/Organization/Get-GitHubOrganization.ps1 +++ b/src/functions/public/Organization/Get-GitHubOrganization.ps1 @@ -32,6 +32,7 @@ .NOTES [List organizations](https://docs.github.com/rest/orgs/orgs) #> + #SkipTest:FunctionTest:Will add a test for this function in a future PR [OutputType([pscustomobject])] [CmdletBinding(DefaultParameterSetName = '__DefaultSet')] [System.Diagnostics.CodeAnalysis.SuppressMessageAttribute('PSReviewUnusedParameter', 'All', Justification = 'Required for parameter set')] diff --git a/src/functions/public/Organization/Get-GitHubOrganizationAppInstallation.ps1 b/src/functions/public/Organization/Get-GitHubOrganizationAppInstallation.ps1 index 6df2ab513..c0330a4cc 100644 --- a/src/functions/public/Organization/Get-GitHubOrganizationAppInstallation.ps1 +++ b/src/functions/public/Organization/Get-GitHubOrganizationAppInstallation.ps1 @@ -14,8 +14,8 @@ .NOTES [List app installations for an organization](https://docs.github.com/rest/orgs/orgs#list-app-installations-for-an-organization) - #> + #SkipTest:FunctionTest:Will add a test for this function in a future PR [OutputType([pscustomobject])] [CmdletBinding()] param( diff --git a/src/functions/public/Organization/Members/Get-GitHubOrganizationMember.ps1 b/src/functions/public/Organization/Members/Get-GitHubOrganizationMember.ps1 index 05f0f1c51..9bf72a61f 100644 --- a/src/functions/public/Organization/Members/Get-GitHubOrganizationMember.ps1 +++ b/src/functions/public/Organization/Members/Get-GitHubOrganizationMember.ps1 @@ -10,6 +10,7 @@ .NOTES [List organization members](https://docs.github.com/en/rest/orgs/members?apiVersion=2022-11-28#list-organization-members) #> + #SkipTest:FunctionTest:Will add a test for this function in a future PR [OutputType([pscustomobject])] [CmdletBinding()] param( diff --git a/src/functions/public/Organization/Members/Get-GitHubOrganizationPendingInvitation.ps1 b/src/functions/public/Organization/Members/Get-GitHubOrganizationPendingInvitation.ps1 index a9c4f8ac6..c735b96ff 100644 --- a/src/functions/public/Organization/Members/Get-GitHubOrganizationPendingInvitation.ps1 +++ b/src/functions/public/Organization/Members/Get-GitHubOrganizationPendingInvitation.ps1 @@ -12,6 +12,7 @@ .NOTES [List pending organization invitations](https://docs.github.com/rest/orgs/members#list-pending-organization-invitations) #> + #SkipTest:FunctionTest:Will add a test for this function in a future PR [CmdletBinding()] param( # The organization name. The name is not case sensitive. diff --git a/src/functions/public/Organization/Members/New-GitHubOrganizationInvitation.ps1 b/src/functions/public/Organization/Members/New-GitHubOrganizationInvitation.ps1 index 810fceef3..d211b55cf 100644 --- a/src/functions/public/Organization/Members/New-GitHubOrganizationInvitation.ps1 +++ b/src/functions/public/Organization/Members/New-GitHubOrganizationInvitation.ps1 @@ -15,6 +15,7 @@ .NOTES [Create an organization invitation](https://docs.github.com/rest/orgs/members#list-pending-organization-invitations) #> + #SkipTest:FunctionTest:Will add a test for this function in a future PR [CmdletBinding(SupportsShouldProcess)] param( # The organization name. The name is not case sensitive. diff --git a/src/functions/public/Organization/Remove-GitHubOrganization.ps1 b/src/functions/public/Organization/Remove-GitHubOrganization.ps1 index 55bc153ce..7b8822e47 100644 --- a/src/functions/public/Organization/Remove-GitHubOrganization.ps1 +++ b/src/functions/public/Organization/Remove-GitHubOrganization.ps1 @@ -17,6 +17,7 @@ .NOTES [Delete an organization](https://docs.github.com/rest/orgs/orgs#delete-an-organization) #> + #SkipTest:FunctionTest:Will add a test for this function in a future PR [OutputType([pscustomobject])] [CmdletBinding(SupportsShouldProcess)] param( diff --git a/src/functions/public/Organization/Set-GitHubOrganization.ps1 b/src/functions/public/Organization/Set-GitHubOrganization.ps1 index 8849558bc..a270b7f7a 100644 --- a/src/functions/public/Organization/Set-GitHubOrganization.ps1 +++ b/src/functions/public/Organization/Set-GitHubOrganization.ps1 @@ -32,8 +32,8 @@ .NOTES [Update an organization](https://docs.github.com/rest/orgs/orgs#update-an-organization) - #> + #SkipTest:FunctionTest:Will add a test for this function in a future PR [OutputType([pscustomobject])] [CmdletBinding(SupportsShouldProcess)] [Diagnostics.CodeAnalysis.SuppressMessageAttribute( diff --git a/src/functions/public/Organization/Set-GitHubOrganizationSecurityFeature.ps1 b/src/functions/public/Organization/Set-GitHubOrganizationSecurityFeature.ps1 index b87d0d206..0f3dac84a 100644 --- a/src/functions/public/Organization/Set-GitHubOrganizationSecurityFeature.ps1 +++ b/src/functions/public/Organization/Set-GitHubOrganizationSecurityFeature.ps1 @@ -21,6 +21,7 @@ .NOTES [Enable or disable a security feature for an organization](https://docs.github.com/rest/orgs/orgs#enable-or-disable-a-security-feature-for-an-organization) #> + #SkipTest:FunctionTest:Will add a test for this function in a future PR [OutputType([pscustomobject])] [Diagnostics.CodeAnalysis.SuppressMessageAttribute('PSAvoidLongLines', '', Justification = 'Long link in notes.')] [CmdletBinding(SupportsShouldProcess)] diff --git a/src/functions/public/Releases/Assets/Add-GitHubReleaseAsset.ps1 b/src/functions/public/Releases/Assets/Add-GitHubReleaseAsset.ps1 index 8e0e02e78..69a082f4d 100644 --- a/src/functions/public/Releases/Assets/Add-GitHubReleaseAsset.ps1 +++ b/src/functions/public/Releases/Assets/Add-GitHubReleaseAsset.ps1 @@ -43,8 +43,8 @@ .NOTES [Upload a release asset](https://docs.github.com/rest/releases/assets#upload-a-release-asset) - #> + #SkipTest:FunctionTest:Will add a test for this function in a future PR [CmdletBinding()] param( # The account owner of the repository. The name is not case sensitive. diff --git a/src/functions/public/Releases/Assets/Get-GitHubReleaseAsset.ps1 b/src/functions/public/Releases/Assets/Get-GitHubReleaseAsset.ps1 index d98588aa8..523f62709 100644 --- a/src/functions/public/Releases/Assets/Get-GitHubReleaseAsset.ps1 +++ b/src/functions/public/Releases/Assets/Get-GitHubReleaseAsset.ps1 @@ -19,8 +19,8 @@ .NOTES [Get a release asset](https://docs.github.com/rest/releases/assets#get-a-release-asset) - #> + #SkipTest:FunctionTest:Will add a test for this function in a future PR [CmdletBinding()] param( # The account owner of the repository. The name is not case sensitive. diff --git a/src/functions/public/Releases/Assets/Remove-GitHubReleaseAsset.ps1 b/src/functions/public/Releases/Assets/Remove-GitHubReleaseAsset.ps1 index c0b93b9e8..445eb4a1c 100644 --- a/src/functions/public/Releases/Assets/Remove-GitHubReleaseAsset.ps1 +++ b/src/functions/public/Releases/Assets/Remove-GitHubReleaseAsset.ps1 @@ -13,8 +13,8 @@ .NOTES [Delete a release asset](https://docs.github.com/rest/releases/assets#delete-a-release-asset) - #> + #SkipTest:FunctionTest:Will add a test for this function in a future PR [CmdletBinding(SupportsShouldProcess)] param( # The account owner of the repository. The name is not case sensitive. diff --git a/src/functions/public/Releases/Assets/Set-GitHubReleaseAsset.ps1 b/src/functions/public/Releases/Assets/Set-GitHubReleaseAsset.ps1 index 5c5e4a320..4d3848739 100644 --- a/src/functions/public/Releases/Assets/Set-GitHubReleaseAsset.ps1 +++ b/src/functions/public/Releases/Assets/Set-GitHubReleaseAsset.ps1 @@ -15,6 +15,7 @@ .NOTES [Update a release asset](https://docs.github.com/rest/releases/assets#update-a-release-asset) #> + #SkipTest:FunctionTest:Will add a test for this function in a future PR [CmdletBinding(SupportsShouldProcess)] param( # The account owner of the repository. The name is not case sensitive. diff --git a/src/functions/public/Releases/Releases/Get-GitHubRelease.ps1 b/src/functions/public/Releases/Releases/Get-GitHubRelease.ps1 index e6c77e679..18aad97c9 100644 --- a/src/functions/public/Releases/Releases/Get-GitHubRelease.ps1 +++ b/src/functions/public/Releases/Releases/Get-GitHubRelease.ps1 @@ -31,8 +31,8 @@ .NOTES [List releases](https://docs.github.com/rest/releases/releases#list-releases) [Get the latest release](https://docs.github.com/rest/releases/releases#get-the-latest-release) - #> + #SkipTest:FunctionTest:Will add a test for this function in a future PR [CmdletBinding(DefaultParameterSetName = 'All')] [Diagnostics.CodeAnalysis.SuppressMessageAttribute('PSReviewUnusedParameter', 'Latest', Justification = 'Required for parameter set')] param( diff --git a/src/functions/public/Releases/Releases/New-GitHubRelease.ps1 b/src/functions/public/Releases/Releases/New-GitHubRelease.ps1 index b24e8dd19..2d6f47237 100644 --- a/src/functions/public/Releases/Releases/New-GitHubRelease.ps1 +++ b/src/functions/public/Releases/Releases/New-GitHubRelease.ps1 @@ -17,8 +17,8 @@ .NOTES [Create a release](https://docs.github.com/rest/releases/releases#create-a-release) - #> + #SkipTest:FunctionTest:Will add a test for this function in a future PR [OutputType([pscustomobject])] [Diagnostics.CodeAnalysis.SuppressMessageAttribute('PSAvoidLongLines', '', Justification = 'Contains a long link.')] [CmdletBinding(SupportsShouldProcess)] diff --git a/src/functions/public/Releases/Releases/New-GitHubReleaseNote.ps1 b/src/functions/public/Releases/Releases/New-GitHubReleaseNote.ps1 index 7404cd08e..0e03302f0 100644 --- a/src/functions/public/Releases/Releases/New-GitHubReleaseNote.ps1 +++ b/src/functions/public/Releases/Releases/New-GitHubReleaseNote.ps1 @@ -50,8 +50,8 @@ .NOTES [Generate release notes content for a release](https://docs.github.com/rest/releases/releases#list-releases) - #> + #SkipTest:FunctionTest:Will add a test for this function in a future PR [OutputType([pscustomobject])] [Alias('Generate-GitHubReleaseNotes')] [Alias('New-GitHubReleaseNotes')] diff --git a/src/functions/public/Releases/Releases/Remove-GitHubRelease.ps1 b/src/functions/public/Releases/Releases/Remove-GitHubRelease.ps1 index 4f3f739ed..657acd8eb 100644 --- a/src/functions/public/Releases/Releases/Remove-GitHubRelease.ps1 +++ b/src/functions/public/Releases/Releases/Remove-GitHubRelease.ps1 @@ -13,8 +13,8 @@ .NOTES [Delete a release](https://docs.github.com/rest/releases/releases#delete-a-release) - #> + #SkipTest:FunctionTest:Will add a test for this function in a future PR [OutputType([pscustomobject])] [CmdletBinding(SupportsShouldProcess)] param( diff --git a/src/functions/public/Releases/Releases/Set-GitHubRelease.ps1 b/src/functions/public/Releases/Releases/Set-GitHubRelease.ps1 index 9b48fe068..9e0919029 100644 --- a/src/functions/public/Releases/Releases/Set-GitHubRelease.ps1 +++ b/src/functions/public/Releases/Releases/Set-GitHubRelease.ps1 @@ -14,6 +14,7 @@ .NOTES [Update a release](https://docs.github.com/rest/releases/releases#update-a-release) #> + #SkipTest:FunctionTest:Will add a test for this function in a future PR [OutputType([pscustomobject])] [Diagnostics.CodeAnalysis.SuppressMessageAttribute('PSAvoidLongLines', '', Justification = 'Contains a long link.')] [CmdletBinding(SupportsShouldProcess)] diff --git a/src/functions/public/Repositories/Autolinks/Get-GitHubRepositoryAutolink.ps1 b/src/functions/public/Repositories/Autolinks/Get-GitHubRepositoryAutolink.ps1 index 0763bccd0..8e118a3c4 100644 --- a/src/functions/public/Repositories/Autolinks/Get-GitHubRepositoryAutolink.ps1 +++ b/src/functions/public/Repositories/Autolinks/Get-GitHubRepositoryAutolink.ps1 @@ -20,8 +20,8 @@ .NOTES [Get all autolinks of a repository](https://docs.github.com/rest/repos/autolinks#list-all-autolinks-of-a-repository) - #> + #SkipTest:FunctionTest:Will add a test for this function in a future PR [Alias('Get-GitHubRepositoryAutolinks')] [CmdletBinding(DefaultParameterSetName = 'Default')] param( diff --git a/src/functions/public/Repositories/Autolinks/New-GitHubRepositoryAutolink.ps1 b/src/functions/public/Repositories/Autolinks/New-GitHubRepositoryAutolink.ps1 index b8c40b9bc..56775f5f2 100644 --- a/src/functions/public/Repositories/Autolinks/New-GitHubRepositoryAutolink.ps1 +++ b/src/functions/public/Repositories/Autolinks/New-GitHubRepositoryAutolink.ps1 @@ -14,8 +14,8 @@ .NOTES [Create an autolink reference for a repository](https://docs.github.com/rest/repos/autolinks#create-an-autolink-reference-for-a-repository) - #> + #SkipTest:FunctionTest:Will add a test for this function in a future PR [OutputType([pscustomobject])] [CmdletBinding(SupportsShouldProcess)] param( diff --git a/src/functions/public/Repositories/Autolinks/Remove-GitHubRepositoryAutolink.ps1 b/src/functions/public/Repositories/Autolinks/Remove-GitHubRepositoryAutolink.ps1 index ff169a8b2..fe37297d4 100644 --- a/src/functions/public/Repositories/Autolinks/Remove-GitHubRepositoryAutolink.ps1 +++ b/src/functions/public/Repositories/Autolinks/Remove-GitHubRepositoryAutolink.ps1 @@ -15,8 +15,8 @@ .NOTES [Delete an autolink reference from a repository](https://docs.github.com/rest/repos/autolinks#delete-an-autolink-reference-from-a-repository) - #> + #SkipTest:FunctionTest:Will add a test for this function in a future PR [OutputType([pscustomobject])] [CmdletBinding(SupportsShouldProcess)] param( diff --git a/src/functions/public/Repositories/CustomProperties/Get-GitHubRepositoryCustomProperty.ps1 b/src/functions/public/Repositories/CustomProperties/Get-GitHubRepositoryCustomProperty.ps1 index 3d9310041..6963276c9 100644 --- a/src/functions/public/Repositories/CustomProperties/Get-GitHubRepositoryCustomProperty.ps1 +++ b/src/functions/public/Repositories/CustomProperties/Get-GitHubRepositoryCustomProperty.ps1 @@ -14,8 +14,8 @@ .NOTES [Get all custom property values for a repository](https://docs.github.com/rest/repos/custom-properties#get-all-custom-property-values-for-a-repository) - #> + #SkipTest:FunctionTest:Will add a test for this function in a future PR [Alias('Get-GitHubRepositoryCustomProperties')] [CmdletBinding()] [Diagnostics.CodeAnalysis.SuppressMessageAttribute('PSAvoidLongLines', '', Justification = 'Contains a long link.')] diff --git a/src/functions/public/Repositories/Repositories/Disable-GitHubRepositoryPrivateVulnerabilityReporting.ps1 b/src/functions/public/Repositories/Repositories/Disable-GitHubRepositoryPrivateVulnerabilityReporting.ps1 index a071b3bc8..f343aeb2e 100644 --- a/src/functions/public/Repositories/Repositories/Disable-GitHubRepositoryPrivateVulnerabilityReporting.ps1 +++ b/src/functions/public/Repositories/Repositories/Disable-GitHubRepositoryPrivateVulnerabilityReporting.ps1 @@ -15,8 +15,8 @@ .NOTES [Disable private vulnerability reporting for a repository](https://docs.github.com/rest/repos/repos#disable-private-vulnerability-reporting-for-a-repository) - #> + #SkipTest:FunctionTest:Will add a test for this function in a future PR [CmdletBinding(SupportsShouldProcess)] [Diagnostics.CodeAnalysis.SuppressMessageAttribute('PSAvoidLongLines', '', Justification = 'Long links')] param( diff --git a/src/functions/public/Repositories/Repositories/Disable-GitHubRepositorySecurityFix.ps1 b/src/functions/public/Repositories/Repositories/Disable-GitHubRepositorySecurityFix.ps1 index 7cf6462f0..d24ce09e5 100644 --- a/src/functions/public/Repositories/Repositories/Disable-GitHubRepositorySecurityFix.ps1 +++ b/src/functions/public/Repositories/Repositories/Disable-GitHubRepositorySecurityFix.ps1 @@ -15,8 +15,8 @@ .NOTES [Disable automated security fixes](https://docs.github.com/rest/repos/repos#disable-automated-security-fixes) - #> + #SkipTest:FunctionTest:Will add a test for this function in a future PR [CmdletBinding(SupportsShouldProcess)] [Alias('Disable-GitHubRepositorySecurityFixes')] param( diff --git a/src/functions/public/Repositories/Repositories/Disable-GitHubRepositoryVulnerabilityAlert.ps1 b/src/functions/public/Repositories/Repositories/Disable-GitHubRepositoryVulnerabilityAlert.ps1 index 5064f3c88..48cb2e2d5 100644 --- a/src/functions/public/Repositories/Repositories/Disable-GitHubRepositoryVulnerabilityAlert.ps1 +++ b/src/functions/public/Repositories/Repositories/Disable-GitHubRepositoryVulnerabilityAlert.ps1 @@ -16,6 +16,7 @@ .NOTES [Disable vulnerability alerts](https://docs.github.com/rest/repos/repos#disable-vulnerability-alerts) #> + #SkipTest:FunctionTest:Will add a test for this function in a future PR [CmdletBinding(SupportsShouldProcess)] [Alias('Disable-GitHubRepositoryVulnerabilityAlerts')] param( diff --git a/src/functions/public/Repositories/Repositories/Enable-GitHubRepositoryPrivateVulnerabilityReporting.ps1 b/src/functions/public/Repositories/Repositories/Enable-GitHubRepositoryPrivateVulnerabilityReporting.ps1 index b5b8da905..1054d704d 100644 --- a/src/functions/public/Repositories/Repositories/Enable-GitHubRepositoryPrivateVulnerabilityReporting.ps1 +++ b/src/functions/public/Repositories/Repositories/Enable-GitHubRepositoryPrivateVulnerabilityReporting.ps1 @@ -15,8 +15,8 @@ .NOTES [Enable private vulnerability reporting for a repository](https://docs.github.com/rest/repos/repos#enable-private-vulnerability-reporting-for-a-repository) - #> + #SkipTest:FunctionTest:Will add a test for this function in a future PR [CmdletBinding(SupportsShouldProcess)] [Diagnostics.CodeAnalysis.SuppressMessageAttribute('PSAvoidLongLines', '', Justification = 'Long links')] param( diff --git a/src/functions/public/Repositories/Repositories/Enable-GitHubRepositorySecurityFix.ps1 b/src/functions/public/Repositories/Repositories/Enable-GitHubRepositorySecurityFix.ps1 index 9d19d7e56..1803fafa0 100644 --- a/src/functions/public/Repositories/Repositories/Enable-GitHubRepositorySecurityFix.ps1 +++ b/src/functions/public/Repositories/Repositories/Enable-GitHubRepositorySecurityFix.ps1 @@ -15,8 +15,8 @@ .NOTES [Enable automated security fixes](https://docs.github.com/rest/repos/repos#enable-automated-security-fixes) - #> + #SkipTest:FunctionTest:Will add a test for this function in a future PR [CmdletBinding(SupportsShouldProcess)] [Alias('Enable-GitHubRepositorySecurityFixes')] param( diff --git a/src/functions/public/Repositories/Repositories/Enable-GitHubRepositoryVulnerabilityAlert.ps1 b/src/functions/public/Repositories/Repositories/Enable-GitHubRepositoryVulnerabilityAlert.ps1 index eb5f09edc..0d82bd718 100644 --- a/src/functions/public/Repositories/Repositories/Enable-GitHubRepositoryVulnerabilityAlert.ps1 +++ b/src/functions/public/Repositories/Repositories/Enable-GitHubRepositoryVulnerabilityAlert.ps1 @@ -17,6 +17,7 @@ .NOTES [Enable vulnerability alerts](https://docs.github.com/rest/repos/repos#enable-vulnerability-alerts) #> + #SkipTest:FunctionTest:Will add a test for this function in a future PR [CmdletBinding(SupportsShouldProcess)] [Alias('Enable-GitHubRepositoryVulnerabilityAlerts')] param( diff --git a/src/functions/public/Repositories/Repositories/Get-GitHubRepository.ps1 b/src/functions/public/Repositories/Repositories/Get-GitHubRepository.ps1 index a9244278d..05d156de3 100644 --- a/src/functions/public/Repositories/Repositories/Get-GitHubRepository.ps1 +++ b/src/functions/public/Repositories/Repositories/Get-GitHubRepository.ps1 @@ -48,6 +48,7 @@ filter Get-GitHubRepository { [List organization repositories](https://docs.github.com/rest/repos/repos#list-organization-repositories) [List repositories for a user](https://docs.github.com/rest/repos/repos#list-repositories-for-a-user) #> + #SkipTest:FunctionTest:Will add a test for this function in a future PR [CmdletBinding(DefaultParameterSetName = 'MyRepos_Type')] param( #Limit results to repositories with the specified visibility. diff --git a/src/functions/public/Repositories/Repositories/Get-GitHubRepositoryActivity.ps1 b/src/functions/public/Repositories/Repositories/Get-GitHubRepositoryActivity.ps1 index 4c4bea32f..793aaf449 100644 --- a/src/functions/public/Repositories/Repositories/Get-GitHubRepositoryActivity.ps1 +++ b/src/functions/public/Repositories/Repositories/Get-GitHubRepositoryActivity.ps1 @@ -47,8 +47,8 @@ .NOTES [List repository activities](https://docs.github.com/rest/repos/repos#list-repository-activities) - #> + #SkipTest:FunctionTest:Will add a test for this function in a future PR [CmdletBinding()] param( # The account owner of the repository. The name is not case sensitive. diff --git a/src/functions/public/Repositories/Repositories/Get-GitHubRepositoryCodeownersError.ps1 b/src/functions/public/Repositories/Repositories/Get-GitHubRepositoryCodeownersError.ps1 index 32c70da1d..6c341ee00 100644 --- a/src/functions/public/Repositories/Repositories/Get-GitHubRepositoryCodeownersError.ps1 +++ b/src/functions/public/Repositories/Repositories/Get-GitHubRepositoryCodeownersError.ps1 @@ -16,8 +16,8 @@ .NOTES [List CODEOWNERS errors](https://docs.github.com/rest/repos/repos#list-codeowners-errors) - #> + #SkipTest:FunctionTest:Will add a test for this function in a future PR [CmdletBinding()] [Diagnostics.CodeAnalysis.SuppressMessageAttribute('PSAvoidLongLines', '', Justification = 'Contains a long link.')] param( diff --git a/src/functions/public/Repositories/Repositories/Get-GitHubRepositoryContributor.ps1 b/src/functions/public/Repositories/Repositories/Get-GitHubRepositoryContributor.ps1 index ce84b00ca..57566b925 100644 --- a/src/functions/public/Repositories/Repositories/Get-GitHubRepositoryContributor.ps1 +++ b/src/functions/public/Repositories/Repositories/Get-GitHubRepositoryContributor.ps1 @@ -18,8 +18,8 @@ .NOTES [List repository contributors](https://docs.github.com/rest/repos/repos#list-repository-contributors) - #> + #SkipTest:FunctionTest:Will add a test for this function in a future PR [CmdletBinding()] param( # The account owner of the repository. The name is not case sensitive. diff --git a/src/functions/public/Repositories/Repositories/Get-GitHubRepositoryFork.ps1 b/src/functions/public/Repositories/Repositories/Get-GitHubRepositoryFork.ps1 index d2bf79142..cd5bff02e 100644 --- a/src/functions/public/Repositories/Repositories/Get-GitHubRepositoryFork.ps1 +++ b/src/functions/public/Repositories/Repositories/Get-GitHubRepositoryFork.ps1 @@ -13,8 +13,8 @@ .NOTES [List forks](https://docs.github.com/rest/repos/forks#list-forks) - #> + #SkipTest:FunctionTest:Will add a test for this function in a future PR [CmdletBinding()] param( # The account owner of the repository. The name is not case sensitive. diff --git a/src/functions/public/Repositories/Repositories/Get-GitHubRepositoryLanguage.ps1 b/src/functions/public/Repositories/Repositories/Get-GitHubRepositoryLanguage.ps1 index 82a6c7fae..94cd52eac 100644 --- a/src/functions/public/Repositories/Repositories/Get-GitHubRepositoryLanguage.ps1 +++ b/src/functions/public/Repositories/Repositories/Get-GitHubRepositoryLanguage.ps1 @@ -14,8 +14,8 @@ .NOTES [List repository languages](https://docs.github.com/rest/repos/repos#list-repository-languages) - #> + #SkipTest:FunctionTest:Will add a test for this function in a future PR [CmdletBinding()] [Alias('Get-GitHubRepositoryLanguages')] param( diff --git a/src/functions/public/Repositories/Repositories/Get-GitHubRepositorySecurityFix.ps1 b/src/functions/public/Repositories/Repositories/Get-GitHubRepositorySecurityFix.ps1 index ae1b1c0fa..90c4b169c 100644 --- a/src/functions/public/Repositories/Repositories/Get-GitHubRepositorySecurityFix.ps1 +++ b/src/functions/public/Repositories/Repositories/Get-GitHubRepositorySecurityFix.ps1 @@ -15,8 +15,8 @@ .NOTES [Check if automated security fixes are enabled for a repository](https://docs.github.com/rest/repos/repos#check-if-automated-security-fixes-are-enabled-for-a-repository) - #> + #SkipTest:FunctionTest:Will add a test for this function in a future PR [Alias('Get-GitHubRepoSecurityFixes')] [CmdletBinding()] [Diagnostics.CodeAnalysis.SuppressMessageAttribute('PSAvoidLongLines', '', Justification = 'Contains a long link.')] diff --git a/src/functions/public/Repositories/Repositories/Get-GitHubRepositoryTag.ps1 b/src/functions/public/Repositories/Repositories/Get-GitHubRepositoryTag.ps1 index bf10c8c02..3645515f8 100644 --- a/src/functions/public/Repositories/Repositories/Get-GitHubRepositoryTag.ps1 +++ b/src/functions/public/Repositories/Repositories/Get-GitHubRepositoryTag.ps1 @@ -13,8 +13,8 @@ .NOTES [List repository tags](https://docs.github.com/rest/repos/repos#list-repository-tags) - #> + #SkipTest:FunctionTest:Will add a test for this function in a future PR [CmdletBinding()] [Alias('Get-GitHubRepositoryTags')] param( diff --git a/src/functions/public/Repositories/Repositories/Get-GitHubRepositoryTeam.ps1 b/src/functions/public/Repositories/Repositories/Get-GitHubRepositoryTeam.ps1 index 4e13bcced..56c3df720 100644 --- a/src/functions/public/Repositories/Repositories/Get-GitHubRepositoryTeam.ps1 +++ b/src/functions/public/Repositories/Repositories/Get-GitHubRepositoryTeam.ps1 @@ -21,8 +21,8 @@ .NOTES [List repository teams](https://docs.github.com/rest/repos/repos#list-repository-teams) - #> + #SkipTest:FunctionTest:Will add a test for this function in a future PR [CmdletBinding()] [Alias('Get-GitHubRepositoryTeams')] param( diff --git a/src/functions/public/Repositories/Repositories/Get-GitHubRepositoryTopic.ps1 b/src/functions/public/Repositories/Repositories/Get-GitHubRepositoryTopic.ps1 index ee17bf3be..75c001cfe 100644 --- a/src/functions/public/Repositories/Repositories/Get-GitHubRepositoryTopic.ps1 +++ b/src/functions/public/Repositories/Repositories/Get-GitHubRepositoryTopic.ps1 @@ -10,8 +10,8 @@ .NOTES [Get all repository topics](https://docs.github.com/rest/repos/repos#get-all-repository-topics) - #> + #SkipTest:FunctionTest:Will add a test for this function in a future PR [CmdletBinding()] param( # The account owner of the repository. The name is not case sensitive. diff --git a/src/functions/public/Repositories/Repositories/Move-GitHubRepository.ps1 b/src/functions/public/Repositories/Repositories/Move-GitHubRepository.ps1 index a50313744..63e50560d 100644 --- a/src/functions/public/Repositories/Repositories/Move-GitHubRepository.ps1 +++ b/src/functions/public/Repositories/Repositories/Move-GitHubRepository.ps1 @@ -18,8 +18,8 @@ .NOTES [Transfer a repository](https://docs.github.com/rest/repos/repos#transfer-a-repository) - #> + #SkipTest:FunctionTest:Will add a test for this function in a future PR [CmdletBinding()] param( # The account owner of the repository. The name is not case sensitive. diff --git a/src/functions/public/Repositories/Repositories/New-GitHubRepository.ps1 b/src/functions/public/Repositories/Repositories/New-GitHubRepository.ps1 index 22321f992..89b42fc16 100644 --- a/src/functions/public/Repositories/Repositories/New-GitHubRepository.ps1 +++ b/src/functions/public/Repositories/Repositories/New-GitHubRepository.ps1 @@ -15,7 +15,6 @@ filter New-GitHubRepository { * `public_repo` scope or `repo` scope to create a public repository. Note: For GitHub AE, use `repo` scope to create an internal repository. * `repo` scope to create a private repository - .EXAMPLE $params = @{ Name = 'Hello-World' @@ -101,8 +100,8 @@ filter New-GitHubRepository { .NOTES [Create a repository for the authenticated user](https://docs.github.com/rest/repos/repos#create-a-repository-for-the-authenticated-user) [Create an organization repository](https://docs.github.com/rest/repos/repos#create-an-organization-repository) - #> + #SkipTest:FunctionTest:Will add a test for this function in a future PR [OutputType([pscustomobject])] [CmdletBinding( SupportsShouldProcess, diff --git a/src/functions/public/Repositories/Repositories/Remove-GitHubRepository.ps1 b/src/functions/public/Repositories/Repositories/Remove-GitHubRepository.ps1 index c04cf4f96..54a61b0f4 100644 --- a/src/functions/public/Repositories/Repositories/Remove-GitHubRepository.ps1 +++ b/src/functions/public/Repositories/Repositories/Remove-GitHubRepository.ps1 @@ -17,6 +17,7 @@ .NOTES [Delete a repository](https://docs.github.com/rest/repos/repos#delete-a-repository) #> + #SkipTest:FunctionTest:Will add a test for this function in a future PR #TODO: Set high impact [CmdletBinding(SupportsShouldProcess)] param( diff --git a/src/functions/public/Repositories/Repositories/Set-GitHubRepositoryTopic.ps1 b/src/functions/public/Repositories/Repositories/Set-GitHubRepositoryTopic.ps1 index ef4b0a14f..ebaa8d9da 100644 --- a/src/functions/public/Repositories/Repositories/Set-GitHubRepositoryTopic.ps1 +++ b/src/functions/public/Repositories/Repositories/Set-GitHubRepositoryTopic.ps1 @@ -14,6 +14,7 @@ .NOTES [Replace all repository topics](https://docs.github.com/rest/repos/repos#replace-all-repository-topics) #> + #SkipTest:FunctionTest:Will add a test for this function in a future PR [CmdletBinding(SupportsShouldProcess)] param( # The account owner of the repository. The name is not case sensitive. diff --git a/src/functions/public/Repositories/Repositories/Start-GitHubRepositoryEvent.ps1 b/src/functions/public/Repositories/Repositories/Start-GitHubRepositoryEvent.ps1 index e16d39a1e..664952834 100644 --- a/src/functions/public/Repositories/Repositories/Start-GitHubRepositoryEvent.ps1 +++ b/src/functions/public/Repositories/Repositories/Start-GitHubRepositoryEvent.ps1 @@ -38,8 +38,8 @@ .NOTES [Create a repository dispatch event](https://docs.github.com/rest/repos/repos#create-a-repository-dispatch-event) - #> + #SkipTest:FunctionTest:Will add a test for this function in a future PR [CmdletBinding(SupportsShouldProcess)] [Diagnostics.CodeAnalysis.SuppressMessageAttribute('PSAvoidLongLines', '', Justification = 'Long links')] param( diff --git a/src/functions/public/Repositories/Repositories/Test-GitHubRepositoryVulnerabilityAlert.ps1 b/src/functions/public/Repositories/Repositories/Test-GitHubRepositoryVulnerabilityAlert.ps1 index 9a2af0ec3..49ac153c5 100644 --- a/src/functions/public/Repositories/Repositories/Test-GitHubRepositoryVulnerabilityAlert.ps1 +++ b/src/functions/public/Repositories/Repositories/Test-GitHubRepositoryVulnerabilityAlert.ps1 @@ -17,6 +17,7 @@ .NOTES [Check if vulnerability alerts are enabled for a repository](https://docs.github.com/rest/repos/repos#list-repository-tags) #> + #SkipTest:FunctionTest:Will add a test for this function in a future PR [OutputType([bool])] [CmdletBinding()] [Alias('Test-GitHubRepositoryVulnerabilityAlerts')] diff --git a/src/functions/public/Repositories/Repositories/Update-GitHubRepository.ps1 b/src/functions/public/Repositories/Repositories/Update-GitHubRepository.ps1 index e50193f98..99af0b21b 100644 --- a/src/functions/public/Repositories/Repositories/Update-GitHubRepository.ps1 +++ b/src/functions/public/Repositories/Repositories/Update-GitHubRepository.ps1 @@ -23,6 +23,7 @@ .NOTES [Update a repository](https://docs.github.com/rest/repos/repos#update-a-repository) #> + #SkipTest:FunctionTest:Will add a test for this function in a future PR [CmdletBinding(SupportsShouldProcess)] param( # The account owner of the repository. The name is not case sensitive. diff --git a/src/functions/public/Repositories/RuleSuite/Get-GitHubRepositoryRuleSuite.ps1 b/src/functions/public/Repositories/RuleSuite/Get-GitHubRepositoryRuleSuite.ps1 index 5964f3248..306739612 100644 --- a/src/functions/public/Repositories/RuleSuite/Get-GitHubRepositoryRuleSuite.ps1 +++ b/src/functions/public/Repositories/RuleSuite/Get-GitHubRepositoryRuleSuite.ps1 @@ -30,6 +30,7 @@ [List repository rule suites](https://docs.github.com/rest/repos/rule-suites#list-repository-rule-suites) [Get a repository rule suite](https://docs.github.com/rest/repos/rule-suites#get-a-repository-rule-suite) #> + #SkipTest:FunctionTest:Will add a test for this function in a future PR [OutputType([pscustomobject])] [Diagnostics.CodeAnalysis.SuppressMessageAttribute('PSAvoidLongLines', '', Justification = 'Long links')] [CmdletBinding(DefaultParameterSetName = 'Default')] diff --git a/src/functions/public/Repositories/RuleSuite/Get-GitHubRepositoryRuleSuiteById.ps1 b/src/functions/public/Repositories/RuleSuite/Get-GitHubRepositoryRuleSuiteById.ps1 index 548c94efb..ff1c4f3a3 100644 --- a/src/functions/public/Repositories/RuleSuite/Get-GitHubRepositoryRuleSuiteById.ps1 +++ b/src/functions/public/Repositories/RuleSuite/Get-GitHubRepositoryRuleSuiteById.ps1 @@ -15,6 +15,7 @@ .NOTES [Get a repository rule suite](https://docs.github.com/rest/repos/rule-suites#get-a-repository-rule-suite) #> + #SkipTest:FunctionTest:Will add a test for this function in a future PR [OutputType([pscustomobject])] [Diagnostics.CodeAnalysis.SuppressMessageAttribute('PSAvoidLongLines', '', Justification = 'Long links')] [CmdletBinding()] diff --git a/src/functions/public/Repositories/RuleSuite/Get-GitHubRepositoryRuleSuiteList.ps1 b/src/functions/public/Repositories/RuleSuite/Get-GitHubRepositoryRuleSuiteList.ps1 index 29c6cf3a0..2afb189cf 100644 --- a/src/functions/public/Repositories/RuleSuite/Get-GitHubRepositoryRuleSuiteList.ps1 +++ b/src/functions/public/Repositories/RuleSuite/Get-GitHubRepositoryRuleSuiteList.ps1 @@ -22,8 +22,8 @@ .NOTES [List repository rule suites](https://docs.github.com/rest/repos/rule-suites#list-repository-rule-suites) - #> + #SkipTest:FunctionTest:Will add a test for this function in a future PR [OutputType([pscustomobject])] [Diagnostics.CodeAnalysis.SuppressMessageAttribute('PSAvoidLongLines', '', Justification = 'Long links')] [CmdletBinding()] diff --git a/src/functions/public/Repositories/Tags/Get-GitHubRepositoryTagProtection.ps1 b/src/functions/public/Repositories/Tags/Get-GitHubRepositoryTagProtection.ps1 index 29c5ef886..f5ce24ba3 100644 --- a/src/functions/public/Repositories/Tags/Get-GitHubRepositoryTagProtection.ps1 +++ b/src/functions/public/Repositories/Tags/Get-GitHubRepositoryTagProtection.ps1 @@ -15,8 +15,8 @@ .NOTES [List tag protection states for a repository](https://docs.github.com/rest/repos/tags#list-tag-protection-states-for-a-repository) - #> + #SkipTest:FunctionTest:Will add a test for this function in a future PR [OutputType([pscustomobject])] [CmdletBinding()] param( diff --git a/src/functions/public/Repositories/Tags/New-GitHubRepositoryTagProtection.ps1 b/src/functions/public/Repositories/Tags/New-GitHubRepositoryTagProtection.ps1 index ab3a1fcef..5c144678c 100644 --- a/src/functions/public/Repositories/Tags/New-GitHubRepositoryTagProtection.ps1 +++ b/src/functions/public/Repositories/Tags/New-GitHubRepositoryTagProtection.ps1 @@ -15,6 +15,7 @@ .NOTES [Create a tag protection state for a repository](https://docs.github.com/rest/repos/tags#create-a-tag-protection-state-for-a-repository) #> + #SkipTest:FunctionTest:Will add a test for this function in a future PR [OutputType([pscustomobject])] [CmdletBinding(SupportsShouldProcess)] param( diff --git a/src/functions/public/Repositories/Tags/Remove-GitHubRepositoryTagProtection.ps1 b/src/functions/public/Repositories/Tags/Remove-GitHubRepositoryTagProtection.ps1 index 94bb00ec5..3b59df9c3 100644 --- a/src/functions/public/Repositories/Tags/Remove-GitHubRepositoryTagProtection.ps1 +++ b/src/functions/public/Repositories/Tags/Remove-GitHubRepositoryTagProtection.ps1 @@ -14,8 +14,8 @@ .NOTES [Delete a tag protection state for a repository](https://docs.github.com/rest/repos/tags#delete-a-tag-protection-state-for-a-repository) - #> + #SkipTest:FunctionTest:Will add a test for this function in a future PR [OutputType([pscustomobject])] [CmdletBinding(SupportsShouldProcess)] param( diff --git a/src/functions/public/Teams/Get-GitHubTeam.ps1 b/src/functions/public/Teams/Get-GitHubTeam.ps1 index 37b7347a8..55db7e43f 100644 --- a/src/functions/public/Teams/Get-GitHubTeam.ps1 +++ b/src/functions/public/Teams/Get-GitHubTeam.ps1 @@ -18,6 +18,7 @@ Gets the team with the slug 'my-team-name' in the `github` organization. #> + #SkipTest:FunctionTest:Will add a test for this function in a future PR [OutputType([GitHubTeam])] [CmdletBinding(DefaultParameterSetName = '__AllParameterSets')] param( diff --git a/src/functions/public/Teams/New-GitHubTeam.ps1 b/src/functions/public/Teams/New-GitHubTeam.ps1 index 8ec457a84..87224bb86 100644 --- a/src/functions/public/Teams/New-GitHubTeam.ps1 +++ b/src/functions/public/Teams/New-GitHubTeam.ps1 @@ -27,6 +27,7 @@ .NOTES [Create a team](https://docs.github.com/rest/teams/teams#create-a-team) #> + #SkipTest:FunctionTest:Will add a test for this function in a future PR [OutputType([GitHubTeam])] [CmdletBinding(SupportsShouldProcess)] param( diff --git a/src/functions/public/Teams/Remove-GitHubTeam.ps1 b/src/functions/public/Teams/Remove-GitHubTeam.ps1 index 389b1fd42..a9853ca8b 100644 --- a/src/functions/public/Teams/Remove-GitHubTeam.ps1 +++ b/src/functions/public/Teams/Remove-GitHubTeam.ps1 @@ -13,6 +13,7 @@ .NOTES [Delete a team](https://docs.github.com/en/rest/teams/teams?apiVersion=2022-11-28#delete-a-team) #> + #SkipTest:FunctionTest:Will add a test for this function in a future PR [OutputType([void])] [CmdletBinding(SupportsShouldProcess)] param( diff --git a/src/functions/public/Teams/Update-GitHubTeam.ps1 b/src/functions/public/Teams/Update-GitHubTeam.ps1 index 7a43dcfc4..767c44d3a 100644 --- a/src/functions/public/Teams/Update-GitHubTeam.ps1 +++ b/src/functions/public/Teams/Update-GitHubTeam.ps1 @@ -25,6 +25,7 @@ .NOTES [Update a team](https://docs.github.com/en/rest/teams/teams?apiVersion=2022-11-28#update-a-team) #> + #SkipTest:FunctionTest:Will add a test for this function in a future PR [OutputType([GitHubTeam])] [CmdletBinding(SupportsShouldProcess)] param( diff --git a/src/functions/public/Users/Blocking/Block-GitHubUser.ps1 b/src/functions/public/Users/Blocking/Block-GitHubUser.ps1 index 8a5eb8455..2bcd5186a 100644 --- a/src/functions/public/Users/Blocking/Block-GitHubUser.ps1 +++ b/src/functions/public/Users/Blocking/Block-GitHubUser.ps1 @@ -23,6 +23,7 @@ [Block a user](https://docs.github.com/rest/users/blocking#block-a-user) [Block a user from an organization](https://docs.github.com/rest/orgs/blocking#block-a-user-from-an-organization) #> + #SkipTest:FunctionTest:Will add a test for this function in a future PR [OutputType([bool])] [CmdletBinding(DefaultParameterSetName = '__AllParameterSets')] param( diff --git a/src/functions/public/Users/Blocking/Get-GitHubBlockedUser.ps1 b/src/functions/public/Users/Blocking/Get-GitHubBlockedUser.ps1 index b375ab44b..8cc0dde2d 100644 --- a/src/functions/public/Users/Blocking/Get-GitHubBlockedUser.ps1 +++ b/src/functions/public/Users/Blocking/Get-GitHubBlockedUser.ps1 @@ -20,6 +20,7 @@ [List users blocked by the authenticated user](https://docs.github.com/rest/users/blocking#list-users-blocked-by-the-authenticated-user) [List users blocked by an organization](https://docs.github.com/rest/orgs/blocking#list-users-blocked-by-an-organization) #> + #SkipTest:FunctionTest:Will add a test for this function in a future PR [OutputType([pscustomobject])] [CmdletBinding()] param( diff --git a/src/functions/public/Users/Blocking/Test-GitHubBlockedUser.ps1 b/src/functions/public/Users/Blocking/Test-GitHubBlockedUser.ps1 index cf829991f..2e575f408 100644 --- a/src/functions/public/Users/Blocking/Test-GitHubBlockedUser.ps1 +++ b/src/functions/public/Users/Blocking/Test-GitHubBlockedUser.ps1 @@ -23,6 +23,7 @@ [Check if a user is blocked by the authenticated user](https://docs.github.com/rest/users/blocking#check-if-a-user-is-blocked-by-the-authenticated-user) [Check if a user is blocked by an organization](https://docs.github.com/rest/orgs/blocking#check-if-a-user-is-blocked-by-an-organization) #> + #SkipTest:FunctionTest:Will add a test for this function in a future PR [OutputType([bool])] [Diagnostics.CodeAnalysis.SuppressMessageAttribute('PSAvoidLongLines', '', Justification = 'Contains a long link.')] [CmdletBinding()] diff --git a/src/functions/public/Users/Blocking/Unblock-GitHubUser.ps1 b/src/functions/public/Users/Blocking/Unblock-GitHubUser.ps1 index 38b54124b..563cd550f 100644 --- a/src/functions/public/Users/Blocking/Unblock-GitHubUser.ps1 +++ b/src/functions/public/Users/Blocking/Unblock-GitHubUser.ps1 @@ -22,6 +22,7 @@ [Unblock a user](https://docs.github.com/rest/users/blocking#unblock-a-user) [Unblock a user from an organization](https://docs.github.com/rest/orgs/blocking#unblock-a-user-from-an-organization) #> + #SkipTest:FunctionTest:Will add a test for this function in a future PR [OutputType([bool])] [CmdletBinding()] param( diff --git a/src/functions/public/Users/Emails/Add-GitHubUserEmail.ps1 b/src/functions/public/Users/Emails/Add-GitHubUserEmail.ps1 index 04609a71f..35acd71b9 100644 --- a/src/functions/public/Users/Emails/Add-GitHubUserEmail.ps1 +++ b/src/functions/public/Users/Emails/Add-GitHubUserEmail.ps1 @@ -13,8 +13,8 @@ .NOTES [Add an email address for the authenticated user](https://docs.github.com/rest/users/emails#add-an-email-address-for-the-authenticated-user) - #> + #SkipTest:FunctionTest:Will add a test for this function in a future PR [OutputType([pscustomobject])] [CmdletBinding()] param( diff --git a/src/functions/public/Users/Emails/Get-GitHubUserEmail.ps1 b/src/functions/public/Users/Emails/Get-GitHubUserEmail.ps1 index fa10cebc1..29400d72b 100644 --- a/src/functions/public/Users/Emails/Get-GitHubUserEmail.ps1 +++ b/src/functions/public/Users/Emails/Get-GitHubUserEmail.ps1 @@ -21,8 +21,8 @@ .NOTES [List email addresses for the authenticated user](https://docs.github.com/rest/users/emails#list-email-addresses-for-the-authenticated-user) [List public email addresses for the authenticated user](https://docs.github.com/en/rest/users/emails#list-public-email-addresses-for-the-authenticated-user) - #> + #SkipTest:FunctionTest:Will add a test for this function in a future PR [OutputType([pscustomobject])] [Diagnostics.CodeAnalysis.SuppressMessageAttribute('PSAvoidLongLines', '', Justification = 'Contains a long link.')] [CmdletBinding()] diff --git a/src/functions/public/Users/Emails/Remove-GitHubUserEmail.ps1 b/src/functions/public/Users/Emails/Remove-GitHubUserEmail.ps1 index c08841752..66afec31a 100644 --- a/src/functions/public/Users/Emails/Remove-GitHubUserEmail.ps1 +++ b/src/functions/public/Users/Emails/Remove-GitHubUserEmail.ps1 @@ -13,8 +13,8 @@ .NOTES [Delete an email address for the authenticated user](https://docs.github.com/rest/users/emails#delete-an-email-address-for-the-authenticated-user) - #> + #SkipTest:FunctionTest:Will add a test for this function in a future PR [OutputType([pscustomobject])] [Diagnostics.CodeAnalysis.SuppressMessageAttribute('PSAvoidLongLines', '', Justification = 'Contains a long link.')] [CmdletBinding(SupportsShouldProcess)] diff --git a/src/functions/public/Users/Emails/Set-GitHubUserEmailVisibility.ps1 b/src/functions/public/Users/Emails/Set-GitHubUserEmailVisibility.ps1 index 24a61cc41..1ed7a68be 100644 --- a/src/functions/public/Users/Emails/Set-GitHubUserEmailVisibility.ps1 +++ b/src/functions/public/Users/Emails/Set-GitHubUserEmailVisibility.ps1 @@ -18,8 +18,8 @@ .NOTES [Set primary email visibility for the authenticated user](https://docs.github.com/rest/users/emails#set-primary-email-visibility-for-the-authenticated-user) - #> + #SkipTest:FunctionTest:Will add a test for this function in a future PR [OutputType([pscustomobject])] [Diagnostics.CodeAnalysis.SuppressMessageAttribute('PSAvoidLongLines', '', Justification = 'Contains a long link.')] [CmdletBinding(SupportsShouldProcess)] diff --git a/src/functions/public/Users/Followers/Add-GitHubUserFollowing.ps1 b/src/functions/public/Users/Followers/Add-GitHubUserFollowing.ps1 index af172ed27..f1bb06f04 100644 --- a/src/functions/public/Users/Followers/Add-GitHubUserFollowing.ps1 +++ b/src/functions/public/Users/Followers/Add-GitHubUserFollowing.ps1 @@ -15,8 +15,8 @@ .NOTES [Follow a user](https://docs.github.com/rest/users/followers#follow-a-user) - #> + #SkipTest:FunctionTest:Will add a test for this function in a future PR [OutputType([pscustomobject])] [Alias('Follow-GitHubUser')] [CmdletBinding()] diff --git a/src/functions/public/Users/Followers/Get-GitHubUserFollower.ps1 b/src/functions/public/Users/Followers/Get-GitHubUserFollower.ps1 index eb2be94b5..c4329e9cf 100644 --- a/src/functions/public/Users/Followers/Get-GitHubUserFollower.ps1 +++ b/src/functions/public/Users/Followers/Get-GitHubUserFollower.ps1 @@ -19,6 +19,7 @@ .NOTES [List followers of the authenticated user](https://docs.github.com/rest/users/followers#list-followers-of-the-authenticated-user) #> + #SkipTest:FunctionTest:Will add a test for this function in a future PR [OutputType([pscustomobject])] [Alias('Get-GitHubUserMyFollowers')] [CmdletBinding()] diff --git a/src/functions/public/Users/Followers/Get-GitHubUserFollowing.ps1 b/src/functions/public/Users/Followers/Get-GitHubUserFollowing.ps1 index ba26966f4..4e0983bfd 100644 --- a/src/functions/public/Users/Followers/Get-GitHubUserFollowing.ps1 +++ b/src/functions/public/Users/Followers/Get-GitHubUserFollowing.ps1 @@ -19,8 +19,8 @@ .NOTES [List the people the authenticated user follows](https://docs.github.com/rest/users/followers#list-the-people-the-authenticated-user-follows) [List the people a user follows](https://docs.github.com/rest/users/followers#list-the-people-a-user-follows) - #> + #SkipTest:FunctionTest:Will add a test for this function in a future PR [OutputType([pscustomobject])] [CmdletBinding()] param( diff --git a/src/functions/public/Users/Followers/Remove-GitHubUserFollowing.ps1 b/src/functions/public/Users/Followers/Remove-GitHubUserFollowing.ps1 index da2bd615d..2cc6ad31f 100644 --- a/src/functions/public/Users/Followers/Remove-GitHubUserFollowing.ps1 +++ b/src/functions/public/Users/Followers/Remove-GitHubUserFollowing.ps1 @@ -14,6 +14,7 @@ .NOTES [Unfollow a user](https://docs.github.com/rest/users/followers#unfollow-a-user) #> + #SkipTest:FunctionTest:Will add a test for this function in a future PR [OutputType([pscustomobject])] [Alias('Unfollow-GitHubUser')] [CmdletBinding(SupportsShouldProcess)] diff --git a/src/functions/public/Users/Followers/Test-GitHubUserFollowing.ps1 b/src/functions/public/Users/Followers/Test-GitHubUserFollowing.ps1 index 062ada39a..1490de496 100644 --- a/src/functions/public/Users/Followers/Test-GitHubUserFollowing.ps1 +++ b/src/functions/public/Users/Followers/Test-GitHubUserFollowing.ps1 @@ -21,8 +21,8 @@ .NOTES [Check if a person is followed by the authenticated user](https://docs.github.com/rest/users/followers#check-if-a-person-is-followed-by-the-authenticated-user) [Check if a user follows another user](https://docs.github.com/rest/users/followers#check-if-a-user-follows-another-user) - #> + #SkipTest:FunctionTest:Will add a test for this function in a future PR [OutputType([bool])] [Diagnostics.CodeAnalysis.SuppressMessageAttribute('PSAvoidLongLines', '', Justification = 'Contains a long link.')] [Alias('Test-GitHubUserFollows')] diff --git a/src/functions/public/Users/GPG-Keys/Add-GitHubUserGpgKey.ps1 b/src/functions/public/Users/GPG-Keys/Add-GitHubUserGpgKey.ps1 index a24cb9b5b..6fc6413fb 100644 --- a/src/functions/public/Users/GPG-Keys/Add-GitHubUserGpgKey.ps1 +++ b/src/functions/public/Users/GPG-Keys/Add-GitHubUserGpgKey.ps1 @@ -21,8 +21,8 @@ .NOTES [Create a GPG key for the authenticated user](https://docs.github.com/rest/users/gpg-keys#create-a-gpg-key-for-the-authenticated-user) - #> + #SkipTest:FunctionTest:Will add a test for this function in a future PR [OutputType([pscustomobject])] [CmdletBinding()] param( diff --git a/src/functions/public/Users/GPG-Keys/Get-GitHubUserGpgKey.ps1 b/src/functions/public/Users/GPG-Keys/Get-GitHubUserGpgKey.ps1 index 415e77140..ab08fa5d8 100644 --- a/src/functions/public/Users/GPG-Keys/Get-GitHubUserGpgKey.ps1 +++ b/src/functions/public/Users/GPG-Keys/Get-GitHubUserGpgKey.ps1 @@ -23,8 +23,8 @@ .NOTES [List GPG keys for the authenticated user](https://docs.github.com/rest/users/gpg-keys#list-gpg-keys-for-the-authenticated-user) - #> + #SkipTest:FunctionTest:Will add a test for this function in a future PR [OutputType([pscustomobject])] [CmdletBinding()] param( diff --git a/src/functions/public/Users/GPG-Keys/Remove-GitHubUserGpgKey.ps1 b/src/functions/public/Users/GPG-Keys/Remove-GitHubUserGpgKey.ps1 index 1f6e7d517..423d92499 100644 --- a/src/functions/public/Users/GPG-Keys/Remove-GitHubUserGpgKey.ps1 +++ b/src/functions/public/Users/GPG-Keys/Remove-GitHubUserGpgKey.ps1 @@ -15,8 +15,8 @@ .NOTES [Delete a GPG key for the authenticated user](https://docs.github.com/rest/users/gpg-keys#delete-a-gpg-key-for-the-authenticated-user) - #> + #SkipTest:FunctionTest:Will add a test for this function in a future PR [OutputType([pscustomobject])] [CmdletBinding(SupportsShouldProcess)] param( diff --git a/src/functions/public/Users/Get-GitHubUser.ps1 b/src/functions/public/Users/Get-GitHubUser.ps1 index e72406f47..89de4f409 100644 --- a/src/functions/public/Users/Get-GitHubUser.ps1 +++ b/src/functions/public/Users/Get-GitHubUser.ps1 @@ -26,6 +26,7 @@ .NOTES [Get the authenticated user](https://docs.github.com/rest/users/users) #> + #SkipTest:FunctionTest:Will add a test for this function in a future PR [OutputType([pscustomobject])] [Diagnostics.CodeAnalysis.SuppressMessageAttribute( 'PSReviewUnusedParameter', diff --git a/src/functions/public/Users/Get-GitHubUserCard.ps1 b/src/functions/public/Users/Get-GitHubUserCard.ps1 index 79ae51fba..b921fd79f 100644 --- a/src/functions/public/Users/Get-GitHubUserCard.ps1 +++ b/src/functions/public/Users/Get-GitHubUserCard.ps1 @@ -20,8 +20,8 @@ .NOTES [Get contextual information for a user](https://docs.github.com/rest/users/users#get-contextual-information-for-a-user) - #> + #SkipTest:FunctionTest:Will add a test for this function in a future PR [OutputType([pscustomobject])] [CmdletBinding()] param( diff --git a/src/functions/public/Users/Keys/Add-GitHubUserKey.ps1 b/src/functions/public/Users/Keys/Add-GitHubUserKey.ps1 index dcd9b37f7..51336edb2 100644 --- a/src/functions/public/Users/Keys/Add-GitHubUserKey.ps1 +++ b/src/functions/public/Users/Keys/Add-GitHubUserKey.ps1 @@ -15,8 +15,8 @@ .NOTES [Create a public SSH key for the authenticated user](https://docs.github.com/rest/users/keys#create-a-public-ssh-key-for-the-authenticated-user) - #> + #SkipTest:FunctionTest:Will add a test for this function in a future PR [OutputType([pscustomobject])] [Diagnostics.CodeAnalysis.SuppressMessageAttribute('PSAvoidLongLines', '', Justification = 'Long links for documentation.')] [CmdletBinding()] diff --git a/src/functions/public/Users/Keys/Get-GitHubUserKey.ps1 b/src/functions/public/Users/Keys/Get-GitHubUserKey.ps1 index 04dd5f428..2f7bac5d5 100644 --- a/src/functions/public/Users/Keys/Get-GitHubUserKey.ps1 +++ b/src/functions/public/Users/Keys/Get-GitHubUserKey.ps1 @@ -26,8 +26,8 @@ .NOTES [List GPG keys for the authenticated user](https://docs.github.com/rest/users/gpg-keys#list-gpg-keys-for-the-authenticated-user) - #> + #SkipTest:FunctionTest:Will add a test for this function in a future PR [OutputType([pscustomobject])] [CmdletBinding()] param( diff --git a/src/functions/public/Users/Keys/Remove-GitHubUserKey.ps1 b/src/functions/public/Users/Keys/Remove-GitHubUserKey.ps1 index 6870fcfea..61935b5ee 100644 --- a/src/functions/public/Users/Keys/Remove-GitHubUserKey.ps1 +++ b/src/functions/public/Users/Keys/Remove-GitHubUserKey.ps1 @@ -15,8 +15,8 @@ .NOTES [Delete a public SSH key for the authenticated user](https://docs.github.com/rest/users/keys#delete-a-public-ssh-key-for-the-authenticated-user) - #> + #SkipTest:FunctionTest:Will add a test for this function in a future PR [OutputType([pscustomobject])] [Diagnostics.CodeAnalysis.SuppressMessageAttribute('PSAvoidLongLines', '', Justification = 'Contains a long link.')] [CmdletBinding(SupportsShouldProcess)] diff --git a/src/functions/public/Users/SSH-Signing-Keys/Add-GitHubUserSigningKey.ps1 b/src/functions/public/Users/SSH-Signing-Keys/Add-GitHubUserSigningKey.ps1 index 13815ab36..12ca47c21 100644 --- a/src/functions/public/Users/SSH-Signing-Keys/Add-GitHubUserSigningKey.ps1 +++ b/src/functions/public/Users/SSH-Signing-Keys/Add-GitHubUserSigningKey.ps1 @@ -16,8 +16,8 @@ .NOTES [Create a SSH signing key for the authenticated user](https://docs.github.com/rest/users/ssh-signing-keys#create-a-ssh-signing-key-for-the-authenticated-user) - #> + #SkipTest:FunctionTest:Will add a test for this function in a future PR [Diagnostics.CodeAnalysis.SuppressMessageAttribute('PSAvoidLongLines', '', Justification = 'Long links for documentation.')] [OutputType([pscustomobject])] [CmdletBinding()] diff --git a/src/functions/public/Users/SSH-Signing-Keys/Get-GitHubUserSigningKey.ps1 b/src/functions/public/Users/SSH-Signing-Keys/Get-GitHubUserSigningKey.ps1 index cc1fd2559..03d26ccbc 100644 --- a/src/functions/public/Users/SSH-Signing-Keys/Get-GitHubUserSigningKey.ps1 +++ b/src/functions/public/Users/SSH-Signing-Keys/Get-GitHubUserSigningKey.ps1 @@ -25,8 +25,8 @@ [List SSH signing keys for the authenticated user](https://docs.github.com/rest/users/ssh-signing-keys#list-ssh-signing-keys-for-the-authenticated-user) [Get an SSH signing key for the authenticated user](https://docs.github.com/rest/users/ssh-signing-keys#get-an-ssh-signing-key-for-the-authenticated-user) [List SSH signing keys for a user](https://docs.github.com/rest/users/ssh-signing-keys#list-ssh-signing-keys-for-a-user) - #> + #SkipTest:FunctionTest:Will add a test for this function in a future PR [OutputType([pscustomobject])] [Diagnostics.CodeAnalysis.SuppressMessageAttribute('PSAvoidLongLines', '', Justification = 'Contains a long link.')] [CmdletBinding()] diff --git a/src/functions/public/Users/SSH-Signing-Keys/Remove-GitHubUserSigningKey.ps1 b/src/functions/public/Users/SSH-Signing-Keys/Remove-GitHubUserSigningKey.ps1 index af4aab7bc..e2c78a16b 100644 --- a/src/functions/public/Users/SSH-Signing-Keys/Remove-GitHubUserSigningKey.ps1 +++ b/src/functions/public/Users/SSH-Signing-Keys/Remove-GitHubUserSigningKey.ps1 @@ -16,8 +16,8 @@ .NOTES [Delete an SSH signing key for the authenticated user](https://docs.github.com/rest/users/ssh-signing-keys#delete-an-ssh-signing-key-for-the-authenticated-user) - #> + #SkipTest:FunctionTest:Will add a test for this function in a future PR [OutputType([pscustomobject])] [Diagnostics.CodeAnalysis.SuppressMessageAttribute('PSAvoidLongLines', '', Justification = 'Contains a long link.')] [CmdletBinding(SupportsShouldProcess)] diff --git a/src/functions/public/Users/Set-GitHubUser.ps1 b/src/functions/public/Users/Set-GitHubUser.ps1 index b7c23432e..e12e21700 100644 --- a/src/functions/public/Users/Set-GitHubUser.ps1 +++ b/src/functions/public/Users/Set-GitHubUser.ps1 @@ -26,6 +26,7 @@ .NOTES [Update the authenticated user](https://docs.github.com/rest/users/users#update-the-authenticated-user) #> + #SkipTest:FunctionTest:Will add a test for this function in a future PR [OutputType([void])] [Alias('Update-GitHubUser')] [CmdletBinding(SupportsShouldProcess)] diff --git a/src/functions/public/Users/Social-Accounts/Add-GitHubUserSocial.ps1 b/src/functions/public/Users/Social-Accounts/Add-GitHubUserSocial.ps1 index ebafaa786..14ae17f05 100644 --- a/src/functions/public/Users/Social-Accounts/Add-GitHubUserSocial.ps1 +++ b/src/functions/public/Users/Social-Accounts/Add-GitHubUserSocial.ps1 @@ -14,6 +14,7 @@ .NOTES [Add social accounts for the authenticated user](https://docs.github.com/rest/users/social-accounts#add-social-accounts-for-the-authenticated-user) #> + #SkipTest:FunctionTest:Will add a test for this function in a future PR [OutputType([void])] [Alias('Add-GitHubUserSocials')] [Diagnostics.CodeAnalysis.SuppressMessageAttribute('PSAvoidLongLines', '', Justification = 'Long links for documentation.')] diff --git a/src/functions/public/Users/Social-Accounts/Remove-GitHubUserSocial.ps1 b/src/functions/public/Users/Social-Accounts/Remove-GitHubUserSocial.ps1 index 48bea6493..c142b84ce 100644 --- a/src/functions/public/Users/Social-Accounts/Remove-GitHubUserSocial.ps1 +++ b/src/functions/public/Users/Social-Accounts/Remove-GitHubUserSocial.ps1 @@ -15,6 +15,7 @@ .NOTES [Delete social accounts for the authenticated user](https://docs.github.com/rest/users/social-accounts#delete-social-accounts-for-the-authenticated-user) #> + #SkipTest:FunctionTest:Will add a test for this function in a future PR [OutputType([void])] [Diagnostics.CodeAnalysis.SuppressMessageAttribute('PSAvoidLongLines', '', Justification = 'Contains a long link.')] [Alias('Remove-GitHubUserSocials')] diff --git a/src/variables/private/Config.ps1 b/src/variables/private/Config.ps1 index f3d00b1d6..687048693 100644 --- a/src/variables/private/Config.ps1 +++ b/src/variables/private/Config.ps1 @@ -9,7 +9,7 @@ } DefaultConfig = [GitHubConfig]@{ ID = 'PSModule.GitHub' - HostName = $env:GITHUB_SERVER_URL ?? 'github.com' + HostName = ($env:GITHUB_SERVER_URL ?? 'github.com') -replace '^https?://' AccessTokenGracePeriodInHours = 4 GitHubAppClientID = 'Iv1.f26b61bc99e69405' OAuthAppClientID = '7204ae9b0580f2cb8288' diff --git a/tests/GitHub.Tests.ps1 b/tests/GitHub.Tests.ps1 index 192e0ccaa..29c3be9cf 100644 --- a/tests/GitHub.Tests.ps1 +++ b/tests/GitHub.Tests.ps1 @@ -12,18 +12,36 @@ BeforeAll { Describe 'GitHub' { Context 'Config' { - It 'Can get the configuration' { + It 'Get-GitHubConfig - Can get the configuration' { $config = Get-GitHubConfig Write-Verbose ($config | Format-Table | Out-String) -Verbose $config | Should -Not -BeNullOrEmpty } + It 'Get-GitHubConfig - Can get the configuration by name' { + $config = Get-GitHubConfig -Name 'HostName' + Write-Verbose ($config | Format-Table | Out-String) -Verbose + $config | Should -Not -BeNullOrEmpty + } + It 'Set-GitHubConfig - Can set the configuration' { + Set-GitHubConfig -Name 'HostName' -Value 'msx.ghe.com' + Get-GitHubConfig -Name 'HostName' | Should -Be 'msx.ghe.com' + } + It 'Remove-GetGitHubConfig - Can remove the configuration' { + Remove-GitHubConfig -Name 'HostName' + Get-GitHubConfig -Name 'HostName' | Should -BeNullOrEmpty + } + It 'Reset-GitHubConfig - Can reset the configuration' { + Set-GitHubConfig -Name HostName -Value 'msx.ghe.com' + Get-GitHubConfig -Name HostName | Should -Be 'msx.ghe.com' + Reset-GitHubConfig + Get-GitHubConfig -Name HostName | Should -Be 'github.com' + } } Context 'Auth' { It 'Can connect and disconnect without parameters in GitHubActions' { { Connect-GitHubAccount } | Should -Not -Throw { Disconnect-GitHubAccount } | Should -Not -Throw } - It 'Can connect and disconnect - a second time' { Connect-GitHubAccount Write-Verbose (Get-GitHubContext | Out-String) -Verbose @@ -33,74 +51,74 @@ Describe 'GitHub' { Write-Verbose (Get-GitHubConfig | Out-String) -Verbose { Disconnect-GitHubAccount } | Should -Not -Throw } - It 'Can pass the context to the pipeline' { $context = Connect-GitHubAccount -PassThru Write-Verbose (Get-GitHubContext | Out-String) -Verbose $context | Should -Not -BeNullOrEmpty { $context | Disconnect-GitHubAccount } | Should -Not -Throw } - It 'Can connect multiple sessions, GITHUB_TOKEN + classic PAT token' { - { Connect-GitHubAccount -Token $env:TEST_PAT } | Should -Not -Throw - { Connect-GitHubAccount -Token $env:TEST_PAT } | Should -Not -Throw + { Connect-GitHubAccount -Token $env:TEST_USER_PAT } | Should -Not -Throw + { Connect-GitHubAccount -Token $env:TEST_USER_PAT } | Should -Not -Throw { Connect-GitHubAccount } | Should -Not -Throw # Logs on with GitHub Actions' token (Get-GitHubContext -ListAvailable).Count | Should -Be 2 Get-GitHubConfig -Name 'DefaultContext' | Should -Be 'github.com/github-actions/Organization/PSModule' Write-Verbose (Get-GitHubContext | Out-String) -Verbose } - It 'Can reconfigure an existing context to be fine-grained PAT token' { - { Connect-GitHubAccount -Token $env:TEST_FG_PAT } | Should -Not -Throw + { Connect-GitHubAccount -Token $env:TEST_USER_USER_FG_PAT } | Should -Not -Throw (Get-GitHubContext -ListAvailable).Count | Should -Be 2 Write-Verbose (Get-GitHubContext -ListAvailable | Out-String) -Verbose } - It 'Can be called with a GitHub App' { $params = @{ - ClientID = $env:TEST_APP_CLIENT_ID - PrivateKey = $env:TEST_APP_PRIVATE_KEY + ClientID = $env:TEST_APP_ORG_CLIENT_ID + PrivateKey = $env:TEST_APP_ORG_PRIVATE_KEY } { Connect-GitHubAccount @params } | Should -Not -Throw $contexts = Get-GitHubContextInfo -Verbose:$false Write-Verbose ($contexts | Out-String) -Verbose ($contexts).Count | Should -Be 3 + { Connect-GitHubAccount @params -AutoloadInstallations } | Should -Not -Throw + $contexts = Get-GitHubContextInfo -Verbose:$false + Write-Verbose ($contexts | Out-String) -Verbose + ($contexts).Count | Should -Be 5 } It 'Can be called with a GitHub App and autoload installations' { $params = @{ - ClientID = $env:TEST_APP_CLIENT_ID - PrivateKey = $env:TEST_APP_PRIVATE_KEY + ClientID = $env:TEST_APP_ENT_CLIENT_ID + PrivateKey = $env:TEST_APP_ENT_PRIVATE_KEY } + { Connect-GitHubAccount @params } | Should -Not -Throw + $contexts = Get-GitHubContextInfo -Verbose:$false + Write-Verbose ($contexts | Out-String) -Verbose + ($contexts).Count | Should -Be 6 { Connect-GitHubAccount @params -AutoloadInstallations } | Should -Not -Throw $contexts = Get-GitHubContextInfo -Verbose:$false Write-Verbose ($contexts | Out-String) -Verbose - ($contexts).Count | Should -Be 7 + ($contexts).Count | Should -Be 9 } - It 'Can disconnect a specific context' { - { Disconnect-GitHubAccount -Context 'github.com/psmodule-test-app/Organization/PSModule' -Silent } | Should -Not -Throw - $contexts = Get-GitHubContextInfo -Name 'github.com/psmodule-test-app/*' -Verbose:$false + { Disconnect-GitHubAccount -Context 'github.com/psmodule-enterprise-app/Organization/PSModule' -Silent } | Should -Not -Throw + $contexts = Get-GitHubContextInfo -Name 'github.com/psmodule-enterprise-app/*' -Verbose:$false Write-Verbose ($contexts | Out-String) -Verbose - ($contexts).Count | Should -Be 3 - Connect-GitHubAccount -ClientID $env:TEST_APP_CLIENT_ID -PrivateKey $env:TEST_APP_PRIVATE_KEY -AutoloadInstallations + ($contexts).Count | Should -Be 2 + Connect-GitHubAccount -ClientID $env:TEST_APP_ORG_CLIENT_ID -PrivateKey $env:TEST_APP_ORG_PRIVATE_KEY -AutoloadInstallations $contexts = Get-GitHubContext -ListAvailable -Verbose:$false Write-Verbose ($contexts | Out-String) -Verbose - ($contexts).Count | Should -Be 7 + ($contexts).Count | Should -Be 8 } - It 'Can get the authenticated GitHubApp' { $app = Get-GitHubApp Write-Verbose ($app | Format-Table | Out-String) -Verbose $app | Should -Not -BeNullOrEmpty } - It 'Can connect to a GitHub App Installation' { $appContext = Connect-GitHubApp -Organization 'PSModule' -PassThru Write-Verbose ($appContext | Out-String) -Verbose $appContext | Should -Not -BeNullOrEmpty { $appContext | Disconnect-GitHub } | Should -Not -Throw } - It 'Can connect to all GitHub App Installations' { { Connect-GitHubApp } | Should -Not -Throw Write-Verbose 'Default context:' -Verbose @@ -108,16 +126,13 @@ Describe 'GitHub' { Write-Verbose 'All contexts:' -Verbose Write-Verbose (Get-GitHubContext -ListAvailable | Out-String) -Verbose } - It 'Can swap context to another' { { Set-GitHubDefaultContext -Context 'github.com/github-actions/Organization/PSModule' } | Should -Not -Throw Get-GitHubConfig -Name 'DefaultContext' | Should -Be 'github.com/github-actions/Organization/PSModule' } - It 'Get-GitHubViewer can be called' { Get-GitHubViewer | Should -Not -BeNullOrEmpty } - It 'Get-GitHubConfig gets the DefaultContext' { Write-Verbose (Get-GitHubConfig -Name 'DefaultContext') -Verbose { Get-GitHubConfig -Name 'DefaultContext' } | Should -Not -Throw @@ -129,6 +144,145 @@ Describe 'GitHub' { $config.ID | Should -Be 'PSModule.GitHub' } } + Context 'Status' -ForEach @('public', 'eu') { + It 'Can be called with no parameters' { + { Get-GitHubScheduledMaintenance -Stamp $_ } | Should -Not -Throw + } + It 'Can be called with Active parameter' { + { Get-GitHubScheduledMaintenance -Stamp $_ -Active } | Should -Not -Throw + } + It 'Can be called with Upcoming parameter' { + { Get-GitHubScheduledMaintenance -Stamp $_ -Upcoming } | Should -Not -Throw + } + It 'Can be called with no parameters' { + { Get-GitHubStatus -Stamp $_ } | Should -Not -Throw + } + It 'Can be called with Summary parameter' { + { Get-GitHubStatus -Stamp $_ -Summary } | Should -Not -Throw + } + It 'Can be called with no parameters' { + { Get-GitHubStatusComponent -Stamp $_ } | Should -Not -Throw + } + It 'Can be called with no parameters' { + { Get-GitHubStatusIncident -Stamp $_ } | Should -Not -Throw + } + It 'Can be called with Unresolved parameter' { + { Get-GitHubStatusIncident -Stamp $_ -Unresolved } | Should -Not -Throw + } + } + Context 'Commands' { + It "Start-GitHubLogGroup 'MyGroup' should not throw" { + { + Start-GitHubLogGroup 'MyGroup' + } | Should -Not -Throw + } + It 'Stop-LogGroup should not throw' { + { + Stop-GitHubLogGroup + } | Should -Not -Throw + } + It "Set-GitHubLogGroup 'MyGroup' should not throw" { + { + Set-GitHubLogGroup -Name 'MyGroup' -ScriptBlock { + Get-ChildItem env: | Select-Object Name, Value | Format-Table -AutoSize + } + } | Should -Not -Throw + } + It "LogGroup 'MyGroup' should not throw" { + { + LogGroup 'MyGroup' { + Get-ChildItem env: | Select-Object Name, Value | Format-Table -AutoSize + } + } | Should -Not -Throw + } + It 'Add-GitHubMask should not throw' { + { + Add-GitHubMask -Value 'taskmaster' + } | Should -Not -Throw + } + It 'Add-GitHubSystemPath should not throw' { + { + Add-GitHubSystemPath -Path $pwd.ToString() + } | Should -Not -Throw + Get-Content $env:GITHUB_PATH -Raw | Should -BeLike "*$($pwd.ToString())*" + } + It 'Disable-GitHubCommand should not throw' { + { + Disable-GitHubCommand -String 'MyString' + } | Should -Not -Throw + } + It 'Enable-GitHubCommand should not throw' { + { + Enable-GitHubCommand -String 'MyString' + } | Should -Not -Throw + } + It 'Set-GitHubNoCommandGroup should not throw' { + { + Set-GitHubNoCommandGroup { + Write-Output 'Hello, World!' + } + } | Should -Not -Throw + } + It 'Set-GitHubOutput should not throw' { + { + Set-GitHubOutput -Name 'MyName' -Value 'MyValue' + } | Should -Not -Throw + } + It 'Get-GitHubOutput should not throw' { + { + Get-GitHubOutput + } | Should -Not -Throw + } + It 'Set-GitHubEnvironmentVariable should not throw' { + { + Set-GitHubEnvironmentVariable -Name 'MyName' -Value 'MyValue' + } | Should -Not -Throw + Get-Content $env:GITHUB_ENV -Raw | Should -BeLike '*MyName*MyValue*' + } + It 'Set-GitHubStepSummary should not throw' { + { + Set-GitHubStepSummary -Summary 'MySummary' + } | Should -Not -Throw + } + It 'Write-GitHub* should not throw' { + { Write-GitHubDebug 'Debug' } | Should -Not -Throw + { Write-GitHubError 'Error' } | Should -Not -Throw + { Write-GitHubNotice 'Notice' } | Should -Not -Throw + { Write-GitHubWarning 'Warning' } | Should -Not -Throw + } + } + Context 'Disconnect' { + It 'Can disconnect without parameters' { + { Get-GitHubContext -ListAvailable | Disconnect-GitHubAccount } | Should -Not -Throw + Get-GitHubContext -ListAvailable | Should -HaveCount 0 + } + } +} + +Describe 'As a user - Fine-grained PAT token - user account access' { + BeforeAll { + Connect-GitHubAccount -Token $env:TEST_USER_USER_FG_PAT + } + AfterAll { + Get-GitHubContext -ListAvailable | Disconnect-GitHubAccount + } + Context 'API' { + It 'Can be called directly to get ratelimits' { + { + $rateLimit = Invoke-GitHubAPI -ApiEndpoint '/rate_limit' + Write-Verbose ($rateLimit | Format-Table | Out-String) -Verbose + } | Should -Not -Throw + + } + } + Context 'GraphQL' { + It 'Can be called directly to get viewer' { + { + $viewer = Invoke-GitHubGraphQLQuery -Query 'query { viewer { login } }' + Write-Verbose ($viewer | Format-Table | Out-String) -Verbose + } | Should -Not -Throw + } + } Context 'Meta' { It 'Get-GitHubRoot' { $root = Get-GitHubRoot @@ -156,45 +310,124 @@ Describe 'GitHub' { $zen | Should -Not -BeNullOrEmpty } } - Context 'Git' { - It 'Set-GitHubGitConfig sets the Git configuration' { - { Set-GitHubGitConfig } | Should -Not -Throw - $gitConfig = Get-GitHubGitConfig - Write-Verbose ($gitConfig | Format-Table | Out-String) -Verbose + Context 'Rate-Limit' { + It 'Can be called with no parameters' { + { Get-GitHubRateLimit } | Should -Not -Throw + } + } + Context 'License' { + It 'Can be called with no parameters' { + { Get-GitHubLicense } | Should -Not -Throw + } + It 'Can be called with Name parameter' { + { Get-GitHubLicense -Name 'mit' } | Should -Not -Throw + } + It 'Can be called with Repository parameter' { + { Get-GitHubLicense -Owner 'PSModule' -Repo 'GitHub' } | Should -Not -Throw + } + } + Context 'Emoji' { + It 'Can be called with no parameters' { + { Get-GitHubEmoji } | Should -Not -Throw + } + It 'Can be download the emojis' { + { Get-GitHubEmoji -Destination $env:TEMP } | Should -Not -Throw + } + } + Context 'Repository' { + Context 'Parameter Set: MyRepos_Type' { + It 'Can be called with no parameters' { + { Get-GitHubRepository } | Should -Not -Throw + } - $gitConfig | Should -Not -BeNullOrEmpty - $gitConfig.'user.name' | Should -Not -BeNullOrEmpty - $gitConfig.'user.email' | Should -Not -BeNullOrEmpty + It 'Can be called with Type parameter' { + { Get-GitHubRepository -Type 'public' } | Should -Not -Throw + } + } + Context 'Parameter Set: MyRepos_Aff-Vis' { + It 'Can be called with Visibility and Affiliation parameters' { + { Get-GitHubRepository -Visibility 'public' -Affiliation 'owner' } | Should -Not -Throw + } + } + It 'Can be called with Owner and Repo parameters' { + { Get-GitHubRepository -Owner 'PSModule' -Repo 'GitHub' } | Should -Not -Throw + } + It 'Can be called with Owner parameter' { + { Get-GitHubRepository -Owner 'PSModule' } | Should -Not -Throw + } + It 'Can be called with Username parameter' { + { Get-GitHubRepository -Username 'MariusStorhaug' } | Should -Not -Throw + } + } + Context 'GitIgnore' { + It 'Can be called with no parameters' { + { Get-GitHubGitignore } | Should -Not -Throw + } + It 'Can be called with Name parameter' { + { Get-GitHubGitignore -Name 'VisualStudio' } | Should -Not -Throw + } + } + Context 'Markdown' { + It 'Can be called with Text parameter' { + { Get-GitHubMarkdown -Text 'Hello, World!' } | Should -Not -Throw + } + It 'Can be called with Text parameter and GitHub Format Mardown' { + { Get-GitHubMarkdown -Text 'Hello, World!' -Mode gfm } | Should -Not -Throw + } + It 'Raw - Can be called with Text parameter' { + { Get-GitHubMarkdownRaw -Text 'Hello, World!' } | Should -Not -Throw } } +} + +Describe 'As a user - Fine-grained PAT token - organization account access' { + BeforeAll { + Connect-GitHubAccount -Token $env:TEST_USER_ORG_FG_PAT + } + AfterAll { + Get-GitHubContext -ListAvailable | Disconnect-GitHubAccount + } Context 'API' { It 'Can be called directly to get ratelimits' { { $rateLimit = Invoke-GitHubAPI -ApiEndpoint '/rate_limit' Write-Verbose ($rateLimit | Format-Table | Out-String) -Verbose } | Should -Not -Throw - } } - Context 'Commands' { - It "Start-LogGroup 'MyGroup' should not throw" { + Context 'GraphQL' { + It 'Can be called directly to get viewer' { { - Start-LogGroup 'MyGroup' + $viewer = Invoke-GitHubGraphQLQuery -Query 'query { viewer { login } }' + Write-Verbose ($viewer | Format-Table | Out-String) -Verbose } | Should -Not -Throw } - - It 'Stop-LogGroup should not throw' { - { - Stop-LogGroup - } | Should -Not -Throw + } + Context 'Meta' { + It 'Get-GitHubRoot' { + $root = Get-GitHubRoot + Write-Verbose ($root | Format-Table | Out-String) -Verbose + $root | Should -Not -BeNullOrEmpty } - - It "LogGroup 'MyGroup' should not throw" { - { - LogGroup 'MyGroup' { - Get-ChildItem env: | Select-Object Name, Value | Format-Table -AutoSize - } - } | Should -Not -Throw + It 'Get-GitHubApiVersion' { + $apiVersion = Get-GitHubApiVersion + Write-Verbose ($apiVersion | Format-Table | Out-String) -Verbose + $apiVersion | Should -Not -BeNullOrEmpty + } + It 'Get-GitHubMeta' { + $meta = Get-GitHubMeta + Write-Verbose ($meta | Format-Table | Out-String) -Verbose + $meta | Should -Not -BeNullOrEmpty + } + It 'Get-GitHubOctocat' { + $octocat = Get-GitHubOctocat + Write-Verbose ($octocat | Format-Table | Out-String) -Verbose + $octocat | Should -Not -BeNullOrEmpty + } + It 'Get-GitHubZen' { + $zen = Get-GitHubZen + Write-Verbose ($zen | Format-Table | Out-String) -Verbose + $zen | Should -Not -BeNullOrEmpty } } Context 'Rate-Limit' { @@ -202,81 +435,342 @@ Describe 'GitHub' { { Get-GitHubRateLimit } | Should -Not -Throw } } + Context 'License' { + It 'Can be called with no parameters' { + { Get-GitHubLicense } | Should -Not -Throw + } + It 'Can be called with Name parameter' { + { Get-GitHubLicense -Name 'mit' } | Should -Not -Throw + } + It 'Can be called with Repository parameter' { + { Get-GitHubLicense -Owner 'PSModule' -Repo 'GitHub' } | Should -Not -Throw + } + } + Context 'Emoji' { + It 'Can be called with no parameters' { + { Get-GitHubEmoji } | Should -Not -Throw + } + It 'Can be download the emojis' { + { Get-GitHubEmoji -Destination $env:TEMP } | Should -Not -Throw + } + } Context 'Repository' { - It 'Function exists' { - Get-Command Get-GitHubRepository | Should -Not -BeNullOrEmpty + Context 'Parameter Set: MyRepos_Type' { + It 'Can be called with no parameters' { + { Get-GitHubRepository } | Should -Not -Throw + } + It 'Can be called with Type parameter' { + { Get-GitHubRepository -Type 'public' } | Should -Not -Throw + } + } + Context 'Parameter Set: MyRepos_Aff-Vis' { + It 'Can be called with Visibility and Affiliation parameters' { + { Get-GitHubRepository -Visibility 'public' -Affiliation 'owner' } | Should -Not -Throw + } } - - # Context 'Parameter Set: MyRepos_Type' { - # It 'Can be called with no parameters' { - # { Get-GitHubRepository - } | Should -Not -Throw - # } - - # It 'Can be called with Type parameter' { - # { Get-GitHubRepository -Type 'public' } | Should -Not -Throw - # } - # } - - # Context 'Parameter Set: MyRepos_Aff-Vis' { - # It 'Can be called with Visibility and Affiliation parameters' { - # { Get-GitHubRepository -Visibility 'public' -Affiliation 'owner' } | Should -Not -Throw - # } - # } - It 'Can be called with Owner and Repo parameters' { { Get-GitHubRepository -Owner 'PSModule' -Repo 'GitHub' } | Should -Not -Throw } - - # Context 'Parameter Set: ListByID' { - # It 'Can be called with SinceID parameter' { - # { Get-GitHubRepository -SinceID 123456789 } | Select-Object -First 10 | Should -Not -Throw - # } - # } - It 'Can be called with Owner parameter' { { Get-GitHubRepository -Owner 'PSModule' } | Should -Not -Throw } - It 'Can be called with Username parameter' { { Get-GitHubRepository -Username 'MariusStorhaug' } | Should -Not -Throw } } - Context 'Status' { + Context 'GitIgnore' { It 'Can be called with no parameters' { - { Get-GitHubScheduledMaintenance } | Should -Not -Throw + { Get-GitHubGitignore } | Should -Not -Throw } - It 'Can be called with Active parameter' { - { Get-GitHubScheduledMaintenance -Active } | Should -Not -Throw + It 'Can be called with Name parameter' { + { Get-GitHubGitignore -Name 'VisualStudio' } | Should -Not -Throw } - It 'Can be called with Upcoming parameter' { - { Get-GitHubScheduledMaintenance -Upcoming } | Should -Not -Throw + } + Context 'Markdown' { + It 'Can be called with Text parameter' { + { Get-GitHubMarkdown -Text 'Hello, **World**' } | Should -Not -Throw + } + It 'Can be called with Text parameter and GitHub Format Mardown' { + { Get-GitHubMarkdown -Text 'Hello, **World**' -Mode gfm } | Should -Not -Throw + } + It 'Raw - Can be called with Text parameter' { + { Get-GitHubMarkdownRaw -Text 'Hello, **World**' } | Should -Not -Throw + } + } +} + +Describe 'As a user - Classic PAT token' { + BeforeAll { + Connect-GitHubAccount -Token $env:TEST_USER_PAT + } + AfterAll { + Get-GitHubContext -ListAvailable | Disconnect-GitHubAccount + } + Context 'API' { + It 'Can be called directly to get ratelimits' { + { + $rateLimit = Invoke-GitHubAPI -ApiEndpoint '/rate_limit' + Write-Verbose ($rateLimit | Format-Table | Out-String) -Verbose + } | Should -Not -Throw + + } + } + Context 'GraphQL' { + It 'Can be called directly to get viewer' { + { + $viewer = Invoke-GitHubGraphQLQuery -Query 'query { viewer { login } }' + Write-Verbose ($viewer | Format-Table | Out-String) -Verbose + } | Should -Not -Throw } + } + Context 'Meta' { + It 'Get-GitHubRoot' { + $root = Get-GitHubRoot + Write-Verbose ($root | Format-Table | Out-String) -Verbose + $root | Should -Not -BeNullOrEmpty + } + It 'Get-GitHubApiVersion' { + $apiVersion = Get-GitHubApiVersion + Write-Verbose ($apiVersion | Format-Table | Out-String) -Verbose + $apiVersion | Should -Not -BeNullOrEmpty + } + It 'Get-GitHubMeta' { + $meta = Get-GitHubMeta + Write-Verbose ($meta | Format-Table | Out-String) -Verbose + $meta | Should -Not -BeNullOrEmpty + } + It 'Get-GitHubOctocat' { + $octocat = Get-GitHubOctocat + Write-Verbose ($octocat | Format-Table | Out-String) -Verbose + $octocat | Should -Not -BeNullOrEmpty + } + It 'Get-GitHubZen' { + $zen = Get-GitHubZen + Write-Verbose ($zen | Format-Table | Out-String) -Verbose + $zen | Should -Not -BeNullOrEmpty + } + } + Context 'Rate-Limit' { It 'Can be called with no parameters' { - { Get-GitHubStatus } | Should -Not -Throw + { Get-GitHubRateLimit } | Should -Not -Throw } - It 'Can be called with Summary parameter' { - { Get-GitHubStatus -Summary } | Should -Not -Throw + } + Context 'License' { + It 'Can be called with no parameters' { + { Get-GitHubLicense } | Should -Not -Throw + } + It 'Can be called with Name parameter' { + { Get-GitHubLicense -Name 'mit' } | Should -Not -Throw } - It 'Function exists' { - Get-Command Get-GitHubStatusComponent | Should -Not -BeNullOrEmpty + It 'Can be called with Repository parameter' { + { Get-GitHubLicense -Owner 'PSModule' -Repo 'GitHub' } | Should -Not -Throw } + } + Context 'Emoji' { It 'Can be called with no parameters' { - { Get-GitHubStatusComponent } | Should -Not -Throw + { Get-GitHubEmoji } | Should -Not -Throw } - It 'Function exists' { - Get-Command Get-GitHubStatusIncident | Should -Not -BeNullOrEmpty + It 'Can be download the emojis' { + { Get-GitHubEmoji -Destination $env:TEMP } | Should -Not -Throw } + } + Context 'GitIgnore' { It 'Can be called with no parameters' { - { Get-GitHubStatusIncident } | Should -Not -Throw + { Get-GitHubGitignore } | Should -Not -Throw } - It 'Can be called with Unresolved parameter' { - { Get-GitHubStatusIncident -Unresolved } | Should -Not -Throw + It 'Can be called with Name parameter' { + { Get-GitHubGitignore -Name 'VisualStudio' } | Should -Not -Throw } } - Context 'Disconnect' { - It 'Can disconnect without parameters' { - { Get-GitHubContext -ListAvailable | Disconnect-GitHubAccount } | Should -Not -Throw - Get-GitHubContext -ListAvailable | Should -HaveCount 0 + Context 'Markdown' { + It 'Can be called with Text parameter' { + { Get-GitHubMarkdown -Text 'Hello, World!' } | Should -Not -Throw + } + It 'Can be called with Text parameter and GitHub Format Mardown' { + { Get-GitHubMarkdown -Text 'Hello, World!' -Mode gfm } | Should -Not -Throw + } + It 'Raw - Can be called with Text parameter' { + { Get-GitHubMarkdownRaw -Text 'Hello, World!' } | Should -Not -Throw + } + } +} + +Describe 'As GitHub Actions' { + BeforeAll { + Connect-GitHubAccount + } + AfterAll { + Get-GitHubContext -ListAvailable | Disconnect-GitHubAccount + } + Context 'API' { + It 'Can be called directly to get ratelimits' { + { + $rateLimit = Invoke-GitHubAPI -ApiEndpoint '/rate_limit' + Write-Verbose ($rateLimit | Format-Table | Out-String) -Verbose + } | Should -Not -Throw + + } + } + Context 'GraphQL' { + It 'Can be called directly to get viewer' { + { + $viewer = Invoke-GitHubGraphQLQuery -Query 'query { viewer { login } }' + Write-Verbose ($viewer | Format-Table | Out-String) -Verbose + } | Should -Not -Throw + } + } + Context 'Git' { + It 'Set-GitHubGitConfig sets the Git configuration' { + { Set-GitHubGitConfig } | Should -Not -Throw + $gitConfig = Get-GitHubGitConfig + Write-Verbose ($gitConfig | Format-Table | Out-String) -Verbose + + $gitConfig | Should -Not -BeNullOrEmpty + $gitConfig.'user.name' | Should -Not -BeNullOrEmpty + $gitConfig.'user.email' | Should -Not -BeNullOrEmpty + } + } + Context 'Meta' { + It 'Get-GitHubRoot' { + $root = Get-GitHubRoot + Write-Verbose ($root | Format-Table | Out-String) -Verbose + $root | Should -Not -BeNullOrEmpty + } + It 'Get-GitHubApiVersion' { + $apiVersion = Get-GitHubApiVersion + Write-Verbose ($apiVersion | Format-Table | Out-String) -Verbose + $apiVersion | Should -Not -BeNullOrEmpty + } + It 'Get-GitHubMeta' { + $meta = Get-GitHubMeta + Write-Verbose ($meta | Format-Table | Out-String) -Verbose + $meta | Should -Not -BeNullOrEmpty + } + It 'Get-GitHubOctocat' { + $octocat = Get-GitHubOctocat + Write-Verbose ($octocat | Format-Table | Out-String) -Verbose + $octocat | Should -Not -BeNullOrEmpty + } + It 'Get-GitHubZen' { + $zen = Get-GitHubZen + Write-Verbose ($zen | Format-Table | Out-String) -Verbose + $zen | Should -Not -BeNullOrEmpty + } + } + Context 'Rate-Limit' { + It 'Can be called with no parameters' { + { Get-GitHubRateLimit } | Should -Not -Throw + } + } + Context 'License' { + It 'Can be called with no parameters' { + { Get-GitHubLicense } | Should -Not -Throw + } + It 'Can be called with Name parameter' { + { Get-GitHubLicense -Name 'mit' } | Should -Not -Throw + } + It 'Can be called with Repository parameter' { + { Get-GitHubLicense -Owner 'PSModule' -Repo 'GitHub' } | Should -Not -Throw + } + } + Context 'Emoji' { + It 'Can be called with no parameters' { + { Get-GitHubEmoji } | Should -Not -Throw + } + It 'Can be download the emojis' { + { Get-GitHubEmoji -Destination $env:TEMP } | Should -Not -Throw + } + } + Context 'GitIgnore' { + It 'Can be called with no parameters' { + { Get-GitHubGitignore } | Should -Not -Throw + } + It 'Can be called with Name parameter' { + { Get-GitHubGitignore -Name 'VisualStudio' } | Should -Not -Throw + } + } + Context 'Markdown' { + It 'Can be called with Text parameter' { + { Get-GitHubMarkdown -Text 'Hello, World!' } | Should -Not -Throw + } + It 'Can be called with Text parameter and GitHub Format Mardown' { + { Get-GitHubMarkdown -Text 'Hello, World!' -Mode gfm } | Should -Not -Throw + } + It 'Raw - Can be called with Text parameter' { + { Get-GitHubMarkdownRaw -Text 'Hello, World!' } | Should -Not -Throw + } + } +} + +Describe 'As a GitHub App - Enterprise' { + BeforeAll { + Connect-GitHubAccount -ClientID $env:TEST_APP_ENT_CLIENT_ID -PrivateKey $env:TEST_APP_ENT_PRIVATE_KEY + } + AfterAll { + Get-GitHubContext -ListAvailable | Disconnect-GitHubAccount + } +} + +Describe 'As a GitHub App - Organization' { + BeforeAll { + Connect-GitHubAccount -ClientID $env:TEST_APP_ORG_CLIENT_ID -PrivateKey $env:TEST_APP_ORG_PRIVATE_KEY + } + AfterAll { + Get-GitHubContext -ListAvailable | Disconnect-GitHubAccount + } + Context 'Apps' { + Context 'GitHub Apps' { + It 'Can get a JWT for the app' { + $jwt = Get-GitHubAppJSONWebToken -ClientId $env:TEST_APP_ORG_CLIENT_ID -PrivateKey $env:TEST_APP_ORG_PRIVATE_KEY + Write-Verbose ($jwt | Format-Table | Out-String) -Verbose + $jwt | Should -Not -BeNullOrEmpty + } + It 'Can get app details' { + $app = Get-GitHubApp + Write-Verbose ($app | Format-Table | Out-String) -Verbose + $app | Should -Not -BeNullOrEmpty + } + It 'Can get app installations' { + $installations = Get-GitHubAppInstallation + Write-Verbose ($installations | Format-Table | Out-String) -Verbose + $installations | Should -Not -BeNullOrEmpty + } + It 'Can get app installation access tokens' { + $installations = Get-GitHubAppInstallation + $installations | ForEach-Object { + $token = New-GitHubAppInstallationAccessToken -InstallationID $_.id + Write-Verbose ($token | Format-Table | Out-String) -Verbose + $token | Should -Not -BeNullOrEmpty + } + } + } + Context 'Webhooks' { + It 'Can get the webhook configuration' { + $webhooks = Get-GitHubAppWebhookConfiguration + Write-Verbose ($webhooks | Format-Table | Out-String) -Verbose + $webhooks | Should -Not -BeNullOrEmpty + } + It 'Can update the webhook configuration' { + { Update-GitHubAppWebhookConfiguration -ContentType 'form' } | Should -Not -Throw + { Update-GitHubAppWebhookConfiguration -ContentType 'json' } | Should -Not -Throw + } + It 'Can get webhook deliveries' { + $deliveries = Get-GitHubAppWebhookDelivery + Write-Verbose ($deliveries | Format-Table | Out-String) -Verbose + $deliveries | Should -Not -BeNullOrEmpty + } + It 'Can redeliver a webhook delivery' { + $deliveries = Get-GitHubAppWebhookDelivery | Select-Object -First 1 + { Invoke-GitHubAppWebhookReDelivery -ID $deliveries.id } | Should -Not -Throw + } + } + } + Context 'API' { + It 'Can be called directly to get ratelimits' { + { + $app = Invoke-GitHubAPI -ApiEndpoint '/app' + Write-Verbose ($app | Format-Table | Out-String) -Verbose + } | Should -Not -Throw } } }