-
Notifications
You must be signed in to change notification settings - Fork 1.5k
New issue
Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? # to your account
Add save-state and set-output file commands #1178
Conversation
@@ -22,3 +23,25 @@ export function issueCommand(command: string, message: any): void { | |||
encoding: 'utf8' | |||
}) | |||
} | |||
|
|||
export function prepareKeyValueMessage(key: string, value: any): string { | |||
const delimiter = `ghadelimiter_${uuidv4()}` |
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.
👍 on the refactor
9579083
to
c08ee23
Compare
c08ee23
to
28f9431
Compare
a44786d
to
28f9431
Compare
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.
lgtm
When will this find its way into |
In version 1.10.0 of `@actions/core` they have fixed the warning we are getting for set-output in our github actions. As per per this PR actions/toolkit#1178 And as discussed here actions/toolkit#1218
if (key.includes(delimiter)) { | ||
throw new Error( | ||
`Unexpected input: name should not contain the delimiter "${delimiter}"` | ||
) | ||
} |
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.
The check for the delimiter
in the key
feels a little misleading to me - if the key
is user-controlled, it can still be used to add additional outputs if that's the risk being mitigated here; the delimiter doesn't capture the key
, it just captures the value
.
if (key.includes(delimiter)) { | |
throw new Error( | |
`Unexpected input: name should not contain the delimiter "${delimiter}"` | |
) | |
} |
The `@actions/core` package has been updated to squash this warning: > The `set-output` command is deprecated and will be disabled soon. Please upgrade to using Environment Files. For more information see: https://github.blog/changelog/2022-10-11-github-actions-deprecating-save-state-and-set-output-commands/ Notes: > Action authors who are using the toolkit should update the @actions/core package to v1.10.0 or greater to get the updated saveState and setOutput functions. https://github.com/actions/toolkit/blob/main/packages/core/RELEASES.md > ### 1.10.0 > - `saveState` and `setOutput` now use environment files if available [#1178](actions/toolkit#1178)
When running the tool, I get warning: Warning: The `set-output` command is deprecated and will be disabled soon. Please upgrade to using Environment Files. For more information see: https://github.blog/changelog/2022-10-11-github-actions-deprecating-save-state-and-set-output-commands/ But I'm using the latest 1.11.0 version of actions/core npm module so this shouldn't happen? I found the PR that implemented a fix for the deprecation, actions/toolkit#1178, and in it, I see that it checks if it has access to the GITHUB_OUTPUT environment variable. If it doesn't, it will fallback to previous behavior. commit-id:c8c672a4
When running the tool, I get warning: Warning: The `set-output` command is deprecated and will be disabled soon. Please upgrade to using Environment Files. For more information see: https://github.blog/changelog/2022-10-11-github-actions-deprecating-save-state-and-set-output-commands/ But I'm using the latest 1.11.0 version of actions/core npm module so this shouldn't happen? I found the PR that implemented a fix for the deprecation, actions/toolkit#1178, and in it, I see that it checks if it has access to the GITHUB_OUTPUT environment variable. If it doesn't, it will fallback to previous behavior. commit-id:c8c672a4
When running the tool, I get warning: Warning: The `set-output` command is deprecated and will be disabled soon. Please upgrade to using Environment Files. For more information see: https://github.blog/changelog/2022-10-11-github-actions-deprecating-save-state-and-set-output-commands/ But I'm using the latest 1.11.0 version of actions/core npm module so this shouldn't happen? I found the PR that implemented a fix for the deprecation, actions/toolkit#1178, and in it, I see that it checks if it has access to the GITHUB_OUTPUT environment variable. If it doesn't, it will fallback to previous behavior. commit-id:c8c672a4
When running the tool, I get warning: Warning: The `set-output` command is deprecated and will be disabled soon. Please upgrade to using Environment Files. For more information see: https://github.blog/changelog/2022-10-11-github-actions-deprecating-save-state-and-set-output-commands/ But I'm using the latest 1.11.0 version of actions/core npm module so this shouldn't happen? I found the PR that implemented a fix for the deprecation, actions/toolkit#1178, and in it, I see that it checks if it has access to the GITHUB_OUTPUT environment variable. If it doesn't, it will fallback to previous behavior. commit-id:c8c672a4
When running the tool, I get warning: Warning: The `set-output` command is deprecated and will be disabled soon. Please upgrade to using Environment Files. For more information see: https://github.blog/changelog/2022-10-11-github-actions-deprecating-save-state-and-set-output-commands/ But I'm using the latest 1.11.0 version of actions/core npm module so this shouldn't happen? I found the PR that implemented a fix for the deprecation, actions/toolkit#1178, and in it, I see that it checks if it has access to the GITHUB_OUTPUT environment variable. If it doesn't, it will fallback to previous behavior. commit-id:c8c672a4
This adds support for the file command version of
save-state
andset-output
that are being added to the runner in #2118.In the case that these commands are being used on a runner that doesn't support the file-command versions they will fallback to the pre-existing workflow commands.