28

I was wondering how I can set the system path variables in the GitHub actions workflow.

export "$PATH:$ANYTHING/SOMETHING:$AA/BB/bin"
1
  • Hi amr. Did you try doing it the same way than for other environment variables on github actions? Commented Jul 1, 2021 at 13:51

2 Answers 2

35

You can use the following run command to set a system path variable in your actions workflow.

Syntax:

echo "{path}" >> $GITHUB_PATH
- run: |
   echo "$AA/BB/bin" >> $GITHUB_PATH

Additionally, if you have downloaded some binaries and trying to set its path, GitHub uses a special directory called $GITHUB_WORKSPACE as your current directory. You may need to specify this variable in your path in that case.

- run: |
   echo "$GITHUB_WORKSPACE/BB/bin" >> $GITHUB_PATH
Sign up to request clarification or add additional context in comments.

Comments

11

If you are using Bash shell

- name: Add to PATH
  shell: bash
  run: |
    echo "Folder PATH" >> $GITHUB_PATH

For Powershell as a shell:

- name: Add to PATH
  shell: pwsh
  run: |
    echo "Folder PATH" | Out-File -FilePath $env:GITHUB_PATH -Encoding utf8 -Append
  

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.