With Github actions, each 'shell' has a different way of setting environment variables.
here's a list
env: MSG: Hello jobs: print_env_var: name: Print environment variable runs-on: windows-latest steps: - name: Print environment variable with cmd run: echo "String matches %MSG%" shell: cmd
- name: Print environment variable with powershell
run: echo "String matches $env:MSG"
shell: powershell
- name: Print environment variable with bash
run: echo "String matches $MSG"
shell: bash
- name: Print environment variable with pwsh
run: echo "String matches ${env:MSG}" # Use $env:MSG also can work
shell: pwsh
- name: Print environment variable with python
run: |
import os
print("String matches", os.environ['MSG'])
shell: python