Skip to content
upload-cloud

GitHub Action

Render Template (Handlebars)

v1.0.1 Latest version

Render Template (Handlebars)

upload-cloud

Render Template (Handlebars)

Renders a handlebars template with custom inputs

Installation

Copy and paste the following snippet into your .yml file.

              

- name: Render Template (Handlebars)

uses: badsyntax/github-action-render-template@v1.0.1

Learn more about this action in badsyntax/github-action-render-template

Choose a version

Render Template GitHub Action

Build & Test Render Template CodeQL

A super simple GitHub Action to render a handlebars template.

Features

  • Renders any handlebars template
  • Accepts any inputs via JSON string
  • Outputs an escaped string that can be used as an input to a different Action

Getting Started

name: 'Render Template'

on:
  pull_request:
    types: [opened, synchronize, reopened]
  push:
    branches:
      - master

jobs:
  deploy:
    name: 'Render'
    runs-on: ubuntu-20.04
    steps:
      - uses: actions/checkout@v2

      - uses: badsyntax/github-action-render-template@v0.0.1
        name: Render Template
        id: render-template
        with:
          template: '.github/pr-comment-template.hbs'
          inputs: |
            {
              "firstName":"Bob",
              "lastName":"Marley"
            }

      - name: Output Rendered Template
        run: |
          echo "Rendered Template: $OUTPUT"
        env:
          OUTPUT: ${{ steps.render-template.outputs.result }}

Action Inputs

Name Description Example
template The path to the handlebars template file ./.github/pr-comment-template.hbs
inputs A JSON string object of key value pairs (can include newlines) {"key":"value"}

Action Outputs

Name Description Example
result Escaped rendered template which can be used an input to a different Action (your rendered template)

Related Projects

Support

License

See LICENSE.md.