Add to the path using Github Actions

The current add-path command will be deprecated on November 16. I tried following their new instructions and adding the path using echo "/path/to/dir" >> $GITHUB_PATH , but it’s not working. What is the correct command? I am building on Windows.

The error that I was seeing on github actions is Error: The add-path command is deprecated and will be disabled on November 16th. Please upgrade to using Environment Files. For more information see: https://github.blog/changelog/2020-10-01-github-actions-deprecating-set-env-and-add-path-commands/

Found the answer, this is what worked in Windows for me

echo "C:/Program Files (x86)/Etc" | Out-File -Append -FilePath $env:GITHUB_PATH -Encoding utf8

It depends on the shell type. The default is pwsh on Windows runners, so you need to do it the PowerShell way. In cmd it’s different:

echo C:\Program Files (x86)\Etc >> %GITHUB_PATH%

(I checked that the GitHub runners default to chcp 65001, which is UTF-8 - so there should be no problems even with special characters in the path)