Issue with variables on Windows

I have this step on windows-2016

    - name: get version
      run: |
        set version=%GITHUB_REF:*tags/=%
        echo ::set-output name=version::%version%

It works perfectly at least until 10 days ago. I had output like this

::set-output name=version::v2.4.17

Now, the same script outputs two lines and not only one and the variable value is wrong

::set-output
name=version::%version%

What changed or what do I do wrong?

1 Like

Got the same problem.

It turned out that the string to echo must be quoted (at least on Windows).

So the following:

echo ::set-output name=version::%version%

should become:

echo "::set-output name=version::%version%"

Reference: the  GitHub Actions / Automating your workflow / Building actions / Development tools /
Development tools for GitHub Actions
(https://help.github.com/en/actions/automating-your-workflow-with-github-actions/development-tools-for-github-actions).

2 Likes