GitHub action to clean up your PATH
Find a file
Egor Tensin 203b15ee12 make it into a JavaScript action
This is a huge step back IMO, but I needed to be able to restore the
original PATH back as a "post" step.  Currently, composite actions don't
support post-actions, but JavaScript ones do.  I needed this due to a
bug: actions/cache wouldn't find Git's tar on windows-2016 (the one in
System32 would get used on windows-2019) if the PATH was cleaned up.
2021-03-14 03:42:14 +03:00
.github/workflows initial commit 2020-12-24 03:56:08 +03:00
.gitattributes add .gitattributes 2020-12-25 04:11:03 +03:00
action.yml make it into a JavaScript action 2021-03-14 03:42:14 +03:00
clean.js make it into a JavaScript action 2021-03-14 03:42:14 +03:00
LICENSE.txt initial commit 2020-12-24 03:56:08 +03:00
package.json make it into a JavaScript action 2021-03-14 03:42:14 +03:00
README.md add README 2020-12-24 04:08:49 +03:00
restore.js make it into a JavaScript action 2021-03-14 03:42:14 +03:00

Clean up PATH

Test

The PATH variable on Windows runners is a cesspool. For example, it includes seemingly dozens of MinGW distributions. This action takes a page out of MSYS2's book here, and cleans PATH so that only the default paths are included. Use it in your workflow like this:

- name: Clean up PATH
  uses: egor-tensin/cleanup-path@v1

API

Input Value Default Description
dirs Empty Yes No additional paths.
Other No Additional paths, separated by a semicolon (;).
default 1 Yes Add the default directories under C:\Windows.
Other No Don't add the default directories.

The action sets the PATH environment variable. Note that even if you call it with default: 0 and don't specify any dirs, it might not clear your PATH completely. Actions like setup-python, etc. have a way to propagate their values to PATH regardless. Also, your shell selection matters.

License

Distributed under the MIT License. See LICENSE.txt for details.