Get-GitHubVariable¶
SYNOPSIS¶
Retrieves a variable from GitHub based on the specified scope.
SYNTAX¶
Environment¶
Get-GitHubVariable -Owner <string> -Repository <string> -Environment <string> [-Name <string>]
[-IncludeInherited] [-All] [-Context <Object>] [<CommonParameters>]
Repository¶
Get-GitHubVariable -Owner <string> -Repository <string> [-Name <string>] [-IncludeInherited] [-All]
[-Context <Object>] [<CommonParameters>]
Organization¶
Get-GitHubVariable -Owner <string> [-Name <string>] [-IncludeInherited] [-All] [-Context <Object>]
[<CommonParameters>]
ALIASES¶
This cmdlet has the following aliases, {{Insert list of aliases}}
DESCRIPTION¶
Gets a variable from GitHub, which can be at the organization, repository, or environment level.
This function determines the appropriate API call based on the provided parameters.
Authenticated users must have the required access rights to read variables.
OAuth tokens and personal access tokens (classic) need the repo scope for repositories,
admin:org for organizations, and collaborator access for environments.
EXAMPLES¶
EXAMPLE 1¶
Get-GitHubVariable -Owner 'octocat' -Name 'HOST_NAME'
Output:
Name : HOST_NAME
Value : github.com
Owner : octocat
Repository :
Environment :
Retrieves the specified variable from the organization level.
EXAMPLE 2¶
Get-GitHubVariable -Owner 'octocat' -Repository 'Hello-World' -Name 'GUID'
Output:
Name : GUID
Value : 354aa0b0-65b1-46c8-9c3e-1576f4167a41
Owner : octocat
Repository : Hello-World
Environment :
Retrieves the specified variable from the repository level.
EXAMPLE 3¶
Get-GitHubVariable -Owner 'octocat' -Repository 'Hello-World' -Environment 'dev' -Name 'DB_SERVER'
Output:
Name : DB_SERVER
Value : db.example.com
Owner : octocat
Repository : Hello-World
Environment : dev
Retrieves the specified variable from the environment level within a repository.
EXAMPLE 4¶
Get-GitHubVariable -Owner 'octocat'
Output:
Name : MAX_THREADS
Value : 10
Owner : octocat
Repository :
Environment :
Name : API_TIMEOUT
Value : 30
Owner : octocat
Repository :
Environment :
Retrieves all variables available at the organization level.
EXAMPLE 5¶
Get-GitHubVariable -Owner 'octocat' -Repository 'Hello-World'
Output:
Name : LOG_LEVEL
Value : INFO
Owner : octocat
Repository : Hello-World
Environment :
Name : FEATURE_FLAG
Value : Enabled
Owner : octocat
Repository : Hello-World
Environment :
Retrieves all variables available at the repository level.
EXAMPLE 6¶
Get-GitHubVariable -Owner 'octocat' -Repository 'Hello-World' -Environment 'staging'
Output:
Name : CACHE_DURATION
Value : 3600
Owner : octocat
Repository : Hello-World
Environment : staging
Name : CONNECTION_RETRIES
Value : 5
Owner : octocat
Repository : Hello-World
Environment : staging
Retrieves all variables available in the 'staging' environment within the repository.
PARAMETERS¶
-All¶
List all variables, including those that are overwritten by inheritance.
Type: System.Management.Automation.SwitchParameter
DefaultValue: False
SupportsWildcards: false
Aliases: []
ParameterSets:
- Name: (All)
Position: Named
IsRequired: false
ValueFromPipeline: false
ValueFromPipelineByPropertyName: false
ValueFromRemainingArguments: false
DontShow: false
AcceptedValues: []
HelpMessage: ''
-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: System.Object
DefaultValue: ''
SupportsWildcards: false
Aliases: []
ParameterSets:
- Name: (All)
Position: Named
IsRequired: false
ValueFromPipeline: false
ValueFromPipelineByPropertyName: false
ValueFromRemainingArguments: false
DontShow: false
AcceptedValues: []
HelpMessage: ''
-Environment¶
The name of the environment.
Type: System.String
DefaultValue: ''
SupportsWildcards: false
Aliases: []
ParameterSets:
- Name: Environment
Position: Named
IsRequired: true
ValueFromPipeline: false
ValueFromPipelineByPropertyName: true
ValueFromRemainingArguments: false
DontShow: false
AcceptedValues: []
HelpMessage: ''
-IncludeInherited¶
List all variables that are inherited.
Type: System.Management.Automation.SwitchParameter
DefaultValue: False
SupportsWildcards: false
Aliases: []
ParameterSets:
- Name: (All)
Position: Named
IsRequired: false
ValueFromPipeline: false
ValueFromPipelineByPropertyName: false
ValueFromRemainingArguments: false
DontShow: false
AcceptedValues: []
HelpMessage: ''
-Name¶
The name of the variable.
Type: System.String
DefaultValue: '*'
SupportsWildcards: true
Aliases: []
ParameterSets:
- Name: (All)
Position: Named
IsRequired: false
ValueFromPipeline: false
ValueFromPipelineByPropertyName: false
ValueFromRemainingArguments: false
DontShow: false
AcceptedValues: []
HelpMessage: ''
-Owner¶
The account owner of the repository. The name is not case sensitive.
Type: System.String
DefaultValue: ''
SupportsWildcards: false
Aliases:
- Organization
- User
ParameterSets:
- Name: Environment
Position: Named
IsRequired: true
ValueFromPipeline: false
ValueFromPipelineByPropertyName: true
ValueFromRemainingArguments: false
- Name: Repository
Position: Named
IsRequired: true
ValueFromPipeline: false
ValueFromPipelineByPropertyName: true
ValueFromRemainingArguments: false
- Name: Organization
Position: Named
IsRequired: true
ValueFromPipeline: false
ValueFromPipelineByPropertyName: true
ValueFromRemainingArguments: false
DontShow: false
AcceptedValues: []
HelpMessage: ''
-Repository¶
The name of the repository without the .git extension. The name is not case sensitive.
Type: System.String
DefaultValue: ''
SupportsWildcards: false
Aliases: []
ParameterSets:
- Name: Environment
Position: Named
IsRequired: true
ValueFromPipeline: false
ValueFromPipelineByPropertyName: true
ValueFromRemainingArguments: false
- Name: Repository
Position: Named
IsRequired: true
ValueFromPipeline: false
ValueFromPipelineByPropertyName: true
ValueFromRemainingArguments: false
DontShow: false
AcceptedValues: []
HelpMessage: ''
CommonParameters¶
This cmdlet supports the common parameters: -Debug, -ErrorAction, -ErrorVariable, -InformationAction, -InformationVariable, -OutBuffer, -OutVariable, -PipelineVariable, -ProgressAction, -Verbose, -WarningAction, and -WarningVariable. For more information, see about_CommonParameters.
INPUTS¶
System.String¶
{{ Fill in the Description }}
OUTPUTS¶
GitHubVariable¶
{{ Fill in the Description }}
NOTES¶
An object or array of objects representing the GitHub variable, containing Name, Value, Owner, Repository, and Environment details.