name: tpl-env
description: "Format a Go template file given yaml input. The input has yaml file environment variables replaced first."
inputs:
  template:
    description: "Template or local path of the template file."
    required: true
  decoder:
    description: "Decoder format. Supported values: json, yaml, toml"
    required: true
    default: yaml
  input:
    description: "Input or local path of the input data file."
    required: true
outputs:
  result:
    description: "Local path of the output file."
    value: ${{ steps.template.outputs.result }}
runs:
  using: "composite"
  steps:
  - name: "Substitute Environment Variables"
    id: envsubst
    uses: act/common/utils/envsubst@master
    with:
      input: ${{ inputs.input }}
  - name: "Build Template"
    id: template
    uses: act/common/tpl/tpl-file@master
    with:
      template: ${{ inputs.template }}
      decoder: ${{ inputs.decoder }}
      input: ${{ steps.envsubst.outputs.result }}
