How to access enviroment variables defined in repo > settings > enviroment?

I have defined enviroment variables, say, REDIS_HOST in repo > settings >enviroment, the enviroment name is test

How could I refer to this variable in scripts? During my tox test, I need the value of $REDIS_HOST.

In my test.yml:

# This is a basic workflow to help you get started with Actions

name: CI

# Controls when the action will run. 
on:
  # Triggers the workflow on push or pull request events but only for the master branch
  push:
    branches: [ master ]
  pull_request:
    branches: [ master ]

  # Allows you to run this workflow manually from the Actions tab
  workflow_dispatch:

# A workflow run is made up of one or more jobs that can run sequentially or in parallel
jobs:
  test:
    runs-on: ubuntu-latest
    environment: test
    steps:
      - name: test envar
        run: echo $REDIS_HOST

the output:

echo $REDIS_HOST

it’s not substituted

seems variables defined in secrets/environement could not be used directly. It should be imported like this:

jobs:
  test:
  env:
     REDIS_HOST: {{secrets.REDIS_HOST}}

then $REDIS_HOST is available.