You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
feature: add an option not to add/update environment variables #410
Description:
Add an option not to add/update environment variables.
Justification:
When using actions/setup-python, it will update or add PATH, PythonLocation, PKG_CONFIG environment variables.
If one is to use actions/setup-python inside a composite action, those environment variables update might conflict with a user workflow.
e.g.
- uses: actions/setup-python@v3with:
python-version: "3.7"
- uses: some/composite-action@v1 # Runs a different setup-python internally with python-version: "3.10"
- run: python --version # this will show python 3.10 while the user expects 3.7
With this proposal, some/composite-action could use:
- uses: actions/setup-python@v3id: cp310with:
python-version: "3.10"no-environment-update: true
- run: ${{ steps.cp310.outputs.python-path }} --version # this will show python 3.10 in the composite action
The user workflow will now print python 3.7 as expected.
Then using the action would have no side effects for later steps - neither the Python activation nor the required dependencies are leaked. Currently, "nice" (non-leaky) composite actions are limited by what the default Python attached to pipx is.
@panticmilos I would rename the option from no-environment-update to preserve-environment because the environment might need to be changed within the nested action and restored when the flow returns back to outer.
Moreover it would make a sense to add this option to the all actions globally.
Activity
henryiii commentedon May 26, 2022
The example of usage to turn any Python application into a standalone action that can select any Python version I expect would be:
Then using the action would have no side effects for later steps - neither the Python activation nor the required dependencies are leaked. Currently, "nice" (non-leaky) composite actions are limited by what the default Python attached to pipx is.
panticmilos commentedon May 27, 2022
Hi @mayeut!
First of all thank you for submitting the PR, and opening the issue. We will investigate it deeper.
Cheers
dsame commentedon Jun 20, 2022
@panticmilos I would rename the option from
no-environment-updatetopreserve-environmentbecause the environment might need to be changed within the nested action and restored when the flow returns back to outer.Moreover it would make a sense to add this option to the all actions globally.