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

Update to use GitHub's environment files #43

Closed
sormuras opened this issue Oct 11, 2022 · 6 comments · Fixed by #45
Closed

Update to use GitHub's environment files #43

sormuras opened this issue Oct 11, 2022 · 6 comments · Fixed by #45
Assignees

Comments

@sormuras
Copy link
Member

System.out.printf("::set-output name=%s::%s%n", name, value);

Action and workflow authors who are using save-state or set-output via stdout should update to use the new environment files.

https://github.blog/changelog/2022-10-11-github-actions-deprecating-save-state-and-set-output-commands/

@sormuras sormuras added the good first issue Good for newcomers label Oct 11, 2022
@sormuras sormuras self-assigned this Oct 11, 2022
@derlin
Copy link

derlin commented Oct 11, 2022

Are you suggesting to modify this line with the following ?

System.out.printf("echo \"%s=%s\" >> $GITHUB_OUTPUT%n", name, value); 

Or do you see other changes that are necessary ?

(I am interested in taking this issue)

@sormuras
Copy link
Member Author

Yes, as far as I can tell, it's the only line that requires a change:
image

Your proposed change woudn't work on Windows (cmd.exe nor PowerShell), would it?
Perhaps using NIO's Files.write[String]() is platform-agnostic solution. Something like:

var output = Path.of(System.env...);
Files.write(
    output,
    List.of(name + "=" + value),
    StandardCharsets.UTF_8,
    StandardOpenOption.CREATE,
    StandardOpenOption.APPEND,
    StandardOpenOption.WRITE);

Before you hack away and create a pull request, I first need to clarify whether and how contributions can be submitted.

@sormuras
Copy link
Member Author

Starting today runner version 2.298.2 will begin to warn you if you use the save-state or set-output commands via stdout.

Warnings are now in place.

image

sormuras added a commit that referenced this issue Oct 18, 2022
@sormuras sormuras removed the good first issue Good for newcomers label Oct 18, 2022
@sormuras
Copy link
Member Author

@derlin I am taking care of this issue because I want to get rid of the warnings as soon as possible. That's why I removed the good first issue label and filed:

sormuras added a commit that referenced this issue Oct 19, 2022
@sormuras
Copy link
Member Author

Outputs are empty?!

image

@sormuras sormuras reopened this Oct 19, 2022
@sormuras
Copy link
Member Author

Fixed by e81158a

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Development

Successfully merging a pull request may close this issue.

2 participants