$GITHUB_PATH does not add to the path

Hi Github Community,

I’m having trouble using $GITHUB_PATH. I can’t tell if I’m not using it correctly, or if It’s not executing correctly.

For both of the following links, please pay attention to the Windows builds only.

Here is a link to a previous version of a Github Action script that did work prior the switch to $GITHUB_PATH.

Here is a link to the most recent version of the Github Action script that stopped working with the $GITHUB_PATH changes.

Please note specifically the steps titled Update Environment Variables whose source is the following:
This first code block is what worked successfully prior to the changed.

- name: Update Environment Variables
  run: |
    echo "::add-path::${{github.workspace}}/main/extern/crashpad/breakpad/win/"
    echo "::set-env name=ETTERNA_ARCH::${{matrix.cfg.name}}"

The above code block was updated to below with the $GITHUB_PATH changes

- name: Update Environment Variables
  run: |
    echo "${{github.workspace}}/main/extern/crashpad/breakpad/win/" >> $GITHUB_PATH
    echo "ETTERNA_ARCH=${{matrix.cfg.name}}" >> $GITHUB_ENV

Here is a following step titled Generate Symbols where that path is required:

- name: Generate Symbols
  run: |
    echo "Dumping Symbols..."
    dump_syms.exe main/Program/Etterna.pdb > ${{github.workspace}}/main/Etterna.sym

dump_syms.exe is in the ${{github.workspace}}/main/extern/crashpad/breakpad/win/ folder.

Am I doing something incorrectly with the usage of the $GITHUB_PATH variable?

Thanks in advance,
James

Hey @jameskr97, you appear to be using the bash example, but on windows a step runs on pwsh (powershell core) by default.

Since you are using hosted runners, bash is included. Try updating your step to to run that step in bash:

- name: Update Environment Variables
  shell: bash
  run: |
    echo "${{github.workspace}}/main/extern/crashpad/breakpad/win/" >> $GITHUB_PATH
    echo "ETTERNA_ARCH=${{matrix.cfg.name}}" >> $GITHUB_ENV

If you need to be using powershell, you can follow the powershell example here

It would look like:

steps:
  - run: |
      echo "${{github.workspace}}/main/extern/crashpad/breakpad/win/" | Out-File -FilePath $env:GITHUB_PATH -Encoding utf8 -Append
      echo "ETTERNA_ARCH=${{matrix.cfg.name}}" | Out-File -FilePath $env:GITHUB_ENV -Encoding utf8 -Append

Thank you very much!

I’m so tuned into bash, I didn’t think of the shell that I was using.

I appreciate your help.