How to set environment attribute dynamically in a workflow?

Hello, in the settings of my repository I created 2 environments: development and production. I also have 2 branches of the same name. I want my workflow to execute in the corresponding environment (so as to grab the correct git secrets).

This is what I have:

    name: Run external workflow
    environment: ${{ github.ref }}
    runs-on: ubuntu-latest
      - name: Echo env var
          my_var: ${{ secrets.my_var }}
        shell: bash
        run: echo $my_var

However, I get the following error on the environment line:

Unrecognized named-value: ‘github’. Located at position 1 within expression: github.ref

Looks like I can’t use github context to set the environment attribute. Is there a way to set the environment of the workflow dynamically? Thanks!