I have been previously using set-output for setting values, but we now get thee "deprecated feature" messages and I'm using $GITHUB_OUTPUT as prescribed.
I replace all instances of
run: echo ::set-output name=Key::Value
with
run: "Key=Value" >> $GITHUB_OUTPUT
but Key does not appear to be set.
My runner is on Windows, version 2.299.1 and the workflow is using CMD. All calls to set-output work, and all using $GITHUB_OUTPUT do not.
Simplified action code
defaults:
run:
shell: cmd
jobs:
EnvSetup:
name: Publish Base Environment Vars
runs-on: [self-hosted, Windows, myLabel]
outputs:
var_Project: ${{ steps.set-Project.outputs.Project }}
var_Val1: ${{ steps.set-Val1.outputs.Val1 }}
var_Val2: ${{ steps.set-Val2.outputs.Val2 }}
steps:
- name: Project
id: set-Project
run: echo ::set-output name=Project::Larry
- name: Val1
id: set-Val1
run: echo "Val1=Curly" >> $GITHUB_OUTPUT
- name: Val2
id: set-Val2
run: echo "Val2=Moe" >> $GITHUB_OUTPUT
...
Testing:
name: ShowStuff
runs-on: [self-hosted, Windows, myLabel]
needs: [EnvSetup]
env:
MyProject: ${{ needs.EnvSetup.outputs.var_Project }}_ABC
steps:
- name: Print environment variables
run: |
echo "Project: ${{ needs.EnvSetup.outputs.var_Project }}" ^
echo "MyProject: ${{ env.MyProject }}" ^
echo "Val1: ${{ needs.EnvSetup.outputs.var_Val1 }}" ^
echo "Val2: ${{ needs.EnvSetup.outputs.var_Val2 }}"
The output:
echo "Project: Larry"
echo "MyProject: Larry_ABC"
echo "Val1: "
echo "Val2: "
From everything I've seen, the way to reference the values hasn't changed, just the set.
Has anyone else tried it using CMD? I'll go to PowerShell if I have to, but that's not a small change if I can avoid it.