docs icon indicating copy to clipboard operation
docs copied to clipboard

Clarify how multiline output values can be set via `GITHUB_OUTPUT`

Open fingolfin opened this issue 3 years ago • 5 comments

Code of Conduct

What article on docs.github.com is affected?

https://docs.github.com/en/actions/using-workflows/workflow-commands-for-github-actions#setting-an-output-parameter

What part(s) of the article would you like to see updated?

Due to recent changes, I had to switch our codeflows from using set-output to the method described in the section on "Setting an output parameter", by appending to (the file with the name in the variable) $GITHUB_OUTPUT.

This is very similar to how $GITHUB_ENV works in the previous section.

I had need to post a multiline output, and so decided to just try the technique described for "Environment files" (the preceding section). That is, I used the pattern

{name}<<{delimiter}
{value}
{delimiter}

and ended up with code looking like this:

steps:
  - name: Set the output in bash
    id: step_one
    run: |
      echo 'JSON_RESPONSE<<EOF' >> $GITHUB_OUTPUT
      curl https://example.lab >> $GITHUB_OUTPUT
      echo 'EOF' >> $GITHUB_OUTPUT

And as far as I can tell, this worked great (and is much simpler than what I had to do before).

I think it would be beneficial if this possibility was pointed out by the documentation. Simply saying something akin to "multi-line output values can be set with the same technique used in the previous section to define multi-line environment variables" would already help a lot.

Additional information

No response


edited by maintainer

Content plan here

fingolfin avatar Oct 21 '22 16:10 fingolfin

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 21 '22 16:10 welcome[bot]

@fingolfin Thanks so much for opening an issue! I'll triage this for the team to take a look :eyes:

cmwilson21 avatar Oct 24 '22 15:10 cmwilson21

Thanks for this issue! You or anyone else is welcome to open a PR to point users to the multi-line strings section from the setting an output parameter section. I would recommend including a link instead of referring to "the previous section" to help users find the info even if the structure of this article changes in the future. I think it could also be useful to include an example.

skedwards88 avatar Oct 24 '22 22:10 skedwards88

Hi can I work on this?

ujjwal-shekhar avatar Oct 25 '22 04:10 ujjwal-shekhar

image_a1cc42f1-ea5d-4f4c-a5ca-dd1a4e5c740420221030_200229 [wall paper ](google play stroe)

Soemind avatar Oct 30 '22 18:10 Soemind