GitHub variables in Uses, Secrets etc

I have created 2 actions in my repository. They do the same thing, but on different OS (Linux & Windows). In my workflow, I have the 2 actions in the following path

In my workflow, I want to use the following syntax
uses: ./.github/actions/${{ runner.os }}/myCA/action.yml

But the above throws an Invalid Workflow Syntax error.

Also, I have 2 different secrets based on OS.

  • uses: SomeCA
    ENV_VAR: ${{ secrets.MY_SECRET_WINDOWS }}

In the above scenario, I want to replace WINDOWS with say something like ${{ runner.os }} (again with Uppercase since the secret name is in uppercase), so that the secret will be something like ${{ secrets.MY_SECRET_${{ runner.os }} }}.

Can anyone please help with these?

uses cannot be dynamic: Env variables in uses - #2 by chrispat

Regarding dynamic secrets, this should work in principle:
${{ secrets[format('MY_SECRET_{0}', runner.os)] }}
You may have to use a string utility action or some shell code to convert the OS name to uppercase beforehand and set it as output.