Set-GitHubOutput¶
SYNOPSIS¶
Sets the GitHub output for a given key and value.
SYNTAX¶
__AllParameterSets¶
Set-GitHubOutput [-Name] <string> [[-Value] <Object>] [[-Path] <string>] [-WhatIf] [-Confirm]
[<CommonParameters>]
ALIASES¶
This cmdlet has the following aliases, {{Insert list of aliases}}
DESCRIPTION¶
This function appends key-value pairs to the GitHub Actions output file specified by $env:GITHUB_OUTPUT. It handles two scenarios: - Normal shell execution: Appends the key-value pair directly. - GitHub composite action via GitHub-Script: Accumulates key-value pairs under the 'result' key as a JSON object.
The Value parameter accepts null values, which will be correctly preserved and set as the output.
EXAMPLES¶
EXAMPLE 1¶
Set-GitHubOutput -Name 'ID' -Value '123123123'
Sets the output variable 'ID' to '123123123' in the GitHub Actions output file.
EXAMPLE 2¶
Set-GitHubOutput -Name 'result' -Value @{
ID = '123123123'
name = 'test'
}
PARAMETERS¶
-Confirm¶
Prompts you for confirmation before running the cmdlet.
Type: System.Management.Automation.SwitchParameter
DefaultValue: ''
SupportsWildcards: false
Aliases:
- cf
ParameterSets:
- Name: (All)
Position: Named
IsRequired: false
ValueFromPipeline: false
ValueFromPipelineByPropertyName: false
ValueFromRemainingArguments: false
DontShow: false
AcceptedValues: []
HelpMessage: ''
-Name¶
The name of the output variable to set.
Type: System.String
DefaultValue: ''
SupportsWildcards: false
Aliases: []
ParameterSets:
- Name: (All)
Position: 0
IsRequired: true
ValueFromPipeline: false
ValueFromPipelineByPropertyName: false
ValueFromRemainingArguments: false
DontShow: false
AcceptedValues: []
HelpMessage: ''
-Path¶
The path to the GitHub output file.
Type: System.String
DefaultValue: $env:GITHUB_OUTPUT
SupportsWildcards: false
Aliases: []
ParameterSets:
- Name: (All)
Position: 2
IsRequired: false
ValueFromPipeline: false
ValueFromPipelineByPropertyName: false
ValueFromRemainingArguments: false
DontShow: false
AcceptedValues: []
HelpMessage: ''
-Value¶
The value of the output variable to set. Can be null.
Type: System.Object
DefaultValue: ''
SupportsWildcards: false
Aliases: []
ParameterSets:
- Name: (All)
Position: 1
IsRequired: false
ValueFromPipeline: false
ValueFromPipelineByPropertyName: false
ValueFromRemainingArguments: false
DontShow: false
AcceptedValues: []
HelpMessage: ''
-WhatIf¶
Runs the command in a mode that only reports what would happen without performing the actions.
Type: System.Management.Automation.SwitchParameter
DefaultValue: ''
SupportsWildcards: false
Aliases:
- wi
ParameterSets:
- Name: (All)
Position: Named
IsRequired: false
ValueFromPipeline: false
ValueFromPipelineByPropertyName: false
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.