diff --git a/examples/Apps/Get-WebhookDelivery.ps1 b/examples/Apps/Get-WebhookDelivery.ps1 index b1363790d..9c36c955c 100644 --- a/examples/Apps/Get-WebhookDelivery.ps1 +++ b/examples/Apps/Get-WebhookDelivery.ps1 @@ -26,7 +26,7 @@ $deliveries | Where-Object { $_.Event -eq 'team' } | Format-Table -AutoSize $Return.Response | Format-Table -AutoSize -Set-GitHubDefaultContext -Context 'msx.ghe.com/Marius-Storhaug' +Switch-GitHubContext -Context 'msx.ghe.com/Marius-Storhaug' 1..10 | ForEach-Object { New-GitHubTeam -Organization 'my-org' -Name "Test$_" diff --git a/examples/Connecting.ps1 b/examples/Connecting.ps1 index 290357ff7..810b6d05a 100644 --- a/examples/Connecting.ps1 +++ b/examples/Connecting.ps1 @@ -1,6 +1,4 @@ -#Requires -Modules @{ ModuleName = 'Context'; RequiredVersion = '7.0.2' } - -### +### ### CONNECTING ### @@ -40,16 +38,15 @@ Get-GitHubContext -ListAvailable Get-GitHubContext -Context 'msx.ghe.com/MariusStorhaug' # Take a name dynamically from Get-GitHubContext? Autocomplete the name -Set-GitHubDefaultContext -Context 'msx.ghe.com/MariusStorhaug' +Switch-GitHubContext -Context 'msx.ghe.com/MariusStorhaug' # Set a specific context as the default context using pipeline -'msx.ghe.com/MariusStorhaug' | Set-GitHubDefaultContext +'msx.ghe.com/MariusStorhaug' | Switch-GitHubContext -Get-GitHubContext -Context 'github.com/MariusStorhaug' | Set-GitHubDefaultContext +Get-GitHubContext -Context 'github.com/MariusStorhaug' | Switch-GitHubContext # Abstraction layers on GitHubContexts Get-GitHubContext -Context 'msx.ghe.com/MariusStorhaug' -Get-Context -ID 'PSModule.GitHub/msx.ghe.com/MariusStorhaug' ### ### DISCONNECTING diff --git a/src/classes/public/Config/GitHubConfig.ps1 b/src/classes/public/Config/GitHubConfig.ps1 index 220904959..258d52d42 100644 --- a/src/classes/public/Config/GitHubConfig.ps1 +++ b/src/classes/public/Config/GitHubConfig.ps1 @@ -3,7 +3,7 @@ [string] $ID # The access token grace period in hours. - [int] $AccessTokenGracePeriodInHours + [System.Nullable[int]] $AccessTokenGracePeriodInHours # The default context. [string] $DefaultContext @@ -27,16 +27,16 @@ [string] $HttpVersion # The default value for the 'per_page' API parameter used in 'GET' functions that support paging. - [int] $PerPage + [System.Nullable[int]] $PerPage # The default value for retry count. - [int] $RetryCount + [System.Nullable[int]] $RetryCount # The default value for retry interval in seconds. - [int] $RetryInterval + [System.Nullable[int]] $RetryInterval # The tolerance time in seconds for JWT token validation. - [int] $JwtTimeTolerance + [System.Nullable[int]] $JwtTimeTolerance # Simple parameterless constructor GitHubConfig() {} diff --git a/src/functions/private/Apps/GitHub Apps/Get-GitHubAppInstallableOrganization.ps1 b/src/functions/private/Apps/GitHub Apps/Get-GitHubAppInstallableOrganization.ps1 index f94b2b2ec..b1ae6cac7 100644 --- a/src/functions/private/Apps/GitHub Apps/Get-GitHubAppInstallableOrganization.ps1 +++ b/src/functions/private/Apps/GitHub Apps/Get-GitHubAppInstallableOrganization.ps1 @@ -34,7 +34,6 @@ begin { $stackPath = Get-PSCallStackPath Write-Debug "[$stackPath] - Start" - $Context = Resolve-GitHubContext -Context $Context Assert-GitHubContext -Context $Context -AuthType IAT, UAT # enterprise_organization_installations=read } diff --git a/src/functions/private/Auth/Context/Assert-GitHubContext.ps1 b/src/functions/private/Auth/Context/Assert-GitHubContext.ps1 index 18b151b57..525037a89 100644 --- a/src/functions/private/Auth/Context/Assert-GitHubContext.ps1 +++ b/src/functions/private/Auth/Context/Assert-GitHubContext.ps1 @@ -35,33 +35,32 @@ process { $command = (Get-PSCallStack)[1].Command + Write-Verbose "Context: $Context" + Write-Verbose "AuthType: $AuthType" - if ($Context) { - if ($Context.AuthType -in $AuthType) { - return - } - $PSCmdlet.ThrowTerminatingError( - [System.Management.Automation.ErrorRecord]::new( - [System.Exception]::new("The context '$($Context.Name)' does not match the required AuthTypes [$AuthType] for [$command]."), - "InvalidContextAuthType", - [System.Management.Automation.ErrorCategory]::InvalidArgument, - $Context - ) - ) - } else { + if (-not $Context) { if ('Anonymous' -in $AuthType) { return } $PSCmdlet.ThrowTerminatingError( [System.Management.Automation.ErrorRecord]::new( [System.Exception]::new("Please provide a valid context or log in using 'Connect-GitHub'."), - "InvalidContext", + 'InvalidContext', [System.Management.Automation.ErrorCategory]::InvalidArgument, $Context ) ) } - + if ($Context -eq 'Anonymous' -and $AuthType -contains 'Anonymous') { return } + if ($Context.AuthType -in $AuthType) { return } + $PSCmdlet.ThrowTerminatingError( + [System.Management.Automation.ErrorRecord]::new( + [System.Exception]::new("The context '$($Context.Name)' does not match the required AuthTypes [$AuthType] for [$command]."), + 'InvalidContextAuthType', + [System.Management.Automation.ErrorCategory]::InvalidArgument, + $Context + ) + ) # TODO: Implement permission check # if ($Context.AuthType -in 'IAT' -and $Context.Permission -notin $Permission) { # throw "The context '$($Context.Name)' does not match the required Permission [$Permission] for [$command]." diff --git a/src/functions/private/Auth/Context/Remove-GitHubContext.ps1 b/src/functions/private/Auth/Context/Remove-GitHubContext.ps1 index e350468fa..2364196b9 100644 --- a/src/functions/private/Auth/Context/Remove-GitHubContext.ps1 +++ b/src/functions/private/Auth/Context/Remove-GitHubContext.ps1 @@ -1,6 +1,4 @@ -#Requires -Modules @{ ModuleName = 'Context'; RequiredVersion = '7.0.2' } - -filter Remove-GitHubContext { +filter Remove-GitHubContext { <# .SYNOPSIS Removes a context from the context vault. @@ -36,10 +34,8 @@ filter Remove-GitHubContext { } process { - $ID = "$($script:GitHub.Config.ID)/$Context" - if ($PSCmdlet.ShouldProcess($context.Name, 'Remove context')) { - Remove-Context -ID $ID + Remove-Context -ID $Context -Vault $script:GitHub.ContextVault } } @@ -47,3 +43,4 @@ filter Remove-GitHubContext { Write-Debug "[$stackPath] - End" } } +#Requires -Modules @{ ModuleName = 'Context'; RequiredVersion = '8.0.2' } diff --git a/src/functions/private/Auth/Context/Resolve-GitHubContext.ps1 b/src/functions/private/Auth/Context/Resolve-GitHubContext.ps1 index c775de364..e6fa3048c 100644 --- a/src/functions/private/Auth/Context/Resolve-GitHubContext.ps1 +++ b/src/functions/private/Auth/Context/Resolve-GitHubContext.ps1 @@ -27,7 +27,11 @@ # Can be either a string or a GitHubContext object. [Parameter(Mandatory, ValueFromPipeline)] [AllowNull()] - [object] $Context + [object] $Context, + + # If specified, makes an anonymous request to the GitHub API without authentication. + [Parameter()] + [bool] $Anonymous ) begin { @@ -37,10 +41,25 @@ } process { + Write-Verbose "Context: [$Context]" + Write-Verbose "Anonymous: [$Anonymous]" + if ($Anonymous -or $Context -eq 'Anonymous') { + Write-Verbose 'Returning Anonymous context.' + return [GitHubContext]@{ + Name = 'Anonymous' + AuthType = 'Anonymous' + } + } + if ($Context -is [string]) { $contextName = $Context - Write-Debug "Getting context: [$contextName]" - $Context = Get-GitHubContext -Context $contextName + Write-Verbose "Getting context: [$contextName]" + return Get-GitHubContext -Context $contextName + } + + if ($null -eq $Context) { + Write-Verbose 'Context is null, returning default context.' + return Get-GitHubContext } # TODO: Implement App installation context resolution diff --git a/src/functions/private/Auth/Context/Set-GitHubContext.ps1 b/src/functions/private/Auth/Context/Set-GitHubContext.ps1 index 360fb5f83..d96d925b5 100644 --- a/src/functions/private/Auth/Context/Set-GitHubContext.ps1 +++ b/src/functions/private/Auth/Context/Set-GitHubContext.ps1 @@ -1,6 +1,4 @@ -#Requires -Modules @{ ModuleName = 'Context'; RequiredVersion = '7.0.2' } - -function Set-GitHubContext { +function Set-GitHubContext { <# .SYNOPSIS Sets the GitHub context and stores it in the context vault. @@ -143,8 +141,8 @@ function Set-GitHubContext { $contextObj | Out-String -Stream | ForEach-Object { Write-Debug $_ } Write-Debug '----------------------------------------------------' if ($PSCmdlet.ShouldProcess('Context', 'Set')) { - Write-Debug "Saving context: [$($script:GitHub.Config.ID)/$($contextObj['Name'])]" - Set-Context -ID "$($script:GitHub.Config.ID)/$($contextObj['Name'])" -Context $contextObj + Write-Debug "Saving context: [$($contextObj['Name'])]" + Set-Context -ID $($contextObj['Name']) -Context $contextObj -Vault $script:GitHub.ContextVault if ($Default) { Switch-GitHubContext -Context $contextObj['Name'] } @@ -170,3 +168,4 @@ function Set-GitHubContext { Write-Debug "[$stackPath] - End" } } +#Requires -Modules @{ ModuleName = 'Context'; RequiredVersion = '8.0.2' } diff --git a/src/functions/private/Auth/DeviceFlow/Update-GitHubUserAccessToken.ps1 b/src/functions/private/Auth/DeviceFlow/Update-GitHubUserAccessToken.ps1 index 75a3b253b..72c24cf31 100644 --- a/src/functions/private/Auth/DeviceFlow/Update-GitHubUserAccessToken.ps1 +++ b/src/functions/private/Auth/DeviceFlow/Update-GitHubUserAccessToken.ps1 @@ -85,7 +85,7 @@ $Context.RefreshTokenExpirationDate = (Get-Date).AddSeconds($tokenResponse.refresh_token_expires_in) if ($PSCmdlet.ShouldProcess('Access token', 'Update/refresh')) { - Set-Context -Context $Context -ID $Context.ID + Set-Context -Context $Context -Vault $script:GitHub.ContextVault } if ($PassThru) { @@ -98,4 +98,4 @@ Write-Debug "[$stackPath] - End" } } -#Requires -Modules @{ ModuleName = 'Context'; RequiredVersion = '7.0.2' } +#Requires -Modules @{ ModuleName = 'Context'; RequiredVersion = '8.0.2' } diff --git a/src/functions/private/Config/Initialize-GitHubConfig.ps1 b/src/functions/private/Config/Initialize-GitHubConfig.ps1 index aa1be4b16..16428319e 100644 --- a/src/functions/private/Config/Initialize-GitHubConfig.ps1 +++ b/src/functions/private/Config/Initialize-GitHubConfig.ps1 @@ -1,6 +1,4 @@ -#Requires -Modules @{ ModuleName = 'Context'; RequiredVersion = '7.0.2' } - -function Initialize-GitHubConfig { +function Initialize-GitHubConfig { <# .SYNOPSIS Initialize the GitHub module configuration. @@ -34,7 +32,7 @@ function Initialize-GitHubConfig { Write-Debug "Force: [$Force]" if ($Force) { Write-Debug 'Forcing initialization of GitHubConfig.' - $context = Set-Context -ID $script:GitHub.DefaultConfig.ID -Context $script:GitHub.DefaultConfig -PassThru + $context = Set-Context -Context $script:GitHub.DefaultConfig -Vault $script:GitHub.ContextVault -PassThru $script:GitHub.Config = [GitHubConfig]$context return } @@ -46,11 +44,11 @@ function Initialize-GitHubConfig { } Write-Debug 'Attempt to load the stored GitHubConfig from ContextVault' - $context = Get-Context -ID $script:GitHub.DefaultConfig.ID + $context = Get-Context -ID $script:GitHub.DefaultConfig.ID -Vault $script:GitHub.ContextVault if ($context) { Write-Debug 'GitHubConfig loaded into memory.' - Write-Debug "Checking if new default properties are available in the stored context." + Write-Debug 'Checking if new default properties are available in the stored context.' $needsUpdate = $false $defaultProperties = $script:GitHub.DefaultConfig.PSObject.Properties.Name foreach ($propName in $defaultProperties) { @@ -62,14 +60,14 @@ function Initialize-GitHubConfig { } if ($needsUpdate) { Write-Debug 'Updating stored context with new default properties' - $context = Set-Context -ID $script:GitHub.DefaultConfig.ID -Context $context -PassThru + $context = Set-Context -Context $context -Vault $script:GitHub.ContextVault -PassThru } $script:GitHub.Config = [GitHubConfig]$context return } Write-Debug 'Initializing GitHubConfig from defaults' - $context = Set-Context -ID $script:GitHub.DefaultConfig.ID -Context $script:GitHub.DefaultConfig -PassThru + $context = Set-Context -Context $script:GitHub.DefaultConfig -Vault $script:GitHub.ContextVault -PassThru $script:GitHub.Config = [GitHubConfig]$context } @@ -77,3 +75,4 @@ function Initialize-GitHubConfig { Write-Debug "[$stackPath] - End" } } +#Requires -Modules @{ ModuleName = 'Context'; RequiredVersion = '8.0.2' } diff --git a/src/functions/private/Gitignore/Get-GitHubGitignoreByName.ps1 b/src/functions/private/Gitignore/Get-GitHubGitignoreByName.ps1 index 77e72b857..89688cc4d 100644 --- a/src/functions/private/Gitignore/Get-GitHubGitignoreByName.ps1 +++ b/src/functions/private/Gitignore/Get-GitHubGitignoreByName.ps1 @@ -21,10 +21,6 @@ [Parameter(Mandatory)] [string] $Name, - # If specified, makes an anonymous request to the GitHub API without authentication. - [Parameter()] - [switch] $Anonymous, - # 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()] @@ -42,7 +38,6 @@ Method = 'GET' APIEndpoint = "/gitignore/templates/$Name" Accept = 'application/vnd.github.raw+json' - Anonymous = $Anonymous Context = $Context } diff --git a/src/functions/private/Gitignore/Get-GitHubGitignoreList.ps1 b/src/functions/private/Gitignore/Get-GitHubGitignoreList.ps1 index 3eadaba3f..1e12c0e8d 100644 --- a/src/functions/private/Gitignore/Get-GitHubGitignoreList.ps1 +++ b/src/functions/private/Gitignore/Get-GitHubGitignoreList.ps1 @@ -19,10 +19,6 @@ [OutputType([string[]])] [CmdletBinding()] param( - # If specified, makes an anonymous request to the GitHub API without authentication. - [Parameter()] - [switch] $Anonymous, - # 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()] @@ -39,7 +35,6 @@ $inputObject = @{ Method = 'GET' APIEndpoint = '/gitignore/templates' - Anonymous = $Anonymous Context = $Context } diff --git a/src/functions/private/License/Get-GitHubLicenseByName.ps1 b/src/functions/private/License/Get-GitHubLicenseByName.ps1 index f1b3ac2b5..42a0da42b 100644 --- a/src/functions/private/License/Get-GitHubLicenseByName.ps1 +++ b/src/functions/private/License/Get-GitHubLicenseByName.ps1 @@ -23,10 +23,6 @@ [Parameter(Mandatory)] [string] $Name, - # If specified, makes an anonymous request to the GitHub API without authentication. - [Parameter()] - [switch] $Anonymous, - # 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()] @@ -44,7 +40,6 @@ Method = 'GET' APIEndpoint = "/licenses/$Name" Accept = 'application/vnd.github+json' - Anonymous = $Anonymous Context = $Context } diff --git a/src/functions/private/License/Get-GitHubLicenseList.ps1 b/src/functions/private/License/Get-GitHubLicenseList.ps1 index d961d0a3a..03bcf4add 100644 --- a/src/functions/private/License/Get-GitHubLicenseList.ps1 +++ b/src/functions/private/License/Get-GitHubLicenseList.ps1 @@ -22,10 +22,6 @@ [OutputType([GitHubLicense[]])] [CmdletBinding()] param( - # If specified, makes an anonymous request to the GitHub API without authentication. - [Parameter()] - [switch] $Anonymous, - # 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()] @@ -42,7 +38,6 @@ $inputObject = @{ Method = 'GET' APIEndpoint = '/licenses' - Anonymous = $Anonymous Context = $Context } diff --git a/src/functions/private/License/Get-GitHubRepositoryLicense.ps1 b/src/functions/private/License/Get-GitHubRepositoryLicense.ps1 index 7310644af..c6fdefe6a 100644 --- a/src/functions/private/License/Get-GitHubRepositoryLicense.ps1 +++ b/src/functions/private/License/Get-GitHubRepositoryLicense.ps1 @@ -36,10 +36,6 @@ [ValidateSet('raw', 'html')] [string] $Type = 'raw', - # If specified, makes an anonymous request to the GitHub API without authentication. - [Parameter()] - [switch] $Anonymous, - # 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(Mandatory)] @@ -62,7 +58,6 @@ Method = 'GET' APIEndpoint = "/repos/$Owner/$Repository/license" ContentType = $contentType - Anonymous = $Anonymous Context = $Context } diff --git a/src/functions/public/API/Invoke-GitHubAPI.ps1 b/src/functions/public/API/Invoke-GitHubAPI.ps1 index a4c4f7a53..66704a453 100644 --- a/src/functions/public/API/Invoke-GitHubAPI.ps1 +++ b/src/functions/public/API/Invoke-GitHubAPI.ps1 @@ -101,14 +101,14 @@ filter Invoke-GitHubAPI { # 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) + [object] $Context ) begin { $stackPath = Get-PSCallStackPath Write-Debug "[$stackPath] - Start" $debug = $DebugPreference -eq 'Continue' - $Context = Resolve-GitHubContext -Context $Context + $Context = Resolve-GitHubContext -Context $Context -Anonymous $Anonymous if ($debug) { Write-Debug 'Invoking GitHub API...' Write-Debug 'Parent function parameters:' @@ -173,7 +173,7 @@ filter Invoke-GitHubAPI { } $APICall | Remove-HashtableEntry -NullOrEmptyValues - if (-not $Anonymous -and $Context -ne 'Anonymous' -and -not [string]::IsNullOrEmpty($Context)) { + if (-not $Anonymous -and $Context.Name -ne 'Anonymous') { $APICall['Authentication'] = 'Bearer' $APICall['Token'] = $Token } diff --git a/src/functions/public/API/Invoke-GitHubGraphQLQuery.ps1 b/src/functions/public/API/Invoke-GitHubGraphQLQuery.ps1 index ab45e14e0..1c62e85a8 100644 --- a/src/functions/public/API/Invoke-GitHubGraphQLQuery.ps1 +++ b/src/functions/public/API/Invoke-GitHubGraphQLQuery.ps1 @@ -17,14 +17,18 @@ #> [CmdletBinding()] param( + # If specified, makes an anonymous request to the GitHub API without authentication. [Parameter(Mandatory)] [string] $Query, + # Variables to pass to the GraphQL query. [Parameter()] [hashtable] $Variables, + # 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) + [object] $Context ) begin { diff --git a/src/functions/public/Apps/GitHub App Installations/Add-GitHubAppInstallationRepositoryAccess.ps1 b/src/functions/public/Apps/GitHub App Installations/Add-GitHubAppInstallationRepositoryAccess.ps1 index f4a071832..50086f504 100644 --- a/src/functions/public/Apps/GitHub App Installations/Add-GitHubAppInstallationRepositoryAccess.ps1 +++ b/src/functions/public/Apps/GitHub App Installations/Add-GitHubAppInstallationRepositoryAccess.ps1 @@ -53,7 +53,7 @@ # 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) + [object] $Context ) begin { diff --git a/src/functions/public/Apps/GitHub App Installations/Get-GitHubAppAccessibleRepository.ps1 b/src/functions/public/Apps/GitHub App Installations/Get-GitHubAppAccessibleRepository.ps1 index de48aee2e..4cee89486 100644 --- a/src/functions/public/Apps/GitHub App Installations/Get-GitHubAppAccessibleRepository.ps1 +++ b/src/functions/public/Apps/GitHub App Installations/Get-GitHubAppAccessibleRepository.ps1 @@ -45,7 +45,7 @@ # 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) + [object] $Context ) begin { diff --git a/src/functions/public/Apps/GitHub App Installations/Get-GitHubAppInstallation.ps1 b/src/functions/public/Apps/GitHub App Installations/Get-GitHubAppInstallation.ps1 index d51d550bb..bac0de97b 100644 --- a/src/functions/public/Apps/GitHub App Installations/Get-GitHubAppInstallation.ps1 +++ b/src/functions/public/Apps/GitHub App Installations/Get-GitHubAppInstallation.ps1 @@ -42,7 +42,7 @@ # 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) + [object] $Context ) begin { diff --git a/src/functions/public/Apps/GitHub App Installations/Get-GitHubAppInstallationRepositoryAccess.ps1 b/src/functions/public/Apps/GitHub App Installations/Get-GitHubAppInstallationRepositoryAccess.ps1 index 6dc58e2f2..e54f6d663 100644 --- a/src/functions/public/Apps/GitHub App Installations/Get-GitHubAppInstallationRepositoryAccess.ps1 +++ b/src/functions/public/Apps/GitHub App Installations/Get-GitHubAppInstallationRepositoryAccess.ps1 @@ -54,7 +54,7 @@ # 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) + [object] $Context ) begin { diff --git a/src/functions/public/Apps/GitHub App Installations/Remove-GitHubAppInstallationRepositoryAccess.ps1 b/src/functions/public/Apps/GitHub App Installations/Remove-GitHubAppInstallationRepositoryAccess.ps1 index 8dce06aef..3d0097fa8 100644 --- a/src/functions/public/Apps/GitHub App Installations/Remove-GitHubAppInstallationRepositoryAccess.ps1 +++ b/src/functions/public/Apps/GitHub App Installations/Remove-GitHubAppInstallationRepositoryAccess.ps1 @@ -53,7 +53,7 @@ # 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) + [object] $Context ) begin { diff --git a/src/functions/public/Apps/GitHub App Installations/Update-GitHubAppInstallationRepositoryAccess.ps1 b/src/functions/public/Apps/GitHub App Installations/Update-GitHubAppInstallationRepositoryAccess.ps1 index ea11525e8..cd6b9905b 100644 --- a/src/functions/public/Apps/GitHub App Installations/Update-GitHubAppInstallationRepositoryAccess.ps1 +++ b/src/functions/public/Apps/GitHub App Installations/Update-GitHubAppInstallationRepositoryAccess.ps1 @@ -66,7 +66,7 @@ # 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) + [object] $Context ) begin { diff --git a/src/functions/public/Apps/GitHub App/Get-GitHubApp.ps1 b/src/functions/public/Apps/GitHub App/Get-GitHubApp.ps1 index 8bc635524..f675e0163 100644 --- a/src/functions/public/Apps/GitHub App/Get-GitHubApp.ps1 +++ b/src/functions/public/Apps/GitHub App/Get-GitHubApp.ps1 @@ -39,7 +39,7 @@ # 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) + [object] $Context ) begin { diff --git a/src/functions/public/Apps/GitHub App/Install-GitHubApp.ps1 b/src/functions/public/Apps/GitHub App/Install-GitHubApp.ps1 index b50ca73d6..d30dafe98 100644 --- a/src/functions/public/Apps/GitHub App/Install-GitHubApp.ps1 +++ b/src/functions/public/Apps/GitHub App/Install-GitHubApp.ps1 @@ -62,7 +62,7 @@ # 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) + [object] $Context ) begin { diff --git a/src/functions/public/Apps/GitHub App/New-GitHubAppInstallationAccessToken.ps1 b/src/functions/public/Apps/GitHub App/New-GitHubAppInstallationAccessToken.ps1 index 12d9ed599..2291149ad 100644 --- a/src/functions/public/Apps/GitHub App/New-GitHubAppInstallationAccessToken.ps1 +++ b/src/functions/public/Apps/GitHub App/New-GitHubAppInstallationAccessToken.ps1 @@ -65,7 +65,7 @@ # 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) + [object] $Context ) begin { diff --git a/src/functions/public/Apps/GitHub App/Uninstall-GitHubApp.ps1 b/src/functions/public/Apps/GitHub App/Uninstall-GitHubApp.ps1 index 567d73243..5e0dda333 100644 --- a/src/functions/public/Apps/GitHub App/Uninstall-GitHubApp.ps1 +++ b/src/functions/public/Apps/GitHub App/Uninstall-GitHubApp.ps1 @@ -43,7 +43,7 @@ # 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) + [object] $Context ) begin { diff --git a/src/functions/public/Artifacts/Get-GitHubArtifact.ps1 b/src/functions/public/Artifacts/Get-GitHubArtifact.ps1 index baa400fff..a7657facc 100644 --- a/src/functions/public/Artifacts/Get-GitHubArtifact.ps1 +++ b/src/functions/public/Artifacts/Get-GitHubArtifact.ps1 @@ -1,4 +1,4 @@ -function Get-GitHubArtifact { +function Get-GitHubArtifact { <# .SYNOPSIS Retrieves GitHub Actions artifacts from a repository or workflow run. @@ -113,7 +113,7 @@ function Get-GitHubArtifact { # 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) + [object] $Context ) begin { diff --git a/src/functions/public/Artifacts/Remove-GitHubArtifact.ps1 b/src/functions/public/Artifacts/Remove-GitHubArtifact.ps1 index 96b073c4b..ca705b122 100644 --- a/src/functions/public/Artifacts/Remove-GitHubArtifact.ps1 +++ b/src/functions/public/Artifacts/Remove-GitHubArtifact.ps1 @@ -1,4 +1,4 @@ -function Remove-GitHubArtifact { +function Remove-GitHubArtifact { <# .SYNOPSIS Deletes an artifact from a GitHub repository by its unique ID. @@ -48,12 +48,13 @@ function Remove-GitHubArtifact { # 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) + [object] $Context ) begin { $stackPath = Get-PSCallStackPath Write-Debug "[$stackPath] - Start" + $Context = Resolve-GitHubContext -Context $Context Assert-GitHubContext -Context $Context -AuthType IAT, PAT, UAT } diff --git a/src/functions/public/Artifacts/Save-GitHubArtifact.ps1 b/src/functions/public/Artifacts/Save-GitHubArtifact.ps1 index d9b970593..dfadd17df 100644 --- a/src/functions/public/Artifacts/Save-GitHubArtifact.ps1 +++ b/src/functions/public/Artifacts/Save-GitHubArtifact.ps1 @@ -1,4 +1,4 @@ -function Save-GitHubArtifact { +function Save-GitHubArtifact { <# .SYNOPSIS Downloads a GitHub Actions artifact. @@ -88,7 +88,7 @@ function Save-GitHubArtifact { # 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) + [object] $Context ) begin { diff --git a/src/functions/public/Auth/Connect-GitHubAccount.ps1 b/src/functions/public/Auth/Connect-GitHubAccount.ps1 index 7c06a20f8..d8cf4a234 100644 --- a/src/functions/public/Auth/Connect-GitHubAccount.ps1 +++ b/src/functions/public/Auth/Connect-GitHubAccount.ps1 @@ -187,7 +187,7 @@ Repository = [string]$Repository } - Write-Verbose ($context | Format-Table | Out-String) + $context | Format-Table | Out-String -Stream | ForEach-Object { Write-Verbose $_ } switch ($authType) { 'UAT' { @@ -293,7 +293,7 @@ } } $contextObj = Set-GitHubContext -Context $context -Default:(!$NotDefault) -PassThru - Write-Verbose ($contextObj | Format-List | Out-String) + $contextObj | Format-List | Out-String -Stream | ForEach-Object { Write-Verbose $_ } if (-not $Silent) { $name = $contextObj.Username if ($script:GitHub.EnvironmentType -eq 'GHA') { diff --git a/src/functions/public/Auth/Connect-GitHubApp.ps1 b/src/functions/public/Auth/Connect-GitHubApp.ps1 index 38df9c1fa..bac6f7ace 100644 --- a/src/functions/public/Auth/Connect-GitHubApp.ps1 +++ b/src/functions/public/Auth/Connect-GitHubApp.ps1 @@ -74,17 +74,17 @@ # 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) + [object] $Context ) begin { $stackPath = Get-PSCallStackPath Write-Debug "[$stackPath] - Start" + $Context = Resolve-GitHubContext -Context $Context + Assert-GitHubContext -Context $Context -AuthType App } process { - $Context = $Context | Resolve-GitHubContext - $Context | Assert-GitHubContext -AuthType 'App' $installations = Get-GitHubAppInstallation -Context $Context $selectedInstallations = @() @@ -158,9 +158,9 @@ } } Write-Verbose 'Logging in using a managed installation access token...' - Write-Verbose ($contextParams | Format-Table | Out-String) + $contextParams | Format-Table | Out-String -Stream | ForEach-Object { Write-Verbose $_ } $contextObj = [InstallationGitHubContext]::new((Set-GitHubContext -Context $contextParams.Clone() -PassThru -Default:$Default)) - Write-Verbose ($contextObj | Format-List | Out-String) + $contextObj | Format-List | Out-String -Stream | ForEach-Object { Write-Verbose $_ } if (-not $Silent) { $name = $contextObj.name if ($script:GitHub.EnvironmentType -eq 'GHA') { diff --git a/src/functions/public/Auth/Context/Get-GitHubContext.ps1 b/src/functions/public/Auth/Context/Get-GitHubContext.ps1 index 066858d6c..2f54433a5 100644 --- a/src/functions/public/Auth/Context/Get-GitHubContext.ps1 +++ b/src/functions/public/Auth/Context/Get-GitHubContext.ps1 @@ -1,6 +1,4 @@ -#Requires -Modules @{ ModuleName = 'Context'; RequiredVersion = '7.0.2' } - -function Get-GitHubContext { +function Get-GitHubContext { <# .SYNOPSIS Get the current GitHub context. @@ -48,26 +46,24 @@ function Get-GitHubContext { process { switch ($PSCmdlet.ParameterSetName) { 'NamedContext' { - Write-Verbose "NamedContext: [$Context]" - $ID = "$($script:GitHub.Config.ID)/$Context" - Write-Verbose "Getting available contexts for [$ID]" + Write-Debug "NamedContext: [$Context]" + $ID = $Context } 'ListAvailableContexts' { - Write-Verbose "ListAvailable: [$ListAvailable]" - $ID = "$($script:GitHub.Config.ID)/*" - Write-Verbose "Getting available contexts for [$ID]" + Write-Debug "ListAvailable: [$ListAvailable]" + $ID = '*' } default { - Write-Verbose 'Getting default context.' - $ID = "$($script:GitHub.Config.ID)/$($script:GitHub.Config.DefaultContext)" + Write-Debug 'Getting default context.' + $ID = $script:GitHub.Config.DefaultContext if ([string]::IsNullOrEmpty($ID)) { - throw "No default GitHub context found. Please run 'Set-GitHubDefaultContext' or 'Connect-GitHub' to configure a GitHub context." + throw "No default GitHub context found. Please run 'Switch-GitHubContext' or 'Connect-GitHub' to configure a GitHub context." } - Write-Verbose "Getting the default context: [$ID]" } } + Write-Verbose "Getting the context: [$ID]" - Get-Context -ID $ID | ForEach-Object { + Get-Context -ID $ID -Vault $script:GitHub.ContextVault | Where-Object { $_.ID -ne $script:GitHub.DefaultConfig.ID } | ForEach-Object { $contextObj = $_ Write-Verbose 'Context:' $contextObj | Select-Object * | Out-String -Stream | ForEach-Object { Write-Verbose $_ } @@ -94,3 +90,4 @@ function Get-GitHubContext { Write-Debug "[$stackPath] - End" } } +#Requires -Modules @{ ModuleName = 'Context'; RequiredVersion = '8.0.2' } diff --git a/src/functions/public/Auth/Context/Switch-GitHubContext.ps1 b/src/functions/public/Auth/Context/Switch-GitHubContext.ps1 index b31a09756..0a6149a66 100644 --- a/src/functions/public/Auth/Context/Switch-GitHubContext.ps1 +++ b/src/functions/public/Auth/Context/Switch-GitHubContext.ps1 @@ -12,13 +12,12 @@ .LINK https://psmodule.io/GitHub/Functions/Auth/Context/Switch-GitHubContext #> - [Alias('Set-GitHubDefaultContext')] [CmdletBinding(SupportsShouldProcess)] param( # The context to run the command in. Used to get the details for the API call. # Can be either a string or a GitHubContext object. [Parameter(ValueFromPipeline)] - [object] $Context = (Get-GitHubContext) + [object] $Context ) begin { diff --git a/src/functions/public/Auth/Disconnect-GitHubAccount.ps1 b/src/functions/public/Auth/Disconnect-GitHubAccount.ps1 index c603c7449..7e459b875 100644 --- a/src/functions/public/Auth/Disconnect-GitHubAccount.ps1 +++ b/src/functions/public/Auth/Disconnect-GitHubAccount.ps1 @@ -52,7 +52,7 @@ Remove-GitHubConfig -Name 'DefaultContext' if (-not $Silent) { Write-Warning 'There is no longer a default context!' - Write-Warning "Please set a new default context using 'Set-GitHubDefaultContext -Name '" + Write-Warning "Please set a new default context using 'Switch-GitHubContext -Name '" } } diff --git a/src/functions/public/Auth/Get-GitHubViewer.ps1 b/src/functions/public/Auth/Get-GitHubViewer.ps1 index 30bc28627..f5088adb9 100644 --- a/src/functions/public/Auth/Get-GitHubViewer.ps1 +++ b/src/functions/public/Auth/Get-GitHubViewer.ps1 @@ -26,7 +26,7 @@ # 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) + [object] $Context ) begin { diff --git a/src/functions/public/Config/Get-GitHubConfig.ps1 b/src/functions/public/Config/Get-GitHubConfig.ps1 index 30fe67dd0..fa37ba5de 100644 --- a/src/functions/public/Config/Get-GitHubConfig.ps1 +++ b/src/functions/public/Config/Get-GitHubConfig.ps1 @@ -30,7 +30,7 @@ process { if (-not $Name) { - return [GitHubConfig]($script:GitHub.Config) + Get-Context -ID $script:GitHub.Config.ID -Vault $script:GitHub.ContextVault | Select-Object -ExcludeProperty ID } $script:GitHub.Config.$Name @@ -40,3 +40,4 @@ Write-Debug "[$stackPath] - End" } } +#Requires -Modules @{ ModuleName = 'Context'; RequiredVersion = '8.0.2' } diff --git a/src/functions/public/Config/Remove-GitHubConfig.ps1 b/src/functions/public/Config/Remove-GitHubConfig.ps1 index ace3a1005..9b6313a68 100644 --- a/src/functions/public/Config/Remove-GitHubConfig.ps1 +++ b/src/functions/public/Config/Remove-GitHubConfig.ps1 @@ -1,6 +1,4 @@ -#Requires -Modules @{ ModuleName = 'Context'; RequiredVersion = '7.0.2' } - -function Remove-GitHubConfig { +function Remove-GitHubConfig { <# .SYNOPSIS Remove a GitHub module configuration. @@ -39,10 +37,11 @@ function Remove-GitHubConfig { Write-Error (Get-PSCallStack | Format-Table | Out-String) throw 'Failed to connect to GitHub.' } - Set-Context -ID $script:GitHub.Config.ID -Context $script:GitHub.Config + Set-Context -Context $script:GitHub.Config -Vault $script:GitHub.ContextVault } end { Write-Debug "[$stackPath] - End" } } +#Requires -Modules @{ ModuleName = 'Context'; RequiredVersion = '8.0.2' } diff --git a/src/functions/public/Config/Set-GitHubConfig.ps1 b/src/functions/public/Config/Set-GitHubConfig.ps1 index 41e6f8e65..9d7fdde6f 100644 --- a/src/functions/public/Config/Set-GitHubConfig.ps1 +++ b/src/functions/public/Config/Set-GitHubConfig.ps1 @@ -1,6 +1,4 @@ -#Requires -Modules @{ ModuleName = 'Context'; RequiredVersion = '7.0.2' } - -function Set-GitHubConfig { +function Set-GitHubConfig { <# .SYNOPSIS Set a GitHub module configuration. @@ -24,7 +22,11 @@ function Set-GitHubConfig { # Set the access token type. [Parameter()] - [string] $Value + [string] $Value, + + # Pass the context through the pipeline. + [Parameter()] + [switch] $PassThru ) begin { @@ -37,7 +39,7 @@ function Set-GitHubConfig { Write-Verbose "Setting [$Name] to [$Value]" $script:GitHub.Config.$Name = $Value if ($PSCmdlet.ShouldProcess('ContextSetting', 'Set')) { - Set-Context -ID $script:GitHub.Config.ID -Context $script:GitHub.Config + Set-Context -Context $script:GitHub.Config -Vault $script:GitHub.ContextVault -PassThru:$PassThru } } @@ -45,3 +47,4 @@ function Set-GitHubConfig { Write-Debug "[$stackPath] - End" } } +#Requires -Modules @{ ModuleName = 'Context'; RequiredVersion = '8.0.2' } diff --git a/src/functions/public/Emojis/Get-GitHubEmoji.ps1 b/src/functions/public/Emojis/Get-GitHubEmoji.ps1 index 4732c254a..78602ffe6 100644 --- a/src/functions/public/Emojis/Get-GitHubEmoji.ps1 +++ b/src/functions/public/Emojis/Get-GitHubEmoji.ps1 @@ -39,13 +39,13 @@ # 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) + [object] $Context ) begin { $stackPath = Get-PSCallStackPath Write-Debug "[$stackPath] - Start" - $Context = Resolve-GitHubContext -Context $Context + $Context = Resolve-GitHubContext -Context $Context -Anonymous $Anonymous Assert-GitHubContext -Context $Context -AuthType IAT, PAT, UAT, Anonymous } @@ -53,7 +53,6 @@ $inputObject = @{ Method = 'GET' APIEndpoint = '/emojis' - Anonymous = $Anonymous Context = $Context } diff --git a/src/functions/public/Enterprise/Get-GitHubEnterpriseOrganization.ps1 b/src/functions/public/Enterprise/Get-GitHubEnterpriseOrganization.ps1 index 28594a94f..8de156d2c 100644 --- a/src/functions/public/Enterprise/Get-GitHubEnterpriseOrganization.ps1 +++ b/src/functions/public/Enterprise/Get-GitHubEnterpriseOrganization.ps1 @@ -20,7 +20,7 @@ # 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) + [object] $Context ) begin { diff --git a/src/functions/public/Environments/Get-GitHubEnvironment.ps1 b/src/functions/public/Environments/Get-GitHubEnvironment.ps1 index 539d1b4b0..4c4979cfc 100644 --- a/src/functions/public/Environments/Get-GitHubEnvironment.ps1 +++ b/src/functions/public/Environments/Get-GitHubEnvironment.ps1 @@ -1,4 +1,4 @@ -filter Get-GitHubEnvironment { +filter Get-GitHubEnvironment { <# .SYNOPSIS Retrieves details of a specified GitHub environment or lists all environments for a repository. @@ -89,7 +89,7 @@ filter Get-GitHubEnvironment { # 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) + [object] $Context ) begin { diff --git a/src/functions/public/Environments/Remove-GitHubEnvironment.ps1 b/src/functions/public/Environments/Remove-GitHubEnvironment.ps1 index 46b76813e..47b379e6d 100644 --- a/src/functions/public/Environments/Remove-GitHubEnvironment.ps1 +++ b/src/functions/public/Environments/Remove-GitHubEnvironment.ps1 @@ -1,4 +1,4 @@ -filter Remove-GitHubEnvironment { +filter Remove-GitHubEnvironment { <# .SYNOPSIS Deletes an environment from a repository. @@ -37,7 +37,7 @@ filter Remove-GitHubEnvironment { # 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) + [object] $Context ) begin { diff --git a/src/functions/public/Environments/Set-GitHubEnvironment.ps1 b/src/functions/public/Environments/Set-GitHubEnvironment.ps1 index 7298d3847..65c0b326c 100644 --- a/src/functions/public/Environments/Set-GitHubEnvironment.ps1 +++ b/src/functions/public/Environments/Set-GitHubEnvironment.ps1 @@ -1,4 +1,4 @@ -filter Set-GitHubEnvironment { +filter Set-GitHubEnvironment { <# .SYNOPSIS Create or update an environment. @@ -109,7 +109,7 @@ filter Set-GitHubEnvironment { # 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) + [object] $Context ) begin { diff --git a/src/functions/public/Git/Set-GitHubGitConfig.ps1 b/src/functions/public/Git/Set-GitHubGitConfig.ps1 index d14ac7214..60de58c7d 100644 --- a/src/functions/public/Git/Set-GitHubGitConfig.ps1 +++ b/src/functions/public/Git/Set-GitHubGitConfig.ps1 @@ -24,7 +24,7 @@ # 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) + [object] $Context ) begin { diff --git a/src/functions/public/Gitignore/Get-GitHubGitignore.ps1 b/src/functions/public/Gitignore/Get-GitHubGitignore.ps1 index 677c644bf..0379e0b34 100644 --- a/src/functions/public/Gitignore/Get-GitHubGitignore.ps1 +++ b/src/functions/public/Gitignore/Get-GitHubGitignore.ps1 @@ -39,19 +39,18 @@ # 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) + [object] $Context ) begin { $stackPath = Get-PSCallStackPath Write-Debug "[$stackPath] - Start" - $Context = Resolve-GitHubContext -Context $Context + $Context = Resolve-GitHubContext -Context $Context -Anonymous $Anonymous Assert-GitHubContext -Context $Context -AuthType IAT, PAT, UAT, Anonymous } process { $params = @{ - Anonymous = $Anonymous Context = $Context } switch ($PSCmdlet.ParameterSetName) { diff --git a/src/functions/public/License/Get-GitHubLicense.ps1 b/src/functions/public/License/Get-GitHubLicense.ps1 index 90b7e6e45..53bcc200f 100644 --- a/src/functions/public/License/Get-GitHubLicense.ps1 +++ b/src/functions/public/License/Get-GitHubLicense.ps1 @@ -53,20 +53,19 @@ # 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) + [object] $Context ) begin { $stackPath = Get-PSCallStackPath Write-Debug "[$stackPath] - Start" - $Context = Resolve-GitHubContext -Context $Context + $Context = Resolve-GitHubContext -Context $Context -Anonymous $Anonymous Assert-GitHubContext -Context $Context -AuthType IAT, PAT, UAT, Anonymous } process { $params = @{ - Anonymous = $Anonymous - Context = $Context + Context = $Context } switch ($PSCmdlet.ParameterSetName) { 'List' { diff --git a/src/functions/public/Markdown/Get-GitHubMarkdown.ps1 b/src/functions/public/Markdown/Get-GitHubMarkdown.ps1 index b85aaba28..3ba19ea1d 100644 --- a/src/functions/public/Markdown/Get-GitHubMarkdown.ps1 +++ b/src/functions/public/Markdown/Get-GitHubMarkdown.ps1 @@ -46,13 +46,13 @@ # 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) + [object] $Context ) begin { $stackPath = Get-PSCallStackPath Write-Debug "[$stackPath] - Start" - $Context = Resolve-GitHubContext -Context $Context + $Context = Resolve-GitHubContext -Context $Context -Anonymous $Anonymous Assert-GitHubContext -Context $Context -AuthType IAT, PAT, UAT, Anonymous } @@ -67,7 +67,6 @@ Method = 'POST' APIEndpoint = '/markdown' Body = $body - Anonymous = $Anonymous Context = $Context } diff --git a/src/functions/public/Markdown/Get-GitHubMarkdownRaw.ps1 b/src/functions/public/Markdown/Get-GitHubMarkdownRaw.ps1 index 73b554463..54358242d 100644 --- a/src/functions/public/Markdown/Get-GitHubMarkdownRaw.ps1 +++ b/src/functions/public/Markdown/Get-GitHubMarkdownRaw.ps1 @@ -33,13 +33,13 @@ # 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) + [object] $Context ) begin { $stackPath = Get-PSCallStackPath Write-Debug "[$stackPath] - Start" - $Context = Resolve-GitHubContext -Context $Context + $Context = Resolve-GitHubContext -Context $Context -Anonymous $Anonymous Assert-GitHubContext -Context $Context -AuthType IAT, PAT, UAT, Anonymous } @@ -53,7 +53,6 @@ APIEndpoint = '/markdown/raw' ContentType = 'text/plain' Body = $body - Anonymous = $Anonymous Context = $Context } diff --git a/src/functions/public/Meta/Get-GitHubApiVersion.ps1 b/src/functions/public/Meta/Get-GitHubApiVersion.ps1 index 9979f11d6..e95f0b309 100644 --- a/src/functions/public/Meta/Get-GitHubApiVersion.ps1 +++ b/src/functions/public/Meta/Get-GitHubApiVersion.ps1 @@ -27,13 +27,13 @@ # 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) + [object] $Context ) begin { $stackPath = Get-PSCallStackPath Write-Debug "[$stackPath] - Start" - $Context = Resolve-GitHubContext -Context $Context + $Context = Resolve-GitHubContext -Context $Context -Anonymous $Anonymous Assert-GitHubContext -Context $Context -AuthType IAT, PAT, UAT, Anonymous } @@ -41,7 +41,6 @@ $inputObject = @{ Method = 'GET' ApiEndpoint = '/versions' - Anonymous = $Anonymous Context = $Context } diff --git a/src/functions/public/Meta/Get-GitHubMeta.ps1 b/src/functions/public/Meta/Get-GitHubMeta.ps1 index 7f2808582..ad6a36efc 100644 --- a/src/functions/public/Meta/Get-GitHubMeta.ps1 +++ b/src/functions/public/Meta/Get-GitHubMeta.ps1 @@ -35,13 +35,13 @@ # 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) + [object] $Context ) begin { $stackPath = Get-PSCallStackPath Write-Debug "[$stackPath] - Start" - $Context = Resolve-GitHubContext -Context $Context + $Context = Resolve-GitHubContext -Context $Context -Anonymous $Anonymous Assert-GitHubContext -Context $Context -AuthType IAT, PAT, UAT, Anonymous } @@ -49,7 +49,6 @@ $inputObject = @{ Method = 'GET' ApiEndpoint = '/meta' - Anonymous = $Anonymous Context = $Context } diff --git a/src/functions/public/Meta/Get-GitHubOctocat.ps1 b/src/functions/public/Meta/Get-GitHubOctocat.ps1 index 6fc35e0f5..600ff3268 100644 --- a/src/functions/public/Meta/Get-GitHubOctocat.ps1 +++ b/src/functions/public/Meta/Get-GitHubOctocat.ps1 @@ -36,13 +36,13 @@ # 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) + [object] $Context ) begin { $stackPath = Get-PSCallStackPath Write-Debug "[$stackPath] - Start" - $Context = Resolve-GitHubContext -Context $Context + $Context = Resolve-GitHubContext -Context $Context -Anonymous $Anonymous Assert-GitHubContext -Context $Context -AuthType IAT, PAT, UAT, Anonymous } @@ -55,7 +55,6 @@ Method = 'GET' APIEndpoint = '/octocat' Body = $body - Anonymous = $Anonymous Context = $Context } diff --git a/src/functions/public/Meta/Get-GitHubRoot.ps1 b/src/functions/public/Meta/Get-GitHubRoot.ps1 index aafd66157..b38e36842 100644 --- a/src/functions/public/Meta/Get-GitHubRoot.ps1 +++ b/src/functions/public/Meta/Get-GitHubRoot.ps1 @@ -26,13 +26,13 @@ # 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) + [object] $Context ) begin { $stackPath = Get-PSCallStackPath Write-Debug "[$stackPath] - Start" - $Context = Resolve-GitHubContext -Context $Context + $Context = Resolve-GitHubContext -Context $Context -Anonymous $Anonymous Assert-GitHubContext -Context $Context -AuthType IAT, PAT, UAT, Anonymous } @@ -40,7 +40,6 @@ $inputObject = @{ Method = 'GET' APIEndpoint = '/' - Anonymous = $Anonymous Context = $Context } diff --git a/src/functions/public/Meta/Get-GitHubZen.ps1 b/src/functions/public/Meta/Get-GitHubZen.ps1 index 746da840d..274989e2e 100644 --- a/src/functions/public/Meta/Get-GitHubZen.ps1 +++ b/src/functions/public/Meta/Get-GitHubZen.ps1 @@ -26,13 +26,13 @@ # 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) + [object] $Context ) begin { $stackPath = Get-PSCallStackPath Write-Debug "[$stackPath] - Start" - $Context = Resolve-GitHubContext -Context $Context + $Context = Resolve-GitHubContext -Context $Context -Anonymous $Anonymous Assert-GitHubContext -Context $Context -AuthType IAT, PAT, UAT, Anonymous } @@ -40,7 +40,6 @@ $inputObject = @{ Method = 'GET' APIEndpoint = '/zen' - Anonymous = $Anonymous Context = $Context } diff --git a/src/functions/public/Organization/Get-GitHubOrganization.ps1 b/src/functions/public/Organization/Get-GitHubOrganization.ps1 index ca19008c8..7235dac7e 100644 --- a/src/functions/public/Organization/Get-GitHubOrganization.ps1 +++ b/src/functions/public/Organization/Get-GitHubOrganization.ps1 @@ -89,7 +89,7 @@ # 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) + [object] $Context ) begin { diff --git a/src/functions/public/Organization/Members/Get-GitHubOrganizationMember.ps1 b/src/functions/public/Organization/Members/Get-GitHubOrganizationMember.ps1 index 139af005e..75e9bc920 100644 --- a/src/functions/public/Organization/Members/Get-GitHubOrganizationMember.ps1 +++ b/src/functions/public/Organization/Members/Get-GitHubOrganizationMember.ps1 @@ -42,7 +42,7 @@ # 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) + [object] $Context ) begin { diff --git a/src/functions/public/Organization/Members/Get-GitHubOrganizationPendingInvitation.ps1 b/src/functions/public/Organization/Members/Get-GitHubOrganizationPendingInvitation.ps1 index 6260a0399..a3a423aae 100644 --- a/src/functions/public/Organization/Members/Get-GitHubOrganizationPendingInvitation.ps1 +++ b/src/functions/public/Organization/Members/Get-GitHubOrganizationPendingInvitation.ps1 @@ -48,7 +48,7 @@ # 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) + [object] $Context ) begin { diff --git a/src/functions/public/Organization/Members/New-GitHubOrganizationInvitation.ps1 b/src/functions/public/Organization/Members/New-GitHubOrganizationInvitation.ps1 index b5c8d8731..7f6b5015c 100644 --- a/src/functions/public/Organization/Members/New-GitHubOrganizationInvitation.ps1 +++ b/src/functions/public/Organization/Members/New-GitHubOrganizationInvitation.ps1 @@ -67,7 +67,7 @@ # 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) + [object] $Context ) begin { diff --git a/src/functions/public/Organization/Members/Remove-GitHubOrganizationInvitation.ps1 b/src/functions/public/Organization/Members/Remove-GitHubOrganizationInvitation.ps1 index 8bc669cbc..de656a1aa 100644 --- a/src/functions/public/Organization/Members/Remove-GitHubOrganizationInvitation.ps1 +++ b/src/functions/public/Organization/Members/Remove-GitHubOrganizationInvitation.ps1 @@ -40,7 +40,7 @@ # 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) + [object] $Context ) begin { diff --git a/src/functions/public/Organization/Remove-GitHubOrganization.ps1 b/src/functions/public/Organization/Remove-GitHubOrganization.ps1 index 5fbe53abf..0d9f3c310 100644 --- a/src/functions/public/Organization/Remove-GitHubOrganization.ps1 +++ b/src/functions/public/Organization/Remove-GitHubOrganization.ps1 @@ -37,7 +37,7 @@ # 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) + [object] $Context ) begin { diff --git a/src/functions/public/Organization/Update-GitHubOrganization.ps1 b/src/functions/public/Organization/Update-GitHubOrganization.ps1 index d8b0759cf..5023ec0d8 100644 --- a/src/functions/public/Organization/Update-GitHubOrganization.ps1 +++ b/src/functions/public/Organization/Update-GitHubOrganization.ps1 @@ -157,7 +157,7 @@ # 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) + [object] $Context ) begin { diff --git a/src/functions/public/Rate-Limit/Get-GitHubRateLimit.ps1 b/src/functions/public/Rate-Limit/Get-GitHubRateLimit.ps1 index 7b1cee56e..3d3a193e1 100644 --- a/src/functions/public/Rate-Limit/Get-GitHubRateLimit.ps1 +++ b/src/functions/public/Rate-Limit/Get-GitHubRateLimit.ps1 @@ -43,13 +43,13 @@ # 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) + [object] $Context ) begin { $stackPath = Get-PSCallStackPath Write-Debug "[$stackPath] - Start" - $Context = Resolve-GitHubContext -Context $Context + $Context = Resolve-GitHubContext -Context $Context -Anonymous $Anonymous Assert-GitHubContext -Context $Context -AuthType IAT, PAT, UAT, Anonymous } @@ -57,7 +57,6 @@ $inputObject = @{ Method = 'GET' APIEndpoint = '/rate_limit' - Anonymous = $Anonymous Context = $Context } diff --git a/src/functions/public/Releases/Assets/Add-GitHubReleaseAsset.ps1 b/src/functions/public/Releases/Assets/Add-GitHubReleaseAsset.ps1 index 92123b57f..a713bad96 100644 --- a/src/functions/public/Releases/Assets/Add-GitHubReleaseAsset.ps1 +++ b/src/functions/public/Releases/Assets/Add-GitHubReleaseAsset.ps1 @@ -94,7 +94,7 @@ # 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) + [object] $Context ) begin { diff --git a/src/functions/public/Releases/Assets/Get-GitHubReleaseAsset.ps1 b/src/functions/public/Releases/Assets/Get-GitHubReleaseAsset.ps1 index eaf975156..5042c6582 100644 --- a/src/functions/public/Releases/Assets/Get-GitHubReleaseAsset.ps1 +++ b/src/functions/public/Releases/Assets/Get-GitHubReleaseAsset.ps1 @@ -76,7 +76,7 @@ # 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) + [object] $Context ) begin { diff --git a/src/functions/public/Releases/Assets/Remove-GitHubReleaseAsset.ps1 b/src/functions/public/Releases/Assets/Remove-GitHubReleaseAsset.ps1 index 1ebe7ab5b..22e0c5f89 100644 --- a/src/functions/public/Releases/Assets/Remove-GitHubReleaseAsset.ps1 +++ b/src/functions/public/Releases/Assets/Remove-GitHubReleaseAsset.ps1 @@ -38,7 +38,7 @@ # 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) + [object] $Context ) begin { diff --git a/src/functions/public/Releases/Assets/Save-GitHubReleaseAsset.ps1 b/src/functions/public/Releases/Assets/Save-GitHubReleaseAsset.ps1 index 88321e97a..038224750 100644 --- a/src/functions/public/Releases/Assets/Save-GitHubReleaseAsset.ps1 +++ b/src/functions/public/Releases/Assets/Save-GitHubReleaseAsset.ps1 @@ -119,7 +119,7 @@ # 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) + [object] $Context ) begin { diff --git a/src/functions/public/Releases/Assets/Update-GitHubReleaseAsset.ps1 b/src/functions/public/Releases/Assets/Update-GitHubReleaseAsset.ps1 index 2bfd9f554..a632eaaef 100644 --- a/src/functions/public/Releases/Assets/Update-GitHubReleaseAsset.ps1 +++ b/src/functions/public/Releases/Assets/Update-GitHubReleaseAsset.ps1 @@ -56,7 +56,7 @@ # 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) + [object] $Context ) begin { diff --git a/src/functions/public/Releases/Get-GitHubRelease.ps1 b/src/functions/public/Releases/Get-GitHubRelease.ps1 index 7bd82ce2f..e4bd3081c 100644 --- a/src/functions/public/Releases/Get-GitHubRelease.ps1 +++ b/src/functions/public/Releases/Get-GitHubRelease.ps1 @@ -72,7 +72,7 @@ # 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) + [object] $Context ) begin { diff --git a/src/functions/public/Releases/New-GitHubRelease.ps1 b/src/functions/public/Releases/New-GitHubRelease.ps1 index 488560be0..7d4c239fa 100644 --- a/src/functions/public/Releases/New-GitHubRelease.ps1 +++ b/src/functions/public/Releases/New-GitHubRelease.ps1 @@ -108,7 +108,7 @@ # 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) + [object] $Context ) begin { diff --git a/src/functions/public/Releases/New-GitHubReleaseNote.ps1 b/src/functions/public/Releases/New-GitHubReleaseNote.ps1 index d2b937143..210789b9b 100644 --- a/src/functions/public/Releases/New-GitHubReleaseNote.ps1 +++ b/src/functions/public/Releases/New-GitHubReleaseNote.ps1 @@ -99,7 +99,7 @@ # 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) + [object] $Context ) begin { diff --git a/src/functions/public/Releases/Remove-GitHubRelease.ps1 b/src/functions/public/Releases/Remove-GitHubRelease.ps1 index 5f2f4ef84..409e47711 100644 --- a/src/functions/public/Releases/Remove-GitHubRelease.ps1 +++ b/src/functions/public/Releases/Remove-GitHubRelease.ps1 @@ -42,7 +42,7 @@ # 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) + [object] $Context ) begin { diff --git a/src/functions/public/Releases/Set-GitHubRelease.ps1 b/src/functions/public/Releases/Set-GitHubRelease.ps1 index e0df36825..41f0e483e 100644 --- a/src/functions/public/Releases/Set-GitHubRelease.ps1 +++ b/src/functions/public/Releases/Set-GitHubRelease.ps1 @@ -120,7 +120,7 @@ # 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) + [object] $Context ) begin { diff --git a/src/functions/public/Releases/Update-GitHubRelease.ps1 b/src/functions/public/Releases/Update-GitHubRelease.ps1 index fbbedfa13..657fbbe0d 100644 --- a/src/functions/public/Releases/Update-GitHubRelease.ps1 +++ b/src/functions/public/Releases/Update-GitHubRelease.ps1 @@ -113,7 +113,7 @@ # 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) + [object] $Context ) begin { diff --git a/src/functions/public/Repositories/Autolinks/Get-GitHubRepositoryAutolink.ps1 b/src/functions/public/Repositories/Autolinks/Get-GitHubRepositoryAutolink.ps1 index f8ed83b77..21aaed536 100644 --- a/src/functions/public/Repositories/Autolinks/Get-GitHubRepositoryAutolink.ps1 +++ b/src/functions/public/Repositories/Autolinks/Get-GitHubRepositoryAutolink.ps1 @@ -48,7 +48,7 @@ # 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) + [object] $Context ) begin { diff --git a/src/functions/public/Repositories/Autolinks/New-GitHubRepositoryAutolink.ps1 b/src/functions/public/Repositories/Autolinks/New-GitHubRepositoryAutolink.ps1 index 0ec275cfd..0e14196ef 100644 --- a/src/functions/public/Repositories/Autolinks/New-GitHubRepositoryAutolink.ps1 +++ b/src/functions/public/Repositories/Autolinks/New-GitHubRepositoryAutolink.ps1 @@ -50,7 +50,7 @@ # 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) + [object] $Context ) begin { diff --git a/src/functions/public/Repositories/Autolinks/Remove-GitHubRepositoryAutolink.ps1 b/src/functions/public/Repositories/Autolinks/Remove-GitHubRepositoryAutolink.ps1 index ae7283bba..27fcd6fcc 100644 --- a/src/functions/public/Repositories/Autolinks/Remove-GitHubRepositoryAutolink.ps1 +++ b/src/functions/public/Repositories/Autolinks/Remove-GitHubRepositoryAutolink.ps1 @@ -40,7 +40,7 @@ # 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) + [object] $Context ) begin { diff --git a/src/functions/public/Repositories/CustomProperties/Get-GitHubRepositoryCustomProperty.ps1 b/src/functions/public/Repositories/CustomProperties/Get-GitHubRepositoryCustomProperty.ps1 index 3ded17c1d..58b814718 100644 --- a/src/functions/public/Repositories/CustomProperties/Get-GitHubRepositoryCustomProperty.ps1 +++ b/src/functions/public/Repositories/CustomProperties/Get-GitHubRepositoryCustomProperty.ps1 @@ -35,7 +35,7 @@ # 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) + [object] $Context ) begin { diff --git a/src/functions/public/Repositories/Get-GitHubRepository.ps1 b/src/functions/public/Repositories/Get-GitHubRepository.ps1 index 54d248b2d..84e3311c6 100644 --- a/src/functions/public/Repositories/Get-GitHubRepository.ps1 +++ b/src/functions/public/Repositories/Get-GitHubRepository.ps1 @@ -77,7 +77,7 @@ # 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) + [object] $Context ) begin { diff --git a/src/functions/public/Repositories/Move-GitHubRepository.ps1 b/src/functions/public/Repositories/Move-GitHubRepository.ps1 index 42eb898cc..599061245 100644 --- a/src/functions/public/Repositories/Move-GitHubRepository.ps1 +++ b/src/functions/public/Repositories/Move-GitHubRepository.ps1 @@ -54,7 +54,7 @@ # 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) + [object] $Context ) begin { diff --git a/src/functions/public/Repositories/New-GitHubRepository.ps1 b/src/functions/public/Repositories/New-GitHubRepository.ps1 index 65f150540..cc0a0d7dd 100644 --- a/src/functions/public/Repositories/New-GitHubRepository.ps1 +++ b/src/functions/public/Repositories/New-GitHubRepository.ps1 @@ -268,7 +268,7 @@ # 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) + [object] $Context ) begin { diff --git a/src/functions/public/Repositories/Remove-GitHubRepository.ps1 b/src/functions/public/Repositories/Remove-GitHubRepository.ps1 index 1d80d56fe..952211811 100644 --- a/src/functions/public/Repositories/Remove-GitHubRepository.ps1 +++ b/src/functions/public/Repositories/Remove-GitHubRepository.ps1 @@ -36,7 +36,7 @@ # 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) + [object] $Context ) begin { diff --git a/src/functions/public/Repositories/Repositories/Disable-GitHubRepositoryPrivateVulnerabilityReporting.ps1 b/src/functions/public/Repositories/Repositories/Disable-GitHubRepositoryPrivateVulnerabilityReporting.ps1 index 5999c9de4..d68a8969c 100644 --- a/src/functions/public/Repositories/Repositories/Disable-GitHubRepositoryPrivateVulnerabilityReporting.ps1 +++ b/src/functions/public/Repositories/Repositories/Disable-GitHubRepositoryPrivateVulnerabilityReporting.ps1 @@ -33,7 +33,7 @@ # 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) + [object] $Context ) begin { diff --git a/src/functions/public/Repositories/Repositories/Disable-GitHubRepositorySecurityFix.ps1 b/src/functions/public/Repositories/Repositories/Disable-GitHubRepositorySecurityFix.ps1 index aec767d7d..66bf3a7c1 100644 --- a/src/functions/public/Repositories/Repositories/Disable-GitHubRepositorySecurityFix.ps1 +++ b/src/functions/public/Repositories/Repositories/Disable-GitHubRepositorySecurityFix.ps1 @@ -33,7 +33,7 @@ # 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) + [object] $Context ) begin { diff --git a/src/functions/public/Repositories/Repositories/Disable-GitHubRepositoryVulnerabilityAlert.ps1 b/src/functions/public/Repositories/Repositories/Disable-GitHubRepositoryVulnerabilityAlert.ps1 index 858b1da4f..e56f7d50b 100644 --- a/src/functions/public/Repositories/Repositories/Disable-GitHubRepositoryVulnerabilityAlert.ps1 +++ b/src/functions/public/Repositories/Repositories/Disable-GitHubRepositoryVulnerabilityAlert.ps1 @@ -33,7 +33,7 @@ # 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) + [object] $Context ) begin { diff --git a/src/functions/public/Repositories/Repositories/Enable-GitHubRepositoryPrivateVulnerabilityReporting.ps1 b/src/functions/public/Repositories/Repositories/Enable-GitHubRepositoryPrivateVulnerabilityReporting.ps1 index 9a8e2693e..674d94cb0 100644 --- a/src/functions/public/Repositories/Repositories/Enable-GitHubRepositoryPrivateVulnerabilityReporting.ps1 +++ b/src/functions/public/Repositories/Repositories/Enable-GitHubRepositoryPrivateVulnerabilityReporting.ps1 @@ -33,7 +33,7 @@ # 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) + [object] $Context ) begin { diff --git a/src/functions/public/Repositories/Repositories/Enable-GitHubRepositorySecurityFix.ps1 b/src/functions/public/Repositories/Repositories/Enable-GitHubRepositorySecurityFix.ps1 index 29586abeb..4e3a04c5f 100644 --- a/src/functions/public/Repositories/Repositories/Enable-GitHubRepositorySecurityFix.ps1 +++ b/src/functions/public/Repositories/Repositories/Enable-GitHubRepositorySecurityFix.ps1 @@ -33,7 +33,7 @@ # 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) + [object] $Context ) begin { diff --git a/src/functions/public/Repositories/Repositories/Enable-GitHubRepositoryVulnerabilityAlert.ps1 b/src/functions/public/Repositories/Repositories/Enable-GitHubRepositoryVulnerabilityAlert.ps1 index 7b587e24a..09bb6f7f1 100644 --- a/src/functions/public/Repositories/Repositories/Enable-GitHubRepositoryVulnerabilityAlert.ps1 +++ b/src/functions/public/Repositories/Repositories/Enable-GitHubRepositoryVulnerabilityAlert.ps1 @@ -34,7 +34,7 @@ # 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) + [object] $Context ) begin { diff --git a/src/functions/public/Repositories/Repositories/Get-GitHubRepositoryActivity.ps1 b/src/functions/public/Repositories/Repositories/Get-GitHubRepositoryActivity.ps1 index 94968f0aa..283394912 100644 --- a/src/functions/public/Repositories/Repositories/Get-GitHubRepositoryActivity.ps1 +++ b/src/functions/public/Repositories/Repositories/Get-GitHubRepositoryActivity.ps1 @@ -107,7 +107,7 @@ # 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) + [object] $Context ) begin { diff --git a/src/functions/public/Repositories/Repositories/Get-GitHubRepositoryCodeownersError.ps1 b/src/functions/public/Repositories/Repositories/Get-GitHubRepositoryCodeownersError.ps1 index 7820a8d5b..6ce679aa2 100644 --- a/src/functions/public/Repositories/Repositories/Get-GitHubRepositoryCodeownersError.ps1 +++ b/src/functions/public/Repositories/Repositories/Get-GitHubRepositoryCodeownersError.ps1 @@ -41,7 +41,7 @@ # 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) + [object] $Context ) begin { diff --git a/src/functions/public/Repositories/Repositories/Get-GitHubRepositoryContributor.ps1 b/src/functions/public/Repositories/Repositories/Get-GitHubRepositoryContributor.ps1 index 20bc5abe1..be517a48e 100644 --- a/src/functions/public/Repositories/Repositories/Get-GitHubRepositoryContributor.ps1 +++ b/src/functions/public/Repositories/Repositories/Get-GitHubRepositoryContributor.ps1 @@ -45,7 +45,7 @@ # 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) + [object] $Context ) begin { diff --git a/src/functions/public/Repositories/Repositories/Get-GitHubRepositoryFork.ps1 b/src/functions/public/Repositories/Repositories/Get-GitHubRepositoryFork.ps1 index e8d20d981..87bfe3c2d 100644 --- a/src/functions/public/Repositories/Repositories/Get-GitHubRepositoryFork.ps1 +++ b/src/functions/public/Repositories/Repositories/Get-GitHubRepositoryFork.ps1 @@ -41,7 +41,7 @@ # 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) + [object] $Context ) begin { diff --git a/src/functions/public/Repositories/Repositories/Get-GitHubRepositoryLanguage.ps1 b/src/functions/public/Repositories/Repositories/Get-GitHubRepositoryLanguage.ps1 index 097a12921..9ac7934fc 100644 --- a/src/functions/public/Repositories/Repositories/Get-GitHubRepositoryLanguage.ps1 +++ b/src/functions/public/Repositories/Repositories/Get-GitHubRepositoryLanguage.ps1 @@ -34,7 +34,7 @@ # 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) + [object] $Context ) begin { diff --git a/src/functions/public/Repositories/Repositories/Get-GitHubRepositorySecurityFix.ps1 b/src/functions/public/Repositories/Repositories/Get-GitHubRepositorySecurityFix.ps1 index 7112444dc..e5356b44d 100644 --- a/src/functions/public/Repositories/Repositories/Get-GitHubRepositorySecurityFix.ps1 +++ b/src/functions/public/Repositories/Repositories/Get-GitHubRepositorySecurityFix.ps1 @@ -36,7 +36,7 @@ # 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) + [object] $Context ) begin { diff --git a/src/functions/public/Repositories/Repositories/Get-GitHubRepositoryTag.ps1 b/src/functions/public/Repositories/Repositories/Get-GitHubRepositoryTag.ps1 index cd86defb3..3bce11daf 100644 --- a/src/functions/public/Repositories/Repositories/Get-GitHubRepositoryTag.ps1 +++ b/src/functions/public/Repositories/Repositories/Get-GitHubRepositoryTag.ps1 @@ -37,7 +37,7 @@ # 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) + [object] $Context ) begin { diff --git a/src/functions/public/Repositories/Repositories/Get-GitHubRepositoryTeam.ps1 b/src/functions/public/Repositories/Repositories/Get-GitHubRepositoryTeam.ps1 index 377612119..a9bacc676 100644 --- a/src/functions/public/Repositories/Repositories/Get-GitHubRepositoryTeam.ps1 +++ b/src/functions/public/Repositories/Repositories/Get-GitHubRepositoryTeam.ps1 @@ -45,7 +45,7 @@ # 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) + [object] $Context ) begin { diff --git a/src/functions/public/Repositories/Repositories/Get-GitHubRepositoryTopic.ps1 b/src/functions/public/Repositories/Repositories/Get-GitHubRepositoryTopic.ps1 index 87f4720cb..8ef7f644b 100644 --- a/src/functions/public/Repositories/Repositories/Get-GitHubRepositoryTopic.ps1 +++ b/src/functions/public/Repositories/Repositories/Get-GitHubRepositoryTopic.ps1 @@ -33,7 +33,7 @@ # 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) + [object] $Context ) begin { diff --git a/src/functions/public/Repositories/Repositories/Set-GitHubRepositoryTopic.ps1 b/src/functions/public/Repositories/Repositories/Set-GitHubRepositoryTopic.ps1 index 6066bc932..21230444e 100644 --- a/src/functions/public/Repositories/Repositories/Set-GitHubRepositoryTopic.ps1 +++ b/src/functions/public/Repositories/Repositories/Set-GitHubRepositoryTopic.ps1 @@ -35,7 +35,7 @@ # 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) + [object] $Context ) begin { diff --git a/src/functions/public/Repositories/Repositories/Start-GitHubRepositoryEvent.ps1 b/src/functions/public/Repositories/Repositories/Start-GitHubRepositoryEvent.ps1 index 8b0c40c29..ca5b19c3f 100644 --- a/src/functions/public/Repositories/Repositories/Start-GitHubRepositoryEvent.ps1 +++ b/src/functions/public/Repositories/Repositories/Start-GitHubRepositoryEvent.ps1 @@ -66,7 +66,7 @@ # 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) + [object] $Context ) begin { diff --git a/src/functions/public/Repositories/Repositories/Test-GitHubRepositoryVulnerabilityAlert.ps1 b/src/functions/public/Repositories/Repositories/Test-GitHubRepositoryVulnerabilityAlert.ps1 index dbeee827d..0fdaa1c1d 100644 --- a/src/functions/public/Repositories/Repositories/Test-GitHubRepositoryVulnerabilityAlert.ps1 +++ b/src/functions/public/Repositories/Repositories/Test-GitHubRepositoryVulnerabilityAlert.ps1 @@ -37,7 +37,7 @@ # 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) + [object] $Context ) begin { diff --git a/src/functions/public/Repositories/RuleSuite/Get-GitHubRepositoryRuleSuite.ps1 b/src/functions/public/Repositories/RuleSuite/Get-GitHubRepositoryRuleSuite.ps1 index a851d1214..d24ceb1e3 100644 --- a/src/functions/public/Repositories/RuleSuite/Get-GitHubRepositoryRuleSuite.ps1 +++ b/src/functions/public/Repositories/RuleSuite/Get-GitHubRepositoryRuleSuite.ps1 @@ -81,7 +81,7 @@ # 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) + [object] $Context ) begin { diff --git a/src/functions/public/Repositories/RuleSuite/Get-GitHubRepositoryRuleSuiteById.ps1 b/src/functions/public/Repositories/RuleSuite/Get-GitHubRepositoryRuleSuiteById.ps1 index 03645734f..0bce42cff 100644 --- a/src/functions/public/Repositories/RuleSuite/Get-GitHubRepositoryRuleSuiteById.ps1 +++ b/src/functions/public/Repositories/RuleSuite/Get-GitHubRepositoryRuleSuiteById.ps1 @@ -40,7 +40,7 @@ # 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) + [object] $Context ) begin { diff --git a/src/functions/public/Repositories/RuleSuite/Get-GitHubRepositoryRuleSuiteList.ps1 b/src/functions/public/Repositories/RuleSuite/Get-GitHubRepositoryRuleSuiteList.ps1 index 7dba26c29..d124a6b77 100644 --- a/src/functions/public/Repositories/RuleSuite/Get-GitHubRepositoryRuleSuiteList.ps1 +++ b/src/functions/public/Repositories/RuleSuite/Get-GitHubRepositoryRuleSuiteList.ps1 @@ -68,7 +68,7 @@ # 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) + [object] $Context ) begin { diff --git a/src/functions/public/Repositories/Set-GitHubRepository.ps1 b/src/functions/public/Repositories/Set-GitHubRepository.ps1 index 80df95352..2035521dc 100644 --- a/src/functions/public/Repositories/Set-GitHubRepository.ps1 +++ b/src/functions/public/Repositories/Set-GitHubRepository.ps1 @@ -1,4 +1,4 @@ -function Set-GitHubRepository { +function Set-GitHubRepository { <# .SYNOPSIS Creates or updates a repository. @@ -206,7 +206,7 @@ function Set-GitHubRepository { # 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) + [object] $Context ) begin { $stackPath = Get-PSCallStackPath diff --git a/src/functions/public/Repositories/Update-GitHubRepository.ps1 b/src/functions/public/Repositories/Update-GitHubRepository.ps1 index 7eec5d611..d326e0321 100644 --- a/src/functions/public/Repositories/Update-GitHubRepository.ps1 +++ b/src/functions/public/Repositories/Update-GitHubRepository.ps1 @@ -153,7 +153,7 @@ # 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) + [object] $Context ) begin { diff --git a/src/functions/public/Secrets/Get-GitHubPublicKey.ps1 b/src/functions/public/Secrets/Get-GitHubPublicKey.ps1 index ea0db115e..f92772834 100644 --- a/src/functions/public/Secrets/Get-GitHubPublicKey.ps1 +++ b/src/functions/public/Secrets/Get-GitHubPublicKey.ps1 @@ -53,7 +53,7 @@ # 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) + [object] $Context ) begin { diff --git a/src/functions/public/Secrets/Get-GitHubSecret.ps1 b/src/functions/public/Secrets/Get-GitHubSecret.ps1 index 5bf3c54bd..13c2adde2 100644 --- a/src/functions/public/Secrets/Get-GitHubSecret.ps1 +++ b/src/functions/public/Secrets/Get-GitHubSecret.ps1 @@ -72,7 +72,7 @@ # 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) + [object] $Context ) begin { diff --git a/src/functions/public/Secrets/Remove-GitHubSecret.ps1 b/src/functions/public/Secrets/Remove-GitHubSecret.ps1 index 01cba46da..4c8295d57 100644 --- a/src/functions/public/Secrets/Remove-GitHubSecret.ps1 +++ b/src/functions/public/Secrets/Remove-GitHubSecret.ps1 @@ -61,7 +61,7 @@ # 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), + [object] $Context, [Parameter(Mandatory, ParameterSetName = 'ArrayInput', ValueFromPipeline)] [GitHubSecret[]] $InputObject diff --git a/src/functions/public/Secrets/SelectedRepository/Add-GitHubSecretSelectedRepository.ps1 b/src/functions/public/Secrets/SelectedRepository/Add-GitHubSecretSelectedRepository.ps1 index c6f7df96b..a6f8f4f74 100644 --- a/src/functions/public/Secrets/SelectedRepository/Add-GitHubSecretSelectedRepository.ps1 +++ b/src/functions/public/Secrets/SelectedRepository/Add-GitHubSecretSelectedRepository.ps1 @@ -50,7 +50,7 @@ # 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) + [object] $Context ) begin { diff --git a/src/functions/public/Secrets/SelectedRepository/Get-GitHubSecretSelectedRepository.ps1 b/src/functions/public/Secrets/SelectedRepository/Get-GitHubSecretSelectedRepository.ps1 index 98a640304..fe814b412 100644 --- a/src/functions/public/Secrets/SelectedRepository/Get-GitHubSecretSelectedRepository.ps1 +++ b/src/functions/public/Secrets/SelectedRepository/Get-GitHubSecretSelectedRepository.ps1 @@ -1,4 +1,4 @@ -function Get-GitHubSecretSelectedRepository { +function Get-GitHubSecretSelectedRepository { <# .SYNOPSIS List selected repositories for an organization secret. @@ -61,7 +61,7 @@ function Get-GitHubSecretSelectedRepository { # 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) + [object] $Context ) begin { diff --git a/src/functions/public/Secrets/SelectedRepository/Remove-GitHubSecretSelectedRepository.ps1 b/src/functions/public/Secrets/SelectedRepository/Remove-GitHubSecretSelectedRepository.ps1 index f372d47d5..446259266 100644 --- a/src/functions/public/Secrets/SelectedRepository/Remove-GitHubSecretSelectedRepository.ps1 +++ b/src/functions/public/Secrets/SelectedRepository/Remove-GitHubSecretSelectedRepository.ps1 @@ -49,7 +49,7 @@ # 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) + [object] $Context ) begin { diff --git a/src/functions/public/Secrets/SelectedRepository/Set-GitHubSecretSelectedRepository.ps1 b/src/functions/public/Secrets/SelectedRepository/Set-GitHubSecretSelectedRepository.ps1 index b7cf93174..b671b8e3a 100644 --- a/src/functions/public/Secrets/SelectedRepository/Set-GitHubSecretSelectedRepository.ps1 +++ b/src/functions/public/Secrets/SelectedRepository/Set-GitHubSecretSelectedRepository.ps1 @@ -42,7 +42,7 @@ # 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) + [object] $Context ) begin { diff --git a/src/functions/public/Secrets/Set-GitHubSecret.ps1 b/src/functions/public/Secrets/Set-GitHubSecret.ps1 index 1c8aa7d57..a92474e0e 100644 --- a/src/functions/public/Secrets/Set-GitHubSecret.ps1 +++ b/src/functions/public/Secrets/Set-GitHubSecret.ps1 @@ -1,6 +1,4 @@ -#Requires -Modules @{ ModuleName = 'Sodium'; RequiredVersion = '2.1.2'} - -function Set-GitHubSecret { +function Set-GitHubSecret { <# .SYNOPSIS Updates a GitHub secret for an organization, repository, or user. @@ -91,7 +89,7 @@ function Set-GitHubSecret { # 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) + [object] $Context ) begin { @@ -145,3 +143,4 @@ function Set-GitHubSecret { Write-Debug "[$stackPath] - End" } } +#Requires -Modules @{ ModuleName = 'Sodium'; RequiredVersion = '2.2.0'} diff --git a/src/functions/public/Teams/Get-GitHubTeam.ps1 b/src/functions/public/Teams/Get-GitHubTeam.ps1 index bfe863afc..c0b934511 100644 --- a/src/functions/public/Teams/Get-GitHubTeam.ps1 +++ b/src/functions/public/Teams/Get-GitHubTeam.ps1 @@ -39,7 +39,7 @@ # 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) + [object] $Context ) begin { diff --git a/src/functions/public/Teams/New-GitHubTeam.ps1 b/src/functions/public/Teams/New-GitHubTeam.ps1 index 29ebd4328..f1e7a32ba 100644 --- a/src/functions/public/Teams/New-GitHubTeam.ps1 +++ b/src/functions/public/Teams/New-GitHubTeam.ps1 @@ -85,7 +85,7 @@ # 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) + [object] $Context ) begin { diff --git a/src/functions/public/Teams/Remove-GitHubTeam.ps1 b/src/functions/public/Teams/Remove-GitHubTeam.ps1 index bdeabf2d6..3328a3afc 100644 --- a/src/functions/public/Teams/Remove-GitHubTeam.ps1 +++ b/src/functions/public/Teams/Remove-GitHubTeam.ps1 @@ -31,7 +31,7 @@ # 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) + [object] $Context ) begin { diff --git a/src/functions/public/Teams/Update-GitHubTeam.ps1 b/src/functions/public/Teams/Update-GitHubTeam.ps1 index d81d5a59a..ce365b3b0 100644 --- a/src/functions/public/Teams/Update-GitHubTeam.ps1 +++ b/src/functions/public/Teams/Update-GitHubTeam.ps1 @@ -79,7 +79,7 @@ # 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) + [object] $Context ) begin { diff --git a/src/functions/public/Users/Blocking/Block-GitHubUser.ps1 b/src/functions/public/Users/Blocking/Block-GitHubUser.ps1 index c403558d5..641d5b63a 100644 --- a/src/functions/public/Users/Blocking/Block-GitHubUser.ps1 +++ b/src/functions/public/Users/Blocking/Block-GitHubUser.ps1 @@ -49,7 +49,7 @@ # 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) + [object] $Context ) begin { diff --git a/src/functions/public/Users/Blocking/Get-GitHubBlockedUser.ps1 b/src/functions/public/Users/Blocking/Get-GitHubBlockedUser.ps1 index 3ad626ab5..70b16658e 100644 --- a/src/functions/public/Users/Blocking/Get-GitHubBlockedUser.ps1 +++ b/src/functions/public/Users/Blocking/Get-GitHubBlockedUser.ps1 @@ -41,7 +41,7 @@ # 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) + [object] $Context ) begin { diff --git a/src/functions/public/Users/Blocking/Test-GitHubBlockedUser.ps1 b/src/functions/public/Users/Blocking/Test-GitHubBlockedUser.ps1 index 31ff75634..831ad3ed2 100644 --- a/src/functions/public/Users/Blocking/Test-GitHubBlockedUser.ps1 +++ b/src/functions/public/Users/Blocking/Test-GitHubBlockedUser.ps1 @@ -53,7 +53,7 @@ # 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) + [object] $Context ) begin { diff --git a/src/functions/public/Users/Blocking/Unblock-GitHubUser.ps1 b/src/functions/public/Users/Blocking/Unblock-GitHubUser.ps1 index e71c63dff..1f731eeeb 100644 --- a/src/functions/public/Users/Blocking/Unblock-GitHubUser.ps1 +++ b/src/functions/public/Users/Blocking/Unblock-GitHubUser.ps1 @@ -47,7 +47,7 @@ # 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) + [object] $Context ) begin { diff --git a/src/functions/public/Users/Emails/Add-GitHubUserEmail.ps1 b/src/functions/public/Users/Emails/Add-GitHubUserEmail.ps1 index 7a240113c..a2bf8ef70 100644 --- a/src/functions/public/Users/Emails/Add-GitHubUserEmail.ps1 +++ b/src/functions/public/Users/Emails/Add-GitHubUserEmail.ps1 @@ -34,7 +34,7 @@ # 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) + [object] $Context ) begin { diff --git a/src/functions/public/Users/Emails/Get-GitHubUserEmail.ps1 b/src/functions/public/Users/Emails/Get-GitHubUserEmail.ps1 index 2adc9e6c0..2fc0df686 100644 --- a/src/functions/public/Users/Emails/Get-GitHubUserEmail.ps1 +++ b/src/functions/public/Users/Emails/Get-GitHubUserEmail.ps1 @@ -40,7 +40,7 @@ # 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) + [object] $Context ) begin { diff --git a/src/functions/public/Users/Emails/Remove-GitHubUserEmail.ps1 b/src/functions/public/Users/Emails/Remove-GitHubUserEmail.ps1 index d985ece65..cbd9f8a3f 100644 --- a/src/functions/public/Users/Emails/Remove-GitHubUserEmail.ps1 +++ b/src/functions/public/Users/Emails/Remove-GitHubUserEmail.ps1 @@ -32,7 +32,7 @@ # 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) + [object] $Context ) begin { diff --git a/src/functions/public/Users/Emails/Update-GitHubUserEmailVisibility.ps1 b/src/functions/public/Users/Emails/Update-GitHubUserEmailVisibility.ps1 index 96be8d6c2..69581f1ac 100644 --- a/src/functions/public/Users/Emails/Update-GitHubUserEmailVisibility.ps1 +++ b/src/functions/public/Users/Emails/Update-GitHubUserEmailVisibility.ps1 @@ -38,7 +38,7 @@ # 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) + [object] $Context ) begin { diff --git a/src/functions/public/Users/Followers/Add-GitHubUserFollowing.ps1 b/src/functions/public/Users/Followers/Add-GitHubUserFollowing.ps1 index bd5dd9eff..cbc73efc1 100644 --- a/src/functions/public/Users/Followers/Add-GitHubUserFollowing.ps1 +++ b/src/functions/public/Users/Followers/Add-GitHubUserFollowing.ps1 @@ -34,7 +34,7 @@ # 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) + [object] $Context ) begin { diff --git a/src/functions/public/Users/Followers/Get-GitHubUserFollower.ps1 b/src/functions/public/Users/Followers/Get-GitHubUserFollower.ps1 index 891c524c8..998df8a93 100644 --- a/src/functions/public/Users/Followers/Get-GitHubUserFollower.ps1 +++ b/src/functions/public/Users/Followers/Get-GitHubUserFollower.ps1 @@ -40,7 +40,7 @@ # 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) + [object] $Context ) begin { diff --git a/src/functions/public/Users/Followers/Get-GitHubUserFollowing.ps1 b/src/functions/public/Users/Followers/Get-GitHubUserFollowing.ps1 index 4008bcf9b..e24b7719f 100644 --- a/src/functions/public/Users/Followers/Get-GitHubUserFollowing.ps1 +++ b/src/functions/public/Users/Followers/Get-GitHubUserFollowing.ps1 @@ -41,7 +41,7 @@ # 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) + [object] $Context ) begin { diff --git a/src/functions/public/Users/Followers/Remove-GitHubUserFollowing.ps1 b/src/functions/public/Users/Followers/Remove-GitHubUserFollowing.ps1 index 20603915b..70b0172a5 100644 --- a/src/functions/public/Users/Followers/Remove-GitHubUserFollowing.ps1 +++ b/src/functions/public/Users/Followers/Remove-GitHubUserFollowing.ps1 @@ -32,7 +32,7 @@ # 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) + [object] $Context ) begin { diff --git a/src/functions/public/Users/Followers/Test-GitHubUserFollowing.ps1 b/src/functions/public/Users/Followers/Test-GitHubUserFollowing.ps1 index 5577a20f1..546698f3c 100644 --- a/src/functions/public/Users/Followers/Test-GitHubUserFollowing.ps1 +++ b/src/functions/public/Users/Followers/Test-GitHubUserFollowing.ps1 @@ -48,7 +48,7 @@ # 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) + [object] $Context ) begin { diff --git a/src/functions/public/Users/GPG-Keys/Add-GitHubUserGpgKey.ps1 b/src/functions/public/Users/GPG-Keys/Add-GitHubUserGpgKey.ps1 index dc48da49f..0fe941753 100644 --- a/src/functions/public/Users/GPG-Keys/Add-GitHubUserGpgKey.ps1 +++ b/src/functions/public/Users/GPG-Keys/Add-GitHubUserGpgKey.ps1 @@ -47,7 +47,7 @@ # 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) + [object] $Context ) begin { diff --git a/src/functions/public/Users/GPG-Keys/Get-GitHubUserGpgKey.ps1 b/src/functions/public/Users/GPG-Keys/Get-GitHubUserGpgKey.ps1 index dbdbf3184..9a1fc348a 100644 --- a/src/functions/public/Users/GPG-Keys/Get-GitHubUserGpgKey.ps1 +++ b/src/functions/public/Users/GPG-Keys/Get-GitHubUserGpgKey.ps1 @@ -53,7 +53,7 @@ # 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) + [object] $Context ) begin { diff --git a/src/functions/public/Users/GPG-Keys/Remove-GitHubUserGpgKey.ps1 b/src/functions/public/Users/GPG-Keys/Remove-GitHubUserGpgKey.ps1 index 26aed44eb..9ca2538f2 100644 --- a/src/functions/public/Users/GPG-Keys/Remove-GitHubUserGpgKey.ps1 +++ b/src/functions/public/Users/GPG-Keys/Remove-GitHubUserGpgKey.ps1 @@ -32,7 +32,7 @@ # 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) + [object] $Context ) begin { diff --git a/src/functions/public/Users/Get-GitHubUser.ps1 b/src/functions/public/Users/Get-GitHubUser.ps1 index 08e32a7b8..4e84bbf74 100644 --- a/src/functions/public/Users/Get-GitHubUser.ps1 +++ b/src/functions/public/Users/Get-GitHubUser.ps1 @@ -67,7 +67,7 @@ # 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) + [object] $Context ) begin { diff --git a/src/functions/public/Users/Keys/Add-GitHubUserKey.ps1 b/src/functions/public/Users/Keys/Add-GitHubUserKey.ps1 index 26a34e22c..ffa72bdec 100644 --- a/src/functions/public/Users/Keys/Add-GitHubUserKey.ps1 +++ b/src/functions/public/Users/Keys/Add-GitHubUserKey.ps1 @@ -41,7 +41,7 @@ # 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) + [object] $Context ) begin { diff --git a/src/functions/public/Users/Keys/Get-GitHubUserKey.ps1 b/src/functions/public/Users/Keys/Get-GitHubUserKey.ps1 index 24303e90b..69145a9d7 100644 --- a/src/functions/public/Users/Keys/Get-GitHubUserKey.ps1 +++ b/src/functions/public/Users/Keys/Get-GitHubUserKey.ps1 @@ -56,7 +56,7 @@ # 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) + [object] $Context ) begin { diff --git a/src/functions/public/Users/Keys/Remove-GitHubUserKey.ps1 b/src/functions/public/Users/Keys/Remove-GitHubUserKey.ps1 index 9cb6494d7..91627fb5e 100644 --- a/src/functions/public/Users/Keys/Remove-GitHubUserKey.ps1 +++ b/src/functions/public/Users/Keys/Remove-GitHubUserKey.ps1 @@ -33,7 +33,7 @@ # 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) + [object] $Context ) begin { 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 b0a21a8db..d682a4c8d 100644 --- a/src/functions/public/Users/SSH-Signing-Keys/Add-GitHubUserSigningKey.ps1 +++ b/src/functions/public/Users/SSH-Signing-Keys/Add-GitHubUserSigningKey.ps1 @@ -43,7 +43,7 @@ # 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) + [object] $Context ) begin { 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 fe0df4bc2..1b6da1cdc 100644 --- a/src/functions/public/Users/SSH-Signing-Keys/Get-GitHubUserSigningKey.ps1 +++ b/src/functions/public/Users/SSH-Signing-Keys/Get-GitHubUserSigningKey.ps1 @@ -56,7 +56,7 @@ # 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) + [object] $Context ) begin { 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 68cd472b2..f85eceee0 100644 --- a/src/functions/public/Users/SSH-Signing-Keys/Remove-GitHubUserSigningKey.ps1 +++ b/src/functions/public/Users/SSH-Signing-Keys/Remove-GitHubUserSigningKey.ps1 @@ -34,7 +34,7 @@ # 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) + [object] $Context ) begin { diff --git a/src/functions/public/Users/Social-Accounts/Add-GitHubUserSocial.ps1 b/src/functions/public/Users/Social-Accounts/Add-GitHubUserSocial.ps1 index 143b17dcf..f31a51f96 100644 --- a/src/functions/public/Users/Social-Accounts/Add-GitHubUserSocial.ps1 +++ b/src/functions/public/Users/Social-Accounts/Add-GitHubUserSocial.ps1 @@ -30,7 +30,7 @@ # 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) + [object] $Context ) begin { diff --git a/src/functions/public/Users/Social-Accounts/Remove-GitHubUserSocial.ps1 b/src/functions/public/Users/Social-Accounts/Remove-GitHubUserSocial.ps1 index 3d702bb61..27cbb1dba 100644 --- a/src/functions/public/Users/Social-Accounts/Remove-GitHubUserSocial.ps1 +++ b/src/functions/public/Users/Social-Accounts/Remove-GitHubUserSocial.ps1 @@ -31,7 +31,7 @@ # 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) + [object] $Context ) begin { diff --git a/src/functions/public/Users/Update-GitHubUser.ps1 b/src/functions/public/Users/Update-GitHubUser.ps1 index 76ac7b747..69af9e3d2 100644 --- a/src/functions/public/Users/Update-GitHubUser.ps1 +++ b/src/functions/public/Users/Update-GitHubUser.ps1 @@ -67,7 +67,7 @@ # 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) + [object] $Context ) begin { diff --git a/src/functions/public/Variables/Export-GitHubVariable.ps1 b/src/functions/public/Variables/Export-GitHubVariable.ps1 index f920c0a75..8280f7808 100644 --- a/src/functions/public/Variables/Export-GitHubVariable.ps1 +++ b/src/functions/public/Variables/Export-GitHubVariable.ps1 @@ -1,4 +1,4 @@ -function Export-GitHubVariable { +function Export-GitHubVariable { <# .SYNOPSIS Exports a GitHub variable to the local environment. diff --git a/src/functions/public/Variables/Get-GitHubVariable.ps1 b/src/functions/public/Variables/Get-GitHubVariable.ps1 index 5b3bfcc6e..e582c014a 100644 --- a/src/functions/public/Variables/Get-GitHubVariable.ps1 +++ b/src/functions/public/Variables/Get-GitHubVariable.ps1 @@ -1,4 +1,4 @@ -function Get-GitHubVariable { +function Get-GitHubVariable { <# .SYNOPSIS Retrieves a variable from GitHub based on the specified scope. @@ -157,7 +157,7 @@ function Get-GitHubVariable { # 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) + [object] $Context ) begin { diff --git a/src/functions/public/Variables/New-GitHubVariable.ps1 b/src/functions/public/Variables/New-GitHubVariable.ps1 index 33bfb727e..bba5c9cf0 100644 --- a/src/functions/public/Variables/New-GitHubVariable.ps1 +++ b/src/functions/public/Variables/New-GitHubVariable.ps1 @@ -1,4 +1,4 @@ -function New-GitHubVariable { +function New-GitHubVariable { <# .SYNOPSIS Creates a GitHub Actions variable at the organization, repository, or environment level. @@ -86,7 +86,7 @@ function New-GitHubVariable { # 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) + [object] $Context ) begin { diff --git a/src/functions/public/Variables/Remove-GitHubVariable.ps1 b/src/functions/public/Variables/Remove-GitHubVariable.ps1 index 87161390a..caee1d0e7 100644 --- a/src/functions/public/Variables/Remove-GitHubVariable.ps1 +++ b/src/functions/public/Variables/Remove-GitHubVariable.ps1 @@ -1,4 +1,4 @@ -function Remove-GitHubVariable { +function Remove-GitHubVariable { <# .SYNOPSIS Deletes a GitHub variable from an organization, repository, or environment. @@ -67,7 +67,7 @@ function Remove-GitHubVariable { # 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), + [object] $Context, [Parameter(Mandatory, ParameterSetName = 'ArrayInput', ValueFromPipeline)] [GitHubVariable[]] $InputObject diff --git a/src/functions/public/Variables/SelectedRepository/Add-GitHubVariableSelectedRepository.ps1 b/src/functions/public/Variables/SelectedRepository/Add-GitHubVariableSelectedRepository.ps1 index 2c7333164..571a10723 100644 --- a/src/functions/public/Variables/SelectedRepository/Add-GitHubVariableSelectedRepository.ps1 +++ b/src/functions/public/Variables/SelectedRepository/Add-GitHubVariableSelectedRepository.ps1 @@ -50,7 +50,7 @@ # 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) + [object] $Context ) begin { diff --git a/src/functions/public/Variables/SelectedRepository/Get-GitHubVariableSelectedRepository.ps1 b/src/functions/public/Variables/SelectedRepository/Get-GitHubVariableSelectedRepository.ps1 index 93d8a95e7..9effd40da 100644 --- a/src/functions/public/Variables/SelectedRepository/Get-GitHubVariableSelectedRepository.ps1 +++ b/src/functions/public/Variables/SelectedRepository/Get-GitHubVariableSelectedRepository.ps1 @@ -1,4 +1,4 @@ -function Get-GitHubVariableSelectedRepository { +function Get-GitHubVariableSelectedRepository { <# .SYNOPSIS List selected repositories for an organization variable. @@ -45,7 +45,7 @@ function Get-GitHubVariableSelectedRepository { # 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) + [object] $Context ) begin { diff --git a/src/functions/public/Variables/SelectedRepository/Remove-GitHubVariableSelectedRepository.ps1 b/src/functions/public/Variables/SelectedRepository/Remove-GitHubVariableSelectedRepository.ps1 index ce93be6c4..fa5279597 100644 --- a/src/functions/public/Variables/SelectedRepository/Remove-GitHubVariableSelectedRepository.ps1 +++ b/src/functions/public/Variables/SelectedRepository/Remove-GitHubVariableSelectedRepository.ps1 @@ -58,7 +58,7 @@ # 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) + [object] $Context ) begin { diff --git a/src/functions/public/Variables/SelectedRepository/Set-GitHubVariableSelectedRepository.ps1 b/src/functions/public/Variables/SelectedRepository/Set-GitHubVariableSelectedRepository.ps1 index d16d47b39..45a5b11ca 100644 --- a/src/functions/public/Variables/SelectedRepository/Set-GitHubVariableSelectedRepository.ps1 +++ b/src/functions/public/Variables/SelectedRepository/Set-GitHubVariableSelectedRepository.ps1 @@ -42,7 +42,7 @@ # 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) + [object] $Context ) begin { diff --git a/src/functions/public/Variables/Set-GitHubVariable.ps1 b/src/functions/public/Variables/Set-GitHubVariable.ps1 index e98d2998a..83f9de664 100644 --- a/src/functions/public/Variables/Set-GitHubVariable.ps1 +++ b/src/functions/public/Variables/Set-GitHubVariable.ps1 @@ -1,4 +1,4 @@ -function Set-GitHubVariable { +function Set-GitHubVariable { <# .SYNOPSIS Creates or updates a GitHub Actions variable at the organization, repository, or environment level. @@ -82,7 +82,7 @@ function Set-GitHubVariable { # The context to run the command in. Can be either a string or a GitHubContext object. [Parameter()] - [object] $Context = (Get-GitHubContext) + [object] $Context ) begin { diff --git a/src/functions/public/Variables/Update-GitHubVariable.ps1 b/src/functions/public/Variables/Update-GitHubVariable.ps1 index ffde10ed4..74bf59393 100644 --- a/src/functions/public/Variables/Update-GitHubVariable.ps1 +++ b/src/functions/public/Variables/Update-GitHubVariable.ps1 @@ -1,4 +1,4 @@ -function Update-GitHubVariable { +function Update-GitHubVariable { <# .SYNOPSIS Update a GitHub variable at the organization, repository, or environment level. @@ -88,7 +88,7 @@ function Update-GitHubVariable { # The context to run the command in. Can be either a string or a GitHubContext object. [Parameter()] - [object] $Context = (Get-GitHubContext) + [object] $Context ) begin { diff --git a/src/functions/public/Webhooks/Get-GitHubAppWebhookConfiguration.ps1 b/src/functions/public/Webhooks/Get-GitHubAppWebhookConfiguration.ps1 index 28a15b528..15edc15c7 100644 --- a/src/functions/public/Webhooks/Get-GitHubAppWebhookConfiguration.ps1 +++ b/src/functions/public/Webhooks/Get-GitHubAppWebhookConfiguration.ps1 @@ -26,7 +26,7 @@ # 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) + [object] $Context ) begin { diff --git a/src/functions/public/Webhooks/Get-GitHubAppWebhookDelivery.ps1 b/src/functions/public/Webhooks/Get-GitHubAppWebhookDelivery.ps1 index b56261d69..70c3a049e 100644 --- a/src/functions/public/Webhooks/Get-GitHubAppWebhookDelivery.ps1 +++ b/src/functions/public/Webhooks/Get-GitHubAppWebhookDelivery.ps1 @@ -59,7 +59,7 @@ # 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) + [object] $Context ) begin { diff --git a/src/functions/public/Webhooks/Invoke-GitHubAppWebhookReDelivery.ps1 b/src/functions/public/Webhooks/Invoke-GitHubAppWebhookReDelivery.ps1 index f143b006f..c0ae367e7 100644 --- a/src/functions/public/Webhooks/Invoke-GitHubAppWebhookReDelivery.ps1 +++ b/src/functions/public/Webhooks/Invoke-GitHubAppWebhookReDelivery.ps1 @@ -38,7 +38,7 @@ # 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) + [object] $Context ) begin { diff --git a/src/functions/public/Webhooks/Update-GitHubAppWebhookConfiguration.ps1 b/src/functions/public/Webhooks/Update-GitHubAppWebhookConfiguration.ps1 index 2687b6421..27677c631 100644 --- a/src/functions/public/Webhooks/Update-GitHubAppWebhookConfiguration.ps1 +++ b/src/functions/public/Webhooks/Update-GitHubAppWebhookConfiguration.ps1 @@ -60,7 +60,7 @@ # 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) + [object] $Context ) begin { diff --git a/src/functions/public/Workflows/Disable-GitHubWorkflow.ps1 b/src/functions/public/Workflows/Disable-GitHubWorkflow.ps1 index 6ad733ca4..d17d2d9dc 100644 --- a/src/functions/public/Workflows/Disable-GitHubWorkflow.ps1 +++ b/src/functions/public/Workflows/Disable-GitHubWorkflow.ps1 @@ -35,7 +35,7 @@ # 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) + [object] $Context ) begin { diff --git a/src/functions/public/Workflows/Enable-GitHubWorkflow.ps1 b/src/functions/public/Workflows/Enable-GitHubWorkflow.ps1 index 889aa87fd..b93f601da 100644 --- a/src/functions/public/Workflows/Enable-GitHubWorkflow.ps1 +++ b/src/functions/public/Workflows/Enable-GitHubWorkflow.ps1 @@ -32,7 +32,7 @@ # 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) + [object] $Context ) begin { diff --git a/src/functions/public/Workflows/Get-GitHubWorkflow.ps1 b/src/functions/public/Workflows/Get-GitHubWorkflow.ps1 index e71f52e03..866a6c958 100644 --- a/src/functions/public/Workflows/Get-GitHubWorkflow.ps1 +++ b/src/functions/public/Workflows/Get-GitHubWorkflow.ps1 @@ -50,7 +50,7 @@ # 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) + [object] $Context ) begin { diff --git a/src/functions/public/Workflows/Runs/Get-GitHubWorkflowRun.ps1 b/src/functions/public/Workflows/Runs/Get-GitHubWorkflowRun.ps1 index f0e761f2a..60292b63f 100644 --- a/src/functions/public/Workflows/Runs/Get-GitHubWorkflowRun.ps1 +++ b/src/functions/public/Workflows/Runs/Get-GitHubWorkflowRun.ps1 @@ -113,7 +113,7 @@ # 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) + [object] $Context ) begin { diff --git a/src/functions/public/Workflows/Runs/Remove-GitHubWorkflowRun.ps1 b/src/functions/public/Workflows/Runs/Remove-GitHubWorkflowRun.ps1 index 5756ee644..083e325fc 100644 --- a/src/functions/public/Workflows/Runs/Remove-GitHubWorkflowRun.ps1 +++ b/src/functions/public/Workflows/Runs/Remove-GitHubWorkflowRun.ps1 @@ -39,7 +39,7 @@ # 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) + [object] $Context ) begin { diff --git a/src/functions/public/Workflows/Runs/Restart-GitHubWorkflowRun.ps1 b/src/functions/public/Workflows/Runs/Restart-GitHubWorkflowRun.ps1 index e5a81d226..c1f0df4f9 100644 --- a/src/functions/public/Workflows/Runs/Restart-GitHubWorkflowRun.ps1 +++ b/src/functions/public/Workflows/Runs/Restart-GitHubWorkflowRun.ps1 @@ -35,7 +35,7 @@ # 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) + [object] $Context ) begin { diff --git a/src/functions/public/Workflows/Runs/Stop-GitHubWorkflowRun.ps1 b/src/functions/public/Workflows/Runs/Stop-GitHubWorkflowRun.ps1 index 17516c1e5..ca67a06af 100644 --- a/src/functions/public/Workflows/Runs/Stop-GitHubWorkflowRun.ps1 +++ b/src/functions/public/Workflows/Runs/Stop-GitHubWorkflowRun.ps1 @@ -38,7 +38,7 @@ # 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) + [object] $Context ) begin { diff --git a/src/functions/public/Workflows/Start-GitHubWorkflow.ps1 b/src/functions/public/Workflows/Start-GitHubWorkflow.ps1 index d2d7e84c0..8d6481ccc 100644 --- a/src/functions/public/Workflows/Start-GitHubWorkflow.ps1 +++ b/src/functions/public/Workflows/Start-GitHubWorkflow.ps1 @@ -46,7 +46,7 @@ # 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) + [object] $Context ) begin { diff --git a/src/variables/private/GitHub.ps1 b/src/variables/private/GitHub.ps1 index 396c1d0f2..a172f43c2 100644 --- a/src/variables/private/GitHub.ps1 +++ b/src/variables/private/GitHub.ps1 @@ -1,8 +1,9 @@ $script:GitHub = [pscustomobject]@{ + ContextVault = 'PSModule.GitHub' TokenPrefixPattern = '(?<=^(ghu|gho|ghs|github_pat|ghp)).*' EnvironmentType = Get-GitHubEnvironmentType DefaultConfig = [GitHubConfig]@{ - ID = 'PSModule.GitHub' + ID = 'Module' HostName = ($env:GITHUB_SERVER_URL ?? 'github.com') -replace '^https?://' ApiBaseUri = "https://api.$(($env:GITHUB_SERVER_URL ?? 'github.com') -replace '^https?://')" AccessTokenGracePeriodInHours = 4 diff --git a/tests/Artifacts.Tests.ps1 b/tests/Artifacts.Tests.ps1 index 386127b5b..eafdbe1b8 100644 --- a/tests/Artifacts.Tests.ps1 +++ b/tests/Artifacts.Tests.ps1 @@ -41,6 +41,7 @@ Describe 'Artifacts' { } AfterAll { Get-GitHubContext -ListAvailable | Disconnect-GitHubAccount -Silent + Write-Host ('-' * 60) } Context 'Repository' { diff --git a/tests/Environments.Tests.ps1 b/tests/Environments.Tests.ps1 index 781207334..0c2750c3e 100644 --- a/tests/Environments.Tests.ps1 +++ b/tests/Environments.Tests.ps1 @@ -69,6 +69,7 @@ Describe 'Environments' { } } Get-GitHubContext -ListAvailable | Disconnect-GitHubAccount -Silent + Write-Host ('-' * 60) } It 'Get-GitHubEnvironment - should return an empty list when no environments exist' -Skip:($OwnerType -eq 'repository') { diff --git a/tests/GitHub.Tests.ps1 b/tests/GitHub.Tests.ps1 index f1cdfd365..d734f56df 100644 --- a/tests/GitHub.Tests.ps1 +++ b/tests/GitHub.Tests.ps1 @@ -25,6 +25,7 @@ Describe 'Auth' { Context 'As using on ' -ForEach $authCases { AfterAll { Get-GitHubContext -ListAvailable | Disconnect-GitHubAccount -Silent + Write-Host ('-' * 60) } It 'Connect-GitHubAccount - Connects using the provided credentials' { @@ -374,6 +375,7 @@ Describe 'Apps' { AfterAll { Get-GitHubContext -ListAvailable | Disconnect-GitHubAccount -Silent + Write-Host ('-' * 60) } # Tests for APP goes here @@ -483,6 +485,7 @@ Describe 'API' { } AfterAll { Get-GitHubContext -ListAvailable | Disconnect-GitHubAccount -Silent + Write-Host ('-' * 60) } # Tests for APP goes here @@ -700,6 +703,7 @@ Describe 'Emojis' { } AfterAll { Get-GitHubContext -ListAvailable | Disconnect-GitHubAccount -Silent + Write-Host ('-' * 60) } # Tests for APP goes here @@ -746,30 +750,30 @@ Describe 'Webhooks' { Describe 'Anonymous - Functions that can run anonymously' { It 'Get-GithubRateLimit - Using -Anonymous' { - $rateLimit = Get-GitHubRateLimit -Anonymous + $rateLimit = Get-GitHubRateLimit -Anonymous -Debug -Verbose LogGroup 'Rate Limit' { - Write-Host ($rateLimit | Format-List | Out-String) + Write-Host ($rateLimit | Format-Table | Out-String) } $rateLimit | Should -Not -BeNullOrEmpty } It 'Invoke-GitHubAPI - Using -Anonymous' { - $rateLimit = Invoke-GitHubAPI -ApiEndpoint '/rate_limit' -Anonymous + $rateLimit = Invoke-GitHubAPI -ApiEndpoint '/rate_limit' -Anonymous | Select-Object -ExpandProperty Response LogGroup 'Rate Limit' { - Write-Host ($rateLimit | Format-List | Out-String) + Write-Host ($rateLimit | Format-Table | Out-String) } $rateLimit | Should -Not -BeNullOrEmpty } - It 'Invoke-GitHubAPI - Using -Context Anonymous' { - $rateLimit = Invoke-GitHubAPI -ApiEndpoint '/rate_limit' -Context Anonymous + It 'Get-GithubRateLimit - Using -Context Anonymous' { + $rateLimit = Get-GitHubRateLimit -Context Anonymous -Debug -Verbose LogGroup 'Rate Limit' { Write-Host ($rateLimit | Format-List | Out-String) } $rateLimit | Should -Not -BeNullOrEmpty } - It 'Get-GithubRateLimit - Using -Context Anonymous' { - $rateLimit = Get-GitHubRateLimit -Context Anonymous + It 'Invoke-GitHubAPI - Using -Context Anonymous' { + $rateLimit = Invoke-GitHubAPI -ApiEndpoint '/rate_limit' -Context Anonymous | Select-Object -ExpandProperty Response LogGroup 'Rate Limit' { - Write-Host ($rateLimit | Format-List | Out-String) + Write-Host ($rateLimit | Format-Table | Out-String) } $rateLimit | Should -Not -BeNullOrEmpty } diff --git a/tests/Organizations.Tests.ps1 b/tests/Organizations.Tests.ps1 index e1cf537b0..07059997c 100644 --- a/tests/Organizations.Tests.ps1 +++ b/tests/Organizations.Tests.ps1 @@ -35,6 +35,7 @@ Describe 'Organizations' { } AfterAll { Get-GitHubContext -ListAvailable | Disconnect-GitHubAccount -Silent + Write-Host ('-' * 60) } # Tests for APP goes here diff --git a/tests/Releases.Tests.ps1 b/tests/Releases.Tests.ps1 index dee526bca..bf6cec578 100644 --- a/tests/Releases.Tests.ps1 +++ b/tests/Releases.Tests.ps1 @@ -75,6 +75,7 @@ Describe 'Releases' { } } Get-GitHubContext -ListAvailable | Disconnect-GitHubAccount -Silent + Write-Host ('-' * 60) } Context 'Releases' -Skip:($OwnerType -eq 'repository') { diff --git a/tests/Repositories.Tests.ps1 b/tests/Repositories.Tests.ps1 index fc2212ae5..417b66faf 100644 --- a/tests/Repositories.Tests.ps1 +++ b/tests/Repositories.Tests.ps1 @@ -63,6 +63,7 @@ Describe 'Repositories' { } } Get-GitHubContext -ListAvailable | Disconnect-GitHubAccount -Silent + Write-Host ('-' * 60) } It 'New-GitHubRepository - Creates a new repository' -Skip:($OwnerType -eq 'repository') { diff --git a/tests/Secrets.Tests.ps1 b/tests/Secrets.Tests.ps1 index b5f05e682..152145535 100644 --- a/tests/Secrets.Tests.ps1 +++ b/tests/Secrets.Tests.ps1 @@ -100,6 +100,7 @@ Describe 'Secrets' { } } Get-GitHubContext -ListAvailable | Disconnect-GitHubAccount -Silent + Write-Host ('-' * 60) } Context 'User' -Skip:($OwnerType -ne 'user') { diff --git a/tests/TEMPLATE.ps1 b/tests/TEMPLATE.ps1 index 78585c107..d68fde218 100644 --- a/tests/TEMPLATE.ps1 +++ b/tests/TEMPLATE.ps1 @@ -35,6 +35,7 @@ Describe 'Template' { } AfterAll { Get-GitHubContext -ListAvailable | Disconnect-GitHubAccount -Silent + Write-Host ('-' * 60) } # Tests for APP goes here diff --git a/tests/Teams.Tests.ps1 b/tests/Teams.Tests.ps1 index a6dd11f9a..5132228d9 100644 --- a/tests/Teams.Tests.ps1 +++ b/tests/Teams.Tests.ps1 @@ -61,6 +61,7 @@ Describe 'Teams' { } } Get-GitHubContext -ListAvailable | Disconnect-GitHubAccount -Silent + Write-Host ('-' * 60) } Context 'Organization' -Skip:($OwnerType -ne 'organization') { diff --git a/tests/Users.Tests.ps1 b/tests/Users.Tests.ps1 index ff7db4676..5dcd0ec18 100644 --- a/tests/Users.Tests.ps1 +++ b/tests/Users.Tests.ps1 @@ -27,6 +27,7 @@ Describe 'Users' { } AfterAll { Get-GitHubContext -ListAvailable | Disconnect-GitHubAccount -Silent + Write-Host ('-' * 60) } # Tests for APP goes here diff --git a/tests/Variables.Tests.ps1 b/tests/Variables.Tests.ps1 index 293d3bd61..d6a3da75a 100644 --- a/tests/Variables.Tests.ps1 +++ b/tests/Variables.Tests.ps1 @@ -99,6 +99,7 @@ Describe 'Variables' { } } Get-GitHubContext -ListAvailable | Disconnect-GitHubAccount -Silent + Write-Host ('-' * 60) } Context 'Organization' -Skip:($OwnerType -ne 'organization') { diff --git a/tools/dev/AppConnecting.ps1 b/tools/dev/AppConnecting.ps1 index 46efe7102..a8c2ef264 100644 --- a/tools/dev/AppConnecting.ps1 +++ b/tools/dev/AppConnecting.ps1 @@ -25,7 +25,7 @@ LogGroup "Connect to org [$env:GITHUB_REPOSITORY_OWNER]" { $orgName = $_.account.login $orgInstallationID = $_.id Write-Verbose "Processing [$orgName] [$orgInstallationID]" - Set-GitHubDefaultContext -Context $appContext + Switch-GitHubContext -Context $appContext $token = New-GitHubAppInstallationAccessToken -InstallationID $_.id | Select-Object -ExpandProperty Token Connect-GitHub -Token $token -Silent diff --git a/tools/utilities/New-FunctionTemplate.ps1 b/tools/utilities/New-FunctionTemplate.ps1 index 5716bf6f0..af7bcd7cc 100644 --- a/tools/utilities/New-FunctionTemplate.ps1 +++ b/tools/utilities/New-FunctionTemplate.ps1 @@ -25,13 +25,13 @@ # 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) + [object] $Context ) begin { $stackPath = Get-PSCallStackPath Write-Debug "[$stackPath] - Start" - $Context = Resolve-GitHubContext -Context $Context + $Context = Resolve-GitHubContext -Context $Context -Anonymous $Anonymous Assert-GitHubContext -Context $Context -AuthType IAT, PAT, UAT if ([string]::IsNullOrEmpty($Enterprise)) {