Skip to content

Github secrets not found windows-latest / windows-2019 #26988

Answered by BrightRan
NAJ8ry asked this question in Actions
Discussion options

You must be logged in to vote

@naj8ry ,

Yeah, when you want to access the environment variables in the command lines, the expression syntaxes are different on different shells.

For example:

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 wor…

Replies: 4 comments

Comment options

You must be logged in to vote
0 replies
Comment options

You must be logged in to vote
0 replies
Comment options

You must be logged in to vote
0 replies
Answer selected
Comment options

You must be logged in to vote
0 replies
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
3 participants