Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

New "set-output" command #2225

Closed
rez1dent3 opened this issue Oct 24, 2022 · 3 comments
Closed

New "set-output" command #2225

rez1dent3 opened this issue Oct 24, 2022 · 3 comments
Labels
bug Something isn't working

Comments

@rez1dent3
Copy link

Describe the bug
After reading the article, I began to update my github actions. But now there is a problem with escaping the string. Something like this already happened here: #267

To Reproduce
Steps to reproduce the behavior:

          OUTPUT="${OUTPUT//$'\n'/'%0A'}"
          OUTPUT="${OUTPUT//$'\r'/'%0D'}"
-         echo "::set-output name=stdout::$OUTPUT"
+         echo "stdout=$OUTPUT" >> $GITHUB_OUTPUT

Diff: https://github.com/bavix/laravel-wallet-benchmark/pull/33/files

Expected behavior
Hyphenation characters will be displayed correctly.

Expected table: bavix/laravel-wallet-benchmark#32 (comment)
Actual table: bavix/laravel-wallet-benchmark#33 (comment)


Do I understand correctly that now escaping is automatic and crutches at the github actions level are no longer needed?

@rez1dent3 rez1dent3 added the bug Something isn't working label Oct 24, 2022
@xt0rted
Copy link

xt0rted commented Oct 24, 2022

I ran into this yesterday while updating some of my workflows. The fix was to remove the escape code, it's no longer needed. If your value might span multiple lines then you need to write it out like this https://docs.github.com/en/actions/using-workflows/workflow-commands-for-github-actions#multiline-strings

@rez1dent3
Copy link
Author

Hello, @xt0rted . Thanks, I'll try later. Most likely this will solve the problem. I created an issue to report a possible mass issue.

@rez1dent3
Copy link
Author

-        OUTPUT="${OUTPUT//'%'/'%25'}"
-        OUTPUT="${OUTPUT//$'\n'/'%0A'}"
-        OUTPUT="${OUTPUT//$'\r'/'%0D'}"
-        echo "::set-output name=stdout::$OUTPUT"
+        echo "stdout<<EOF" >> $GITHUB_OUTPUT
+        echo "$OUTPUT" >> $GITHUB_OUTPUT
+        echo 'EOF' >> $GITHUB_OUTPUT

@xt0rted Yes you are right. Thank you.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

2 participants