${{ env.GITHUB_WORKSPACE }} empty

Hi

What is the best way to get the value of the workspace? This value seems to be empty when printing.

There is another env variable, ${{ github.workspace }} but it doesnt have the same value as ${{ env.GITHUB_WORKSPACE }}

Thanks

Can you share out your workflow file?

Also, are you executing a actions/checkout step? If you don’t have that step, than this environment variable is empty: Environment variables - GitHub Docs

I found a way of making it work, creating an extra env variable from the existing GITHUB_WORKSPACE one, which looks redundant.

GITHUB_WORKSPACE prints empty but env.workspace prints the path.

name: test
on: push
jobs:
build:
runs-on: ubuntu-latest
- name: Set env
run: echo workspace=$GITHUB_WORKSPACE >> $GITHUB_ENV
- name: print
run: |
echo ${{ env.workspace }}
echo ${{ GITHUB_WORKSPACE }}