Search code examples
windowstemplatesenvironment-variablesjinja2github-actions

Need Jinja2 templates to work on Windows github runner


I have the following file in my repo containing variables that should be evaluated after checkout.

cat infra/.env_qa

myname="Appone_${{ inputs.component }}"
port="8814"
server_list="{{ secrets.deploy_pass }}"
....

https://github.com/cuchi/jinja2-action

I use Jinja templates to generate a new file with the values as below:

- name: Setup env file
  uses: cuchi/[email protected]
  with:
    template: infra/.env_qa.j2
    output_file: infra/.env_qa

Unfortunately, this action runs only on Linux while I have a Windows runner.

I would like to know

  1. Alternate Jinja template action that runs on Windows
  2. How can I determine if an action is designed to run on Windows or not without running it.

Solution

    1. Alternate Jinja template action that runs on Windows?

    You can search on the GitHub Actions Marketplace.

    As a workaround, you can run that action under ubuntu-latest in a separate job, upload the generated file as an artifact, and then download it under your Windows job. Or, you can directly use Jinja2 from the command line.

    1. How can I determine if an action is designed to run on Windows or not without running it?

    Docker based actions are supported only on Linux. You can identify them from their action.yml file and look for runs section e.g. see here.