Variable expression returns empty on Windows runner

Hello.

I have the following job into my workflow:

 - name: Get the version to release
   id: get_version
   run: echo ::set-output name=version::${GITHUB_REF#refs/tags/v}

Everything works fine on Windows and MAC machines but on Windows the version is empty.

Is there any difference on syntax on Windows machines?

Thank you.

On windows the default shell is Powershell, which uses a different way of accesing environment variables. See here for an example: https://help.github.com/en/actions/reference/workflow-syntax-for-github-actions#example-running-a-script-using-powershell-core

You can also specify a different shell via shell:

@brpaz,
For the GitHub-hosted runners, the default shell is bash on Linux and macOS, and PowerShell on Windows.
The syntax ${VAR_NAME#…} seems is not available to PowerShell, but available to bash.
You can execute the command with bash shell on Windows runner.

 - name: Get the version to release
   id: get_version
   run: echo "::set-output name=version::${GITHUB_REF##*/v}"
   shell: bash