-
Notifications
You must be signed in to change notification settings - Fork 18
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
Replace deprecated GHA ::set-output syntax #193
Replace deprecated GHA ::set-output syntax #193
Conversation
_, _ = fmt.Fprintf(d.Writer, "::set-output name=%s::%s\n", name, escape(value)) | ||
err := d.export("GITHUB_OUTPUT", name, value) | ||
if err != nil { | ||
panic(err) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Note to reviewer:
I decided to use panic here. I don't think an action can recover from such an error.
I'm open to changing this and return an error, but that would mean touching all the call-sides and handle the error (by panic
?)
if d.Delemiter == "" { | ||
data := make([]byte, 16) // roughly the same entropy as uuid v4 used in https://github.com/actions/toolkit/blob/b36e70495fbee083eb20f600eafa9091d832577d/packages/core/src/file-command.ts#L28 | ||
_, err := rand.Read(data) | ||
if err != nil { | ||
panic(fmt.Errorf("could not generate random delimiter: %w", err)) | ||
} | ||
d.Delemiter = hex.EncodeToString(data) | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Note for reviewer:
GitHub recommends using random delimiters when writing multi-line strings to environment files for security reasons. See https://docs.github.com/en/actions/using-workflows/workflow-commands-for-github-actions#multiline-strings
Also: It is not unthinkable that an output contains the word EOF
which would cause problems.
The Delimiter
member is initialized in the test setup to keep the unit test deterministic.
2640cc1
to
e0c3baf
Compare
@phil9909 thanks (again). I'll pull this into my own branch if you don't get a chance to update yours by tomorrow |
e0c3baf
to
987415a
Compare
I got the following error in
As I couldn't see how this error is related to my changes, I ran After digging I bit, I guess this happened due to the action not being triggered on updates to
One of the dependabot PRs probably broke the build and my PR is now the first PR touching the code again (and thereby triggering the action). For now, I will just bump the go version in the |
1de5ef6
to
3b4c6d3
Compare
oof, sorry about that |
Signed-off-by: Philipp Stehle <philipp.stehle@sap.com>
Recommended by GitHub for security. See https://docs.github.com/en/actions/using-workflows/workflow-commands-for-github-actions#multiline-strings Also: It is not unthinkable that an output contains the word `EOF` which would cause problems. Signed-off-by: Philipp Stehle <philipp.stehle@sap.com>
3b4c6d3
to
64337bf
Compare
@jkutner rebased (and dropped the commit that changes the |
Use the new way of producing outputs in a github action as the old way is deprecated and will be removed (31st May 2023).
See https://github.blog/changelog/2022-10-11-github-actions-deprecating-save-state-and-set-output-commands/
Notice: I did not update the actions managed by the pipeline-builder. These should be fixed by this automated PR #177