-
Notifications
You must be signed in to change notification settings - Fork 442
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
Having some issues with deprecated "set-output" using Github Files and this action #353
Comments
👋 This action includes For your example, it would look like: - console.log("::set-output name=execute::" + execute)
+ core.setOutput("execute", execute) Internally,
You could write a python script and execute it directly in a import os
command = os.environ['TERRAFORM_COMMAND']
execute = False
if (command != 'no-op'):
workspace = os.environ['WORKSPACE']
execute = True
workspace_filter = os.environ['WORKSPACE_FILTER']
if (len(workspace_filter.strip()) > 0):
filter_array = list(map(str.strip, workspace_filter.split(',')))
if (len(filter_array) > 0):
execute = workspace in filter_array
output_file = open(os.environ['GITHUB_OUTPUT'], 'a')
output_file.write(f'execute={str(execute).lower()}\n')
output_file.close() If this is on a self-hosted runner, you'd also want to ensure Python is installed - https://github.com/actions/setup-python For inputs and outputs, we can set them as steps:
- name: "Filter workspace"
id: filter_workspace
run: python script.py
env:
TERRAFORM_COMMAND: ${{ github.event.inputs.TERRAFORM_COMMAND }}
WORKSPACE: ${{ matrix.workspace }}
WORKSPACE_FILTER: ${{ github.event.inputs.WORKSPACE_FILTER }}
|
Thanks! I will give this a try and let you know how it works for me (the setOutput change) |
core.setOutput worked beautifully. Thanks again :) |
Is your feature request related to a problem? Please describe.
We use this action to output vars to other parts of our workflow, but we are having difficulty getting this action to output when switching from the current usage to the new format.
Here is the current excerpt from a workflow where we use this action. The issue is when we try to change the last line to the new format, removing "set-output". We suspect that since it's embedded inside of Node.js that it doesn't like being flipped around.
Here is the github documentation suggesting refactor of the set-output command.
https://github.blog/changelog/2022-10-11-github-actions-deprecating-save-state-and-set-output-commands/
Is there a recommended way to change this set-output command that will still work with your action? Does your action support Python? Are you aware of any that do? I know that I have not provided much more of a code reference, but it is not a public repository. What I can say is that the
The text was updated successfully, but these errors were encountered: