Skip to content

Get-GitHubSecret

SYNOPSIS

Retrieve GitHub secret(s) without revealing encrypted value(s).

SYNTAX

AuthorizedUser (Default)

Get-GitHubSecret [-Name <String>] [-IncludeInherited] [-All] [-Context <Object>]
 [-ProgressAction <ActionPreference>] [<CommonParameters>]

Environment

Get-GitHubSecret -Owner <String> -Repository <String> -Environment <String> [-Name <String>]
 [-IncludeInherited] [-All] [-Context <Object>] [-ProgressAction <ActionPreference>] [<CommonParameters>]

Repository

Get-GitHubSecret -Owner <String> -Repository <String> [-Name <String>] [-IncludeInherited] [-All]
 [-Context <Object>] [-ProgressAction <ActionPreference>] [<CommonParameters>]

Organization

Get-GitHubSecret -Owner <String> [-Name <String>] [-IncludeInherited] [-All] [-Context <Object>]
 [-ProgressAction <ActionPreference>] [<CommonParameters>]

DESCRIPTION

Retrieves GitHub secrets from a repository, organization, or environment without exposing the actual secret values. Supports multiple contexts such as Actions, Codespaces, and Organization secrets.

The function returns an array of PSObjects containing metadata about the secrets.

EXAMPLES

EXAMPLE 1

Get-GitHubSecret -Owner PSModule -Repo Demo -Type actions

Retrieves all Actions secrets from the 'Demo' repository under the 'PSModule' organization.

EXAMPLE 2

Get-GitHubSecret -Owner PSModule -Type organization

Retrieves all organization-level secrets under the 'PSModule' organization.

EXAMPLE 3

Get-GitHubSecret -Owner PSModule -Repo Demo -Environment Staging

Retrieves all secrets for the 'Staging' environment in the 'Demo' repository under 'PSModule'.

PARAMETERS

-Owner

The account owner of the repository. The name is not case sensitive.

Type: String
Parameter Sets: Environment, Repository, Organization
Aliases: Organization, User

Required: True
Position: Named
Default value: None
Accept pipeline input: False
Accept wildcard characters: False

-Repository

The name of the repository without the .git extension. The name is not case sensitive.

Type: String
Parameter Sets: Environment, Repository
Aliases:

Required: True
Position: Named
Default value: None
Accept pipeline input: False
Accept wildcard characters: False

-Environment

The name of the environment.

Type: String
Parameter Sets: Environment
Aliases:

Required: True
Position: Named
Default value: None
Accept pipeline input: False
Accept wildcard characters: False

-Name

The name of the secret.

Type: String
Parameter Sets: (All)
Aliases:

Required: False
Position: Named
Default value: *
Accept pipeline input: False
Accept wildcard characters: True

-IncludeInherited

List all secrets that are inherited.

Type: SwitchParameter
Parameter Sets: (All)
Aliases:

Required: False
Position: Named
Default value: False
Accept pipeline input: False
Accept wildcard characters: False

-All

List all secrets, including those that are overwritten by inheritance.

Type: SwitchParameter
Parameter Sets: (All)
Aliases:

Required: False
Position: Named
Default value: False
Accept pipeline input: False
Accept wildcard characters: False

-Context

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.

Type: Object
Parameter Sets: (All)
Aliases:

Required: False
Position: Named
Default value: (Get-GitHubContext)
Accept pipeline input: False
Accept wildcard characters: False

-ProgressAction

{{ Fill ProgressAction Description }}

Type: ActionPreference
Parameter Sets: (All)
Aliases: proga

Required: False
Position: Named
Default value: None
Accept pipeline input: False
Accept wildcard characters: False

CommonParameters

This cmdlet supports the common parameters: -Debug, -ErrorAction, -ErrorVariable, -InformationAction, -InformationVariable, -OutVariable, -OutBuffer, -PipelineVariable, -Verbose, -WarningAction, and -WarningVariable. For more information, see about_CommonParameters.

INPUTS

OUTPUTS

GitHubSecret[]

NOTES

https://psmodule.io/GitHub/Functions/Secrets/Get-GitHubSecret/