docs icon indicating copy to clipboard operation
docs copied to clipboard

Updating docs to reflect use of `$GITHUB_OUTPUT` environment files

Open oliverjfletcher opened this issue 1 year ago • 2 comments

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_OUTPUT environment file:echo "<output name>=<value>" >> $GITHUB_OUTPUT`{% else %}use a workflow command in a specific syntax: echo "::set-output name=::"```{% endif %}. For more information, see "Workflow commands for {% data variables.product.prodname_actions %}."

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-output command 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-output command 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-output and echo workflow 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

oliverjfletcher avatar Oct 22 '22 06:10 oliverjfletcher

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.

welcome[bot] avatar Oct 22 '22 06:10 welcome[bot]

@oliverjfletcher Thanks for opening and issue, providing such great information, and linking it to your PR! 💖

cmwilson21 avatar Oct 24 '22 15:10 cmwilson21

Closing this issue per comment here 💛

cmwilson21 avatar Oct 28 '22 13:10 cmwilson21