Get-GitHubEnvironment¶
SYNOPSIS¶
Retrieves details of a specified GitHub environment or lists all environments for a repository.
SYNTAX¶
__AllParameterSets¶
Get-GitHubEnvironment [-Owner] <string> [-Repository] <string> [[-Name] <string>] [[-PerPage] <int>]
[[-Context] <Object>] [<CommonParameters>]
ALIASES¶
This cmdlet has the following aliases, {{Insert list of aliases}}
DESCRIPTION¶
This function retrieves details of a specific environment in a GitHub repository when the -Name parameter
is provided.
Otherwise, it lists all available environments for the specified repository.
Anyone with read access to the repository can use this function.
OAuth app tokens and personal access tokens (classic) need the repo scope
to use this function with a private repository.
EXAMPLES¶
EXAMPLE 1¶
Get-GitHubEnvironment -Owner 'PSModule' -Repository 'EnvironmentTest' -Name 'test'
Output:
id : 5944178128
node_id : EN_kwDOOJqfM88AAAABYkz10A
name : test
url : https://api.github.com/repos/PSModule/EnvironmentTest/environments/test
html_url : https://github.com/PSModule/EnvironmentTest/deployments/activity_log?environments_filter=test
created_at : 3/16/2025 11:17:52 PM
updated_at : 3/16/2025 11:17:52 PM
can_admins_bypass : True
protection_rules : {@{id=30352888; node_id=GA_kwDOOJqfM84BzyX4; type=required_reviewers; prevent_self_review=False;
reviewers=System.Object[]}, @{id=30352889; node_id=GA_kwDOOJqfM84BzyX5; type=wait_timer; wait_timer=100},
@{id=30352890; node_id=GA_kwDOOJqfM84BzyX6; type=branch_policy}}
deployment_branch_policy : @{protected_branches=False; custom_branch_policies=True}
Retrieves details of the "test" environment in the specified repository.
EXAMPLE 2¶
Get-GitHubEnvironment -Owner 'PSModule' -Repository 'EnvironmentTest'
Output:
id : 5944178128
node_id : EN_kwDOOJqfM88AAAABYkz10A
name : test
url : https://api.github.com/repos/PSModule/EnvironmentTest/environments/test
html_url : https://github.com/PSModule/EnvironmentTest/deployments/activity_log?environments_filter=test
created_at : 3/16/2025 11:17:52 PM
updated_at : 3/16/2025 11:17:52 PM
can_admins_bypass : True
protection_rules : {@{id=30352888; node_id=GA_kwDOOJqfM84BzyX4; type=required_reviewers; prevent_self_review=False;
reviewers=System.Object[]}, @{id=30352889; node_id=GA_kwDOOJqfM84BzyX5; type=wait_timer; wait_timer=100},
@{id=30352890; node_id=GA_kwDOOJqfM84BzyX6; type=branch_policy}}
deployment_branch_policy : @{protected_branches=False; custom_branch_policies=True}
Lists all environments available in the "EnvironmentTest" repository owned by "PSModule".
PARAMETERS¶
-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: 4
IsRequired: false
ValueFromPipeline: false
ValueFromPipelineByPropertyName: false
ValueFromRemainingArguments: false
DontShow: false
AcceptedValues: []
HelpMessage: ''
-Name¶
The name of the environment.
Type: System.String
DefaultValue: '*'
SupportsWildcards: true
Aliases: []
ParameterSets:
- Name: (All)
Position: 2
IsRequired: false
ValueFromPipeline: false
ValueFromPipelineByPropertyName: true
ValueFromRemainingArguments: false
DontShow: false
AcceptedValues: []
HelpMessage: ''
-Owner¶
The name of the organization.
Type: System.String
DefaultValue: ''
SupportsWildcards: false
Aliases:
- Organization
- User
ParameterSets:
- Name: (All)
Position: 0
IsRequired: true
ValueFromPipeline: false
ValueFromPipelineByPropertyName: true
ValueFromRemainingArguments: false
DontShow: false
AcceptedValues: []
HelpMessage: ''
-PerPage¶
The number of results per page (max 100).
Type: System.Nullable`1[System.Int32]
DefaultValue: ''
SupportsWildcards: false
Aliases: []
ParameterSets:
- Name: (All)
Position: 3
IsRequired: false
ValueFromPipeline: false
ValueFromPipelineByPropertyName: false
ValueFromRemainingArguments: false
DontShow: false
AcceptedValues: []
HelpMessage: ''
-Repository¶
The name of the Repository.
Type: System.String
DefaultValue: ''
SupportsWildcards: false
Aliases: []
ParameterSets:
- Name: (All)
Position: 1
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¶
GitHubRepository¶
{{ Fill in the Description }}
System.String¶
{{ Fill in the Description }}
OUTPUTS¶
GitHubEnvironment¶
{{ Fill in the Description }}
NOTES¶
Returns details of a GitHub environment or a list of environments for a repository.