-
Notifications
You must be signed in to change notification settings - Fork 1.7k
Description
The docs for environment files say that you can write a key-value
pair to ${GITHUB_ENV} to “[update] an environment variable for any
actions running next in a job”. But this has an undesirable interaction
with the ${GITHUB_PATH} environment file: old GITHUB_PATH entries
are still included even after GITHUB_ENV is used to reset the variable
contents.
For instance, in this example…
- run: echo '/some/path/dir' >>"${GITHUB_PATH}"
- run: echo 'PATH=/usr/bin:/bin' >>"${GITHUB_ENV}"
- run: echo "$PATH"…we would expect the last step to print /usr/bin:/bin, because that
is the environment variable that has been explicitly set. But instead it
prints /some/path/dir:/usr/bin:/bin, using the path entries that were
prepended before the variable was cleared.
This is problematic because it makes it impossible to reset PATH after
a previous step has echoed to GITHUB_PATH. Specifically, I want to use
the setup-python action to configure a Python toolchain, then create a
virtualenv, and then remove the stock Python toolchain from the path—but
since setup-python uses ${GITHUB_PATH}, there is no way to do this.
(As a user, it’s hard to tell what part of the platform is responsible
for this behavior and whether that code is open source. I’ve filed
against this repository because setup-python uses core.addPath and
thus runs into this issue. If this isn’t the right place, please advise
me where I should file an issue instead. Thanks!)