Skip to content

Remove-GitHubVariable

SYNOPSIS

Deletes a GitHub variable from an organization, repository, or environment.

SYNTAX

Environment

Remove-GitHubVariable -Owner <String> -Repository <String> -Environment <String> -Name <String>
 [-Context <Object>] [-ProgressAction <ActionPreference>] [-WhatIf] [-Confirm] [<CommonParameters>]

Repository

Remove-GitHubVariable -Owner <String> -Repository <String> -Name <String> [-Context <Object>]
 [-ProgressAction <ActionPreference>] [-WhatIf] [-Confirm] [<CommonParameters>]

Organization

Remove-GitHubVariable -Owner <String> -Name <String> [-Context <Object>] [-ProgressAction <ActionPreference>]
 [-WhatIf] [-Confirm] [<CommonParameters>]

ArrayInput

Remove-GitHubVariable -Name <String> [-Context <Object>] -InputObject <GitHubVariable[]>
 [-ProgressAction <ActionPreference>] [-WhatIf] [-Confirm] [<CommonParameters>]

DESCRIPTION

Deletes a GitHub variable based on the provided scope (organization, repository, or environment).

Supports pipeline input from Get-GitHubVariable or direct array input.

Authenticated users must have collaborator access to a repository to manage variables. OAuth tokens and personal access tokens (classic) require specific scopes: - admin:org for organization-level variables. - repo for repository and environment-level variables.

EXAMPLES

EXAMPLE 1

Get-GitHubVariable -Owner 'octocat' -Repository 'Hello-World' | Remove-GitHubVariable

Removes all variables retrieved from the specified repository.

EXAMPLE 2

Remove-GitHubVariable -Owner 'octocat' -Name 'HOST_NAME' -Context $GitHubContext

Deletes the specified variable from the specified organization.

EXAMPLE 3

Remove-GitHubVariable -Variable $variablesArray

Removes all variables provided in the array.

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: True (ByPropertyName)
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: True (ByPropertyName)
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: True (ByPropertyName)
Accept wildcard characters: False

-Name

The name of the variable.

Type: String
Parameter Sets: (All)
Aliases:

Required: True
Position: Named
Default value: None
Accept pipeline input: True (ByPropertyName)
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

-InputObject

{{ Fill InputObject Description }}

Type: GitHubVariable[]
Parameter Sets: ArrayInput
Aliases:

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

-WhatIf

Shows what would happen if the cmdlet runs. The cmdlet is not run.

Type: SwitchParameter
Parameter Sets: (All)
Aliases: wi

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

-Confirm

Prompts you for confirmation before running the cmdlet.

Type: SwitchParameter
Parameter Sets: (All)
Aliases: cf

Required: False
Position: Named
Default value: None
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

GitHubVariable

OUTPUTS

void

NOTES

https://psmodule.io/GitHub/Functions/Variables/Remove-GitHubVariable/