Skip to content

Export-GitHubVariable

SYNOPSIS

Exports a GitHub variable to the local environment.

SYNTAX

Export-GitHubVariable [-Name] <String> [-Value] <String> [[-Target] <EnvironmentVariableTarget>]
 [-ProgressAction <ActionPreference>] [<CommonParameters>]

DESCRIPTION

This function takes a GitHub variable and sets it as an environment variable. The variable can be exported to the Process, User, or Machine environment scope.

By default, the variable is exported to the Process scope, meaning it will persist only for the current session.

The function accepts pipeline input, allowing GitHub variables retrieved using Get-GitHubVariable to be exported seamlessly.

EXAMPLES

EXAMPLE 1

Get-GitHubVariable -Owner 'octocat' -Repository 'Hello-World' -Environment 'staging' | Export-GitHubVariable

Exports the variables retrieved from the GitHub API to the local environment.

PARAMETERS

-Name

The name of the variable.

Type: String
Parameter Sets: (All)
Aliases:

Required: True
Position: 1
Default value: None
Accept pipeline input: True (ByPropertyName)
Accept wildcard characters: False

-Value

The value of the variable.

Type: String
Parameter Sets: (All)
Aliases:

Required: True
Position: 2
Default value: None
Accept pipeline input: True (ByPropertyName)
Accept wildcard characters: False

-Target

The target scope for the environment variable.

Type: EnvironmentVariableTarget
Parameter Sets: (All)
Aliases:
Accepted values: Process, User, Machine

Required: False
Position: 3
Default value: Process
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/Export-GitHubVariable