Updating docs to reflect use of `$GITHUB_OUTPUT` environment files
Code of Conduct
- [X] I have read and agree to the GitHub Docs project's Code of Conduct
What article on docs.github.com is affected?
https://docs.github.com/en/actions/creating-actions/creating-a-docker-container-action
https://docs.github.com/en/actions/using-workflows/workflow-commands-for-github-actions
What part(s) of the article would you like to see updated?
Creating a Docker container action
#Summary
The below should be updated to align with the $GITHUB_OUTPUT examples in the changelog
Next, the script gets the current time and sets it as an output variable that actions running later in a job can use. In order for {% data variables.product.prodname_dotcom %} to recognize output variables, you must {% ifversion actions-save-state-set-output-envs %}write them to the
$GITHUB_OUTPUTenvironment file:echo "<output name>=<value>" >> $GITHUB_OUTPUT`{% else %}use a workflow command in a specific syntax:echo "::set-output name=
Workflow commands for GitHub Actions
The below should be updated to align with the $GITHUB_OUTPUT examples in the changelog
You can use the
set-outputcommand in your workflow to set the same value:
run: echo '::set-output name=SELECTED_COLOR::green'
run: Write-Output "::set-output name=SELECTED_COLOR::green"
::set-output name={name}::{value}
Write-Output "::set-output name=action_fruit::strawberry"
Enables or disables echoing of workflow commands. For example, if you use the
set-outputcommand in a workflow, it sets an output parameter but the workflow run's log does not show the command itself. If you enable command echoing, then the log shows the command, such as::set-output name={name}::{value}.
echo '::set-output name=action_echo::disabled' echo '::echo::on' echo '::set-output name=action_echo::enabled' echo '::echo::off' echo '::set-output name=action_echo::disabled'
write-output "::set-output name=action_echo::disabled" write-output "::echo::on" write-output "::set-output name=action_echo::enabled" write-output "::echo::off" write-output "::set-output name=action_echo::disabled"
::set-output name=action_echo::enabled
Only the second
set-outputandechoworkflow commands are included in the log because command echoing was only enabled when they were run. Even though it is not always echoed, the output parameter is set in all cases.
Additional information
No response
Thanks for opening this issue. A GitHub docs team member should be by to give feedback soon. In the meantime, please check out the contributing guidelines.
@oliverjfletcher Thanks for opening and issue, providing such great information, and linking it to your PR! 💖
Closing this issue per comment here 💛