Use Global Environment Variables in with clause of workflow

I’m currently writing an action that can execute ansible playbooks.
My problems is the extra-vars section.

Due to the fact that it’s not possible to pass arrays into the dockerfile I need to do a workaround.
Mine is to pass a String like this:

  extraVars: 'my_first_extra=${{ GITHUB_ACTOR }} my_second_one=${{ GITHUB_SHA }}'

This doesn’t work out for me because the workflow is complaining like this:

### ERRORED 11:48:48Z

- Your workflow file was invalid: The pipeline is not valid. .github/workflows/main.yml (Line: 23, Col: 22): Unrecognized named-value: 'GITHUB_ACTOR'. Located at position 1 within expression: GITHUB_ACTOR

What am I doing wrong? How can i use global environment variables as “with” variable?

I know that it’s possible to use secrets like secrets.MY_SECRET````  Is there a clue how to do that with global environment variables like env.GITHUB_SHA```?

A little further reading brought me to the solution which one can find here:

It’s almost the same as with input variables which convert from ‘whateverMyVariable-NameIs’ to ‘INPUT_WHATEVERMYVARIABLE_NAMEIS’.
The same applies here: github.sha becomes GITHUB_SHA

  extraVars: 'my_first_extra=${{ }} my_second_one=${{ github.sha }}'

We appreciate you coming back and sharing @ppoetz, this post might help another user in the future. In the meantime, we’re looking forward to seeing you around!