# issue #158
on: push

env:
  # 'env:' at toplevel cannot refer 'env' context
  ERROR1: ${{ env.PATH }}

jobs:
  my_job:
    runs-on: ubuntu-latest
    env:
      FOO: aaa
      # 'env:' at job level cannot refer 'env' context
      ERROR2: ${{ env.PATH }}
    steps:
      # 'env:' at step level can refer 'env' context
      - run: echo "$BAR"
        env:
          BAR: ${{ env.FOO }}
      # This still should be OK
      - uses: test/my-action@main
        env:
          OS: ${{ runner.os }}
          NAME: ${{ runner.name }}
  container-job:
    runs-on: ubuntu-latest
    container:
      image: node:14.16
      # 'env:' at 'container:' can refer 'env' context
      env:
        MYPATH: ${{ env.PATH }}
    steps:
      - run: echo hello
