docs icon indicating copy to clipboard operation
docs copied to clipboard

docs, enhancement: Updating docs to use `$GITHUB_OUTPUT` environment file

Open oliverjfletcher opened this issue 1 year ago • 4 comments

Why:

Closes #21548 and general formatting of the docs Closes #21549

What's being changed (if available, include any code snippets, screenshots, or gifs):

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.

Check off the following:

  • [x] I have reviewed my changes in staging (look for the "Automatically generated comment" and click the links in the "Preview" column to view your latest changes).
  • [x] For content changes, I have completed the self-review checklist.

oliverjfletcher avatar Oct 22 '22 06:10 oliverjfletcher

Thanks for opening this pull request! 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]

👋 Hey there spelunker. It looks like you've modified some files that we can't accept as contributions. The complete list of files we can't accept are: .devcontainer/** .github/actions-scripts/** .github/workflows/** .github/CODEOWNERS assets/fonts/** data/graphql/** Dockerfile* lib/graphql/** lib/redirects/** lib/rest/** lib/webhooks/** lib/search/indexes/** package*.json scripts/** translations/** content/actions/deployment/security-hardening-your-deployments/**

You'll need to revert all of the files you changed in that list using GitHub Desktop or git checkout origin/main <file name>. Once you get those files reverted, we can continue with the review process. :octocat:

github-actions[bot] avatar Oct 22 '22 06:10 github-actions[bot]

Automatically generated comment ℹ️

This comment is automatically generated and will be overwritten every time changes are committed to this branch.

The table contains an overview of files in the content directory that have been changed in this pull request. It's provided to make it easy to review your changes on the staging site. Please note that changes to the data directory will not show up in this table.


Content directory changes

You may find it useful to copy this table into the pull request summary. There you can edit it to share links to important articles or changes and to give a high-level overview of how the changes in your pull request support the overall goals of the pull request.

Source Preview Production What Changed
actions/creating-actions/creating-a-composite-action.md fpt
ghec
ghes@ 3.6 3.5 3.4 3.3 3.2
ghae
fpt
ghec
ghes@ 3.6 3.5 3.4 3.3 3.2
ghae
actions/creating-actions/creating-a-docker-container-action.md fpt
ghec
ghes@ 3.6 3.5 3.4 3.3 3.2
ghae
fpt
ghec
ghes@ 3.6 3.5 3.4 3.3 3.2
ghae
actions/using-workflows/workflow-commands-for-github-actions.md fpt
ghec
ghes@ 3.6 3.5 3.4 3.3 3.2
ghae
fpt
ghec
ghes@ 3.6 3.5 3.4 3.3 3.2
ghae

fpt: Free, Pro, Team ghec: GitHub Enterprise Cloud ghes: GitHub Enterprise Server ghae: GitHub AE

github-actions[bot] avatar Oct 22 '22 07:10 github-actions[bot]

@oliverjfletcher Thanks so much for opening a PR and linking it to your issue! I'll get this triaged for review :zap:

cmwilson21 avatar Oct 24 '22 16:10 cmwilson21

👋 @oliverjfletcher, thanks for this PR!

Other than the whitespace changes, the changes you've made for $GITHUB_OUTPUT aren't correct.

This content was already updated in https://github.com/github/docs/commit/01577fdefb3984fed0ae1ac4d16bd344e90c48e9 (with a few minor fixes since then). The changes you've made are to sections of the article that are versioned only for GitHub's separate Enterprise products (such as GitHub Enterprise Server), which still uses the old set-output method until the upcoming 3.8 release.

Looking at the 'Free, Pro, Team' version of the docs at https://docs.github.com/en/actions/using-workflows/workflow-commands-for-github-actions, all the mentions of set-output are not visible.

lucascosti avatar Oct 28 '22 00:10 lucascosti