Skip to content

GITHUB_PATH always takes precedence over GITHUB_ENV #655

@wchargin

Description

@wchargin

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!)

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't workingexternal

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions

      pFad - Phonifier reborn

      Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

      Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


      Alternative Proxies:

      Alternative Proxy

      pFad Proxy

      pFad v3 Proxy

      pFad v4 Proxy