Reusable Workflows, Secrets and Environments

Look at this repo

Here I show an example of the error that you may be facing, and also a solution for it which does exactly what @jenschelkopf said

I have same exact issue, this syntax literally doesn’t work.

Specifying the environment as input also doesn’t work, none of my environment secrets ever get read in this case.

@shayaantx see the repo I posted above. It will show you what you are not doing right. If you don’t understand something you can open an issue in the repo with your questions.

@jenschelkopf

As a suggestion, It would be better if reusable workflows/workflow templates allow us to do this

my-workflow-job:
      uses: AllanOricil/workflow-template-bug/.github/workflows/workflow-template-fix.yml@master
      with:
        ENVIRONMENT: myenvironment

Instead of this

my-workflow-job:
      uses: AllanOricil/workflow-template-bug/.github/workflows/workflow-template-fix.yml@master
      with:
        ENVIRONMENT: myenvironment
      secrets:
        MY_SECRET: ${{ secrets.MY_SECRET }}

It seems really weird I have to specify the secrets in the Caller file. It is also not DRY having to repeat the secrets over and over again.

I know this is the only way to make it work, because I’ve done experiments in this repo The only way to make your dynamic Github environment secret to be loaded is if you declare the secret in the caller, in the template, and you must bind your job to an environment