cuchi / jinja2-action

Use the Jinja2 template engine as a GitHub action

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

How to use jinja loop variable as env variable name?

bodomic2 opened this issue · comments

Hi guys, this could be more a question to Github actions than to your project, but maybe you have some handy answer...

I am trying to understand how to use sensitive data together with Jinja and Actions so I'm gonna hide the hashed passwords in github env variables:

{% for project in projects %}
{% if project.auth.enabled=true|default(false) %}
       {{ project.dashedname }}-auth.basicauth.users={{ env['HERE-GOES-MY-QUESTION'] }}
{% endif %}
{% endfor %}

So I'm gonna have some yamled structure to fill this template and a list of variables named like 'my-project1-hashed-password' in github env, How can I use loop variable to pick the env variable?

Alternatively - maybe I'm just doing it wrong and I can just put env names into data_file somehow?

Please advise.